Skip to main content
Glama
awkoy

notion-mcp-server

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
NameRequiredDescriptionDefault
blockIdYesThe ID of the block to append children to
childrenYesArray of blocks to append as children

Implementation Reference

  • 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);
      }
    };
  • 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);
  • 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"),
    };
  • 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),
  • Import statement registering the appendBlockChildren handler for use in the blocks operation dispatcher.
    import { appendBlockChildren } from "./appendBlockChildren.js";

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/awkoy/notion-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server