CLI
node ${CLAUDE_PLUGIN_ROOT}/scripts/actions.mjs <action> [args...]
Run actions directly. If the decision tree does not cover your case, run schema <action> for live metadata. Prefer schema over reading source.
Quick Patterns
- Read + summarize/report ->
getPage->createPage(2 calls) - Copy with modifications ->
copyPageWith(1 call) - Merge pages ->
createPage->mergePages(2 calls) - Batch property update ->
batchSetProperties(1 call)
Decision Tree
- Find something ->
search "query"orworkspaceMap - Read a page ->
getPage <id> - Query a database ->
queryDatabase <dbId>(markdown table;--format rawfor JSON) - Create a page ->
createPage <parentId> "Title" "markdown content" - Replace all content ->
updatePage <id> "content" - Add to end ->
appendBlocks <id> "content" - Update properties ->
setProperties <id> '{"Status":"Done"}' - Markdown table to database ->
importTable <parentId> "| md | table |" --title "Name"(infers column types) - Full copy with subpages ->
deepCopy <src> <parent> - Copy + modify ->
copyPageWith <src> <parent> "Title" --appendMd "## Extra" - Merge pages ->
mergePages '["id1","id2"]' <target> - Read one section ->
extractSection <id> "Heading" - Edit one section ->
replaceSection <id> "Heading" "new content" - Batch update ->
batchSetProperties '["id1","id2"]' '{"Status":"Done"}'
Key Behaviors
- Page reads and database queries return markdown by default.
getPageandextractSectionreturn markdown.queryDatabasereturns a compact markdown table with row IDs for follow-up actions. setPropertiesauto-types values from the database schema. Pass{"Status": "Done"}— no raw Notion API format needed.createPageaccepts markdown as the content argument.- Compound actions save turns — each CLI call is one agentic turn:
copyPageWith= read + modify + create in 1 callmergePages= N reads + merge in 1 call (target must exist; usecreatePagefirst)batchSetProperties= N updates in 1 call
- Stdin mode for large content:
echo '{"action":"createPage",...}' | node ${CLAUDE_PLUGIN_ROOT}/scripts/actions.mjs - - Auto-snapshot before destructive operations.
Common Pitfalls
- Do NOT fetch database entries individually —
queryDatabasereturns all in one call - Do NOT use
getPage+createPagewhencopyPageWithdoes both in one call - Do NOT use multiple
setPropertieswhenbatchSetPropertieshandles N pages - Do NOT read the script source — use
schema <action>or the references below mergePagestarget must already exist — usecreatePagefirst to create it- Large content (>4KB) should use stdin mode, not inline CLI args
- Properties are auto-typed from the database schema — pass simple values like
{"Status": "Done"}, not raw Notion API format - File/image URLs expire after ~1 hour — re-fetch if reusing later
References
references/action-reference.md— Read when you need exact parameter names or options for an unfamiliar action.references/workflows.md— Read when combining operations or piping large content via stdin.references/api-limits.md— Read when hitting API errors, size limits, or unexpected behavior.