append_block_children
Add child blocks to a specific parent block in Notion to organize or expand content efficiently.
Instructions
Append child blocks to a parent block in Notion
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| blockId | Yes | The ID of the block to append children to | |
| children | Yes | Array of blocks to append as children |
Implementation Reference
- src/tools/appendBlockChildren.ts:6-30 (handler)The main handler function that executes the append_block_children tool logic by calling the Notion API to append child blocks to a specified block.export const appendBlockChildren = async ( params: AppendBlockChildrenParams ): Promise<CallToolResult> => { try { const response = await notion.blocks.children.append({ block_id: params.blockId, children: params.children, }); return { content: [ { type: "text", text: `Successfully appended ${params.children.length} block(s) to ${params.blockId}`, }, { type: "text", text: `Block ID: ${JSON.stringify(response, null, 2)}`, }, ], }; } catch (error) { return handleNotionError(error); } };
- src/tools/blocks.ts:18-19 (registration)Registers and dispatches the append_block_children action within the blocks operation tool handler by calling the specific appendBlockChildren function.case "append_block_children": return appendBlockChildren(params.payload.params);
- src/schema/blocks.ts:159-164 (schema)Zod schema defining the input parameters for the append_block_children tool: blockId (string) and children (array of text block requests).export const APPEND_BLOCK_CHILDREN_SCHEMA = { blockId: z.string().describe("The ID of the block to append children to"), children: z .array(TEXT_BLOCK_REQUEST_SCHEMA) .describe("Array of blocks to append as children"), };
- src/schema/blocks.ts:260-262 (schema)Part of the BLOCKS_OPERATION_SCHEMA defining the discriminated union for the append_block_children action including its literal action name and params reference..literal("append_block_children") .describe("Use this action to append children to a block."), params: z.object(APPEND_BLOCK_CHILDREN_SCHEMA),
- src/tools/blocks.ts:4-4 (registration)Import statement registering the appendBlockChildren handler for use in the blocks operation dispatcher.import { appendBlockChildren } from "./appendBlockChildren.js";