notion_update_block
Modify content of a Notion block by specifying its ID and updated data. Choose JSON for editing or Markdown for viewing the response. Part of the Notion MCP Server.
Instructions
Update the content of a block in Notion based on its type. The update replaces the entire value for a given field.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| block | Yes | The updated content for the block. Must match the block's type schema. | |
| block_id | Yes | The ID of the block to update.It should be a 32-character string (excluding hyphens) formatted as 8-4-4-4-12 with hyphens (-). | |
| 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/server/index.ts:100-111 (handler)MCP server handler case for 'notion_update_block': validates input arguments and calls the NotionClientWrapper.updateBlock method.case "notion_update_block": { const args = request.params .arguments as unknown as args.UpdateBlockArgs; if (!args.block_id || !args.block) { throw new Error("Missing required arguments: block_id and block"); } response = await notionClient.updateBlock( args.block_id, args.block ); break; }
- src/client/index.ts:89-100 (handler)Core implementation of block update: sends PATCH request to Notion API /blocks/{block_id} with the provided block object.async updateBlock( block_id: string, block: Partial<BlockResponse> ): Promise<BlockResponse> { const response = await fetch(`${this.baseUrl}/blocks/${block_id}`, { method: "PATCH", headers: this.headers, body: JSON.stringify(block), }); return response.json(); }
- src/types/schemas.ts:99-119 (schema)Tool schema definition for 'notion_update_block' including name, description, and input validation schema.export const updateBlockTool: Tool = { name: "notion_update_block", description: "Update the content of a block in Notion based on its type. The update replaces the entire value for a given field.", inputSchema: { type: "object", properties: { block_id: { type: "string", description: "The ID of the block to update." + commonIdDescription, }, block: { type: "object", description: "The updated content for the block. Must match the block's type schema.", }, format: formatParameter, }, required: ["block_id", "block"], }, };
- src/server/index.ts:303-325 (registration)Registers 'updateBlockTool' by including it in the list of tools returned in ListToolsRequest handler, filtered by enabledToolsSet.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/types/args.ts:32-36 (helper)TypeScript interface for UpdateBlockArgs used in type casting for tool arguments.export interface UpdateBlockArgs { block_id: string; block: Partial<BlockResponse>; format?: "json" | "markdown"; }