Skip to main content
Glama

retrieve_block_children

Retrieve child elements of a specific block in Notion using the block ID. Supports pagination for handling large datasets. Integrates with the Notion MCP Server for API interactions.

Instructions

Retrieve the children of a block from Notion

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
blockIdYesThe ID of the block to retrieve children for
page_sizeNoNumber of results to return (1-100)
start_cursorNoCursor for pagination

Implementation Reference

  • The core handler function that executes the retrieve_block_children tool logic by calling the Notion API to list children blocks.
    export const retrieveBlockChildren = async ( params: RetrieveBlockChildrenParams ): Promise<CallToolResult> => { try { const response = await notion.blocks.children.list({ block_id: params.blockId, start_cursor: params.start_cursor, page_size: params.page_size, }); return { content: [ { type: "text", text: `Successfully retrieved ${response.results.length} children of block ${params.blockId}`, }, { type: "text", text: `Has more: ${response.has_more ? "Yes" : "No"}${ response.has_more && response.next_cursor ? `, Next cursor: ${response.next_cursor}` : "" }`, }, { type: "text", text: JSON.stringify(response.results, null, 2), }, ], }; } catch (error) { return handleNotionError(error); } };
  • Dispatches the retrieve_block_children action by calling the handler function within the blocks operation tool.
    case "retrieve_block_children": return retrieveBlockChildren(params.payload.params);
  • Defines the input schema (parameters) for the retrieve_block_children tool.
    export const RETRIEVE_BLOCK_CHILDREN_SCHEMA = { blockId: z.string().describe("The ID of the block to retrieve children for"), start_cursor: z.string().optional().describe("Cursor for pagination"), page_size: z .number() .min(1) .max(100) .optional() .describe("Number of results to return (1-100)"), };
  • TypeScript type and schema wrapper for retrieve_block_children parameters.
    export const retrieveBlockChildrenSchema = z.object( RETRIEVE_BLOCK_CHILDREN_SCHEMA ); export type RetrieveBlockChildrenParams = z.infer< typeof retrieveBlockChildrenSchema >;
  • Imports the retrieveBlockChildren handler for use in the blocks dispatcher.
    import { retrieveBlockChildren } from "./retrieveBlockChildren.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