Skip to main content
Glama

get-block-children

Retrieve child blocks from a Notion block to access nested content and structure within your workspace.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
block_idYesThe ID of the block to get children from
page_sizeNoNumber of results to return (max 100)
start_cursorNoPagination cursor

Implementation Reference

  • The MCP tool handler for 'get-block-children' that calls NotionService.retrieveBlockChildren and handles response/error formatting.
    async ({ block_id, page_size, start_cursor }) => { try { const blocks = await this.notionService.retrieveBlockChildren({ block_id, page_size, start_cursor, }); return { content: [ { type: "text", text: JSON.stringify(blocks, null, 2), }, ], }; } catch (error) { console.error("Error in get-block-children tool:", error); return { content: [ { type: "text", text: `Error: Failed to retrieve block children - ${ (error as Error).message }`, }, ], isError: true, }; } }
  • Zod input schema for the 'get-block-children' tool parameters.
    { block_id: z .string() .describe("The ID of the block to get children from"), page_size: z .number() .min(1) .max(100) .optional() .describe("Number of results to return (max 100)"), start_cursor: z.string().optional().describe("Pagination cursor"), },
  • Registration of the 'get-block-children' tool on the MCP server within registerBlockTools().
    this.server.tool( "get-block-children", { block_id: z .string() .describe("The ID of the block to get children from"), page_size: z .number() .min(1) .max(100) .optional() .describe("Number of results to return (max 100)"), start_cursor: z.string().optional().describe("Pagination cursor"), }, async ({ block_id, page_size, start_cursor }) => { try { const blocks = await this.notionService.retrieveBlockChildren({ block_id, page_size, start_cursor, }); return { content: [ { type: "text", text: JSON.stringify(blocks, null, 2), }, ], }; } catch (error) { console.error("Error in get-block-children tool:", error); return { content: [ { type: "text", text: `Error: Failed to retrieve block children - ${ (error as Error).message }`, }, ], isError: true, }; } } );
  • Supporting method in NotionService that wraps the Notion Client API call for retrieving block children.
    async retrieveBlockChildren(params: BlockChildrenQuery) { try { return await this.client.blocks.children.list({ block_id: params.block_id, start_cursor: params.start_cursor, page_size: params.page_size, }); } catch (error) { this.handleError(error); } }

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/ramidecodes/mcp-server-notion'

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