Skip to main content
Glama

delete-block

Remove content blocks from Notion pages by specifying the block ID to clean up or reorganize workspace content.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
block_idYesThe ID of the block to delete

Implementation Reference

  • 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, }; } } );
  • 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); } }

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/ramidecodes/mcp-server-notion'

If you have feedback or need assistance with the MCP directory API, please join our Discord server