retrieve_block
Fetch a specific block from Notion by its unique ID, enabling integration with AI assistants and efficient data retrieval for automation workflows.
Instructions
Retrieve a block from Notion by ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| blockId | Yes | The ID of the block to retrieve |
Implementation Reference
- src/tools/retrieveBlock.ts:6-29 (handler)The main handler function for the 'retrieve_block' tool. It retrieves a specific Notion block by its ID using the Notion API and returns the block data as a formatted text response.export const retrieveBlock = async ( params: RetrieveBlockParams ): Promise<CallToolResult> => { try { const response = await notion.blocks.retrieve({ block_id: params.blockId, }); return { content: [ { type: "text", text: "Block retrieved successfully! Note: If this block has children, use the retrieve_block_children endpoint to get the list of child blocks.", }, { type: "text", text: JSON.stringify(response, null, 2), }, ], }; } catch (error) { return handleNotionError(error); } };
- src/schema/blocks.ts:166-168 (schema)Zod schema defining the input parameters for the retrieve_block action: requires a blockId string.export const RETRIEVE_BLOCK_SCHEMA = { blockId: z.string().describe("The ID of the block to retrieve"), };
- src/tools/blocks.ts:20-21 (registration)Dispatch registration in the blocks operation handler: maps the 'retrieve_block' action to the retrieveBlock function.case "retrieve_block": return retrieveBlock(params.payload.params);
- src/tools/index.ts:22-28 (registration)MCP tool registration for 'notion_blocks', which includes the 'retrieve_block' action via BLOCKS_OPERATION_SCHEMA and registerBlocksOperationTool handler.// Register combined blocks operation tool server.tool( "notion_blocks", "Perform various block operations (retrieve, update, delete, append children, batch operations)", BLOCKS_OPERATION_SCHEMA, registerBlocksOperationTool );
- src/schema/blocks.ts:264-269 (schema)Definition of the 'retrieve_block' action within the BLOCKS_OPERATION_SCHEMA discriminated union.z.object({ action: z .literal("retrieve_block") .describe("Use this action to retrieve a block."), params: z.object(RETRIEVE_BLOCK_SCHEMA), }),