update-block
Modify existing Notion blocks by updating their properties using JSON data to keep content current and organized.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"block_id": "<block_id>",
"properties": "<properties>"
},
"name": "update-block"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| block_id | Yes | The ID of the block to update | |
| properties | Yes | JSON string of block properties to update |
Implementation Reference
- src/lib/mcp-server.ts:490-527 (handler)The MCP tool registration, schema, and handler for 'update-block'. Defines input schema using Zod, handles execution by parsing properties JSON and calling NotionService.updateBlock, formats response or error.
this.server.tool( "update-block", { block_id: z.string().describe("The ID of the block to update"), properties: z .string() .describe("JSON string of block properties to update"), }, async ({ block_id, properties }) => { try { const block = await this.notionService.updateBlock( block_id, JSON.parse(properties) ); return { content: [ { type: "text", text: JSON.stringify(block, null, 2), }, ], }; } catch (error) { console.error("Error in update-block tool:", error); return { content: [ { type: "text", text: `Error: Failed to update block - ${ (error as Error).message }`, }, ], isError: true, }; } } ); - src/lib/mcp-server.ts:492-497 (schema)Zod input schema for the update-block tool: block_id (string) and properties (JSON string).
{ block_id: z.string().describe("The ID of the block to update"), properties: z .string() .describe("JSON string of block properties to update"), }, - src/lib/notion.ts:254-263 (helper)NotionService helper method that performs the actual block update by calling the Notion Client's blocks.update API with the provided block_id and properties.
async updateBlock(blockId: string, properties: Record<string, any>) { try { return await this.client.blocks.update({ block_id: blockId, ...properties, }); } catch (error) { this.handleError(error); } }