delete-block
Remove content blocks from Notion pages by specifying the block ID to clean up or reorganize workspace content.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| block_id | Yes | The ID of the block to delete |
Implementation Reference
- src/lib/mcp-server.ts:530-561 (registration)Registers the 'delete-block' MCP tool, including input schema (block_id: string), handler function that delegates to NotionService.deleteBlock, and error handling with JSON response.this.server.tool( "delete-block", { block_id: z.string().describe("The ID of the block to delete"), }, async ({ block_id }) => { try { const result = await this.notionService.deleteBlock(block_id); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; } catch (error) { console.error("Error in delete-block tool:", error); return { content: [ { type: "text", text: `Error: Failed to delete block - ${ (error as Error).message }`, }, ], isError: true, }; } } );
- src/lib/notion.ts:268-276 (helper)Implements the core logic for deleting a Notion block by calling the Notion SDK's client.blocks.delete method, which archives the block.async deleteBlock(blockId: string) { try { return await this.client.blocks.delete({ block_id: blockId, }); } catch (error) { this.handleError(error); } }