notion_retrieve_block_children
Retrieve child content from Notion blocks to access nested information, supporting pagination and format options for reading or editing.
Instructions
Retrieve the children of a block
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| block_id | Yes | The ID of the block.It should be a 32-character string (excluding hyphens) formatted as 8-4-4-4-12 with hyphens (-). | |
| start_cursor | No | Pagination cursor for next page of results | |
| page_size | No | Number of results per page (max 100) | |
| format | No | Specify the response format. 'json' returns the original data structure, 'markdown' returns a more readable format. Use 'markdown' when the user only needs to read the page and isn't planning to write or modify it. Use 'json' when the user needs to read the page with the intention of writing to or modifying it. | markdown |
Implementation Reference
- src/client/index.ts:60-78 (handler)The main handler function in NotionClientWrapper that performs the actual Notion API call to retrieve block children using GET /blocks/{block_id}/children with optional pagination.async retrieveBlockChildren( block_id: string, start_cursor?: string, page_size?: number ): Promise<ListResponse> { const params = new URLSearchParams(); if (start_cursor) params.append("start_cursor", start_cursor); if (page_size) params.append("page_size", page_size.toString()); const response = await fetch( `${this.baseUrl}/blocks/${block_id}/children?${params}`, { method: "GET", headers: this.headers, } ); return response.json(); }
- src/types/schemas.ts:59-81 (schema)Tool schema defining the input schema, name, and description for the notion_retrieve_block_children tool.export const retrieveBlockChildrenTool: Tool = { name: "notion_retrieve_block_children", description: "Retrieve the children of a block", inputSchema: { type: "object", properties: { block_id: { type: "string", description: "The ID of the block." + commonIdDescription, }, start_cursor: { type: "string", description: "Pagination cursor for next page of results", }, page_size: { type: "number", description: "Number of results per page (max 100)", }, format: formatParameter, }, required: ["block_id"], }, };
- src/server/index.ts:302-326 (registration)Registration of the tool in the ListToolsRequestHandler by including it in the allTools array.server.setRequestHandler(ListToolsRequestSchema, async () => { const allTools = [ schemas.appendBlockChildrenTool, schemas.retrieveBlockTool, schemas.retrieveBlockChildrenTool, schemas.deleteBlockTool, schemas.updateBlockTool, schemas.retrievePageTool, schemas.updatePagePropertiesTool, schemas.listAllUsersTool, schemas.retrieveUserTool, schemas.retrieveBotUserTool, schemas.createDatabaseTool, schemas.queryDatabaseTool, schemas.retrieveDatabaseTool, schemas.updateDatabaseTool, schemas.createDatabaseItemTool, schemas.createCommentTool, schemas.retrieveCommentsTool, schemas.searchTool, ]; return { tools: filterTools(allTools, enabledToolsSet), }; });
- src/server/index.ts:76-87 (handler)Dispatch handler case in the MCP CallToolRequest handler that validates arguments and delegates to the NotionClientWrapper.retrieveBlockChildren method.case "notion_retrieve_block_children": { const args = request.params .arguments as unknown as args.RetrieveBlockChildrenArgs; if (!args.block_id) { throw new Error("Missing required argument: block_id"); } response = await notionClient.retrieveBlockChildren( args.block_id, args.start_cursor, args.page_size ); break;
- src/types/args.ts:20-25 (schema)TypeScript interface defining the argument types for the tool, used for type casting in the handler.export interface RetrieveBlockChildrenArgs { block_id: string; start_cursor?: string; page_size?: number; format?: "json" | "markdown"; }