Skip to main content
Glama
awkoy

notion-mcp-server

batch_delete_blocks

Remove multiple blocks at once by specifying their IDs, streamlining content cleanup and management in Notion.

Instructions

Delete multiple blocks in a single operation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
blockIdsYesArray of block IDs to delete in a single batch

Implementation Reference

  • The core handler function `batchDeleteBlocks` that loops through an array of block IDs and deletes each block using the Notion API's blocks.delete method. It collects results and returns a formatted response indicating success or handles errors.
    export const batchDeleteBlocks = async (
      params: BatchDeleteBlocksParams
    ): Promise<CallToolResult> => {
      try {
        const results = [];
    
        for (const blockId of params.blockIds) {
          const response = await notion.blocks.delete({
            block_id: blockId,
          });
    
          results.push({
            blockId,
            success: true,
            response,
          });
        }
    
        return {
          content: [
            {
              type: "text",
              text: `Successfully deleted ${params.blockIds.length} blocks (moved to trash)`,
            },
            {
              type: "text",
              text: JSON.stringify(results, null, 2),
            },
          ],
        };
      } catch (error) {
        return handleNotionError(error);
      }
    };
  • Within the main `registerBlocksOperationTool` dispatcher, the case for action 'batch_delete_blocks' invokes the specific batchDeleteBlocks handler.
    case "batch_delete_blocks":
      return batchDeleteBlocks(params.payload.params);
  • Zod schema defining the input parameters for batch_delete_blocks: an array of block ID strings.
    export const BATCH_DELETE_BLOCKS_SCHEMA = {
      blockIds: z
        .array(z.string().describe("The ID of a block to delete/archive"))
        .describe("Array of block IDs to delete in a single batch"),
    };
  • Part of the BLOCKS_OPERATION_SCHEMA discriminated union, defining the 'batch_delete_blocks' action with its literal value and associated params schema.
    z.object({
      action: z
        .literal("batch_delete_blocks")
        .describe(
          "Use this action to perform batch delete operations on blocks."
        ),
      params: z.object(BATCH_DELETE_BLOCKS_SCHEMA),
    }),
  • Exports the full Zod schema object and infers the TypeScript type for BatchDeleteBlocksParams.
    export const batchDeleteBlocksSchema = z.object(BATCH_DELETE_BLOCKS_SCHEMA);
    export type BatchDeleteBlocksParams = z.infer<typeof batchDeleteBlocksSchema>;
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool deletes multiple blocks but doesn't specify whether this is permanent or reversible, what permissions are required, if there are rate limits, or how errors are handled (e.g., partial failures). For a destructive operation with zero annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It is front-loaded and wastes no space, making it easy to parse quickly for an AI agent.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a batch deletion tool with no annotations and no output schema, the description is incomplete. It doesn't address critical aspects like return values, error handling, or behavioral traits (e.g., atomicity of operations). For a destructive tool, more context is needed to ensure safe and correct usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, clearly documenting that 'blockIds' is an array of block IDs to delete. The description adds no additional meaning beyond this, as it doesn't explain format constraints, size limits, or validation rules. With high schema coverage, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Delete multiple blocks') and scope ('in a single operation'), which is specific and distinguishes it from the sibling tool 'delete_block' that presumably handles single deletions. However, it doesn't explicitly mention what a 'block' is in this context, which could be clarified for better distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'delete_block' for single deletions or 'archive_page' for archiving pages. It lacks context about prerequisites, such as whether blocks must exist or be accessible, and doesn't mention any exclusions or specific scenarios where batch deletion is preferred.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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