Skip to main content
Glama

delete_block

Remove or archive a specific block in Notion by providing its block ID using the Notion MCP Server integration.

Instructions

Delete (move to trash) a block in Notion

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
blockIdYesThe ID of the block to delete/archive

Implementation Reference

  • The core handler function for the 'delete_block' tool. It deletes the specified Notion block using the Notion API and returns a success message with the response or handles errors.
    export const deleteBlock = async ( params: DeleteBlockParams ): Promise<CallToolResult> => { try { const response = await notion.blocks.delete({ block_id: params.blockId, }); return { content: [ { type: "text", text: `Block ${params.blockId} deleted (moved to trash) successfully`, }, { type: "text", text: JSON.stringify(response, null, 2), }, ], }; } catch (error) { return handleNotionError(error); } };
  • Registration/dispatch logic within the 'notion_blocks' tool handler that routes 'delete_block' action to the deleteBlock function.
    case "delete_block": return deleteBlock(params.payload.params);
  • Zod schema defining the input parameters for the 'delete_block' tool (blockId). Used in the BLOCKS_OPERATION_SCHEMA.
    export const DELETE_BLOCK_SCHEMA = { blockId: z.string().describe("The ID of the block to delete/archive"), };
  • Integration of 'delete_block' action and its schema into the overarching BLOCKS_OPERATION_SCHEMA for the 'notion_blocks' tool.
    .literal("delete_block") .describe("Use this action to delete/archive a block."), params: z.object(DELETE_BLOCK_SCHEMA), }),
  • Top-level registration of the 'notion_blocks' MCP tool, which includes the 'delete_block' action among others.
    "notion_blocks", "Perform various block operations (retrieve, update, delete, append children, batch operations)", BLOCKS_OPERATION_SCHEMA, registerBlocksOperationTool );

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

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