Skip to content
IsoKron

Bulk deletes have a guard

A delete tool that takes many targets must not treat an empty, missing or match-all selector as "everything" unless the caller opts in explicitly, and should offer a dry run and cap the batch size (MWS-TGT-2).

Check surface-bulk-delete · Write-surface design · default severity: attention · rubric 2.1.0

What fails

The delete tool takes an array or filter of targets and has no dry-run or confirm argument, so one wrong selector removes many objects.

The rule

A tool that deletes or bulk-updates MUST NOT treat an empty, missing or match-all selector, or the path of a container, as selecting every object in the container or collection unless the caller sets an explicit argument that opts in.

Source: MCP Write-Safety Requirements 0.9

How to fix it

Add a dry-run argument, refuse an empty or match-all selector unless an explicit opt-in is set, and cap the number of items per call.

  1. Refuse an empty, missing or wildcard selector unless an explicit all argument is true.
  2. Add dry_run (default true) and return what would be deleted.
  3. Cap the number of items per call, for example 100.

TypeScript SDK

TypeScript
import { McpServer } from '@modelcontextprotocol/server';
import * as z from 'zod';

const server = new McpServer({ name: 'issues', version: '1.0.0' });

server.registerTool(
  'delete_issues',
  {
    title: 'Delete issues',
    description: 'Delete up to 100 issues by ID. With dry_run true (the default) returns what would be deleted. An empty list deletes nothing. Use only when the user asks to delete specific issues.',
    inputSchema: z.strictObject({
      issue_ids: z.array(z.string()).min(1).max(100).describe('Issue IDs to delete, 1 to 100'),
      dry_run: z.boolean().default(true).describe('true: preview only; false: delete'),
    }),
    annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
  },
  async ({ issue_ids, dry_run }) => ({ content: [{ type: 'text', text: 'Done' }] }),
);

Python SDK

Python
from typing import Annotated

from pydantic import Field
from mcp.server.mcpserver import MCPServer
from mcp.types import ToolAnnotations

server = MCPServer("issues")

@server.tool(
    title="Delete issues",
    annotations=ToolAnnotations(readOnlyHint=False, destructiveHint=True, openWorldHint=False),
)
def delete_issues(
    issue_ids: Annotated[list[str], Field(description="Issue IDs to delete, 1 to 100", min_length=1, max_length=100)],
    dry_run: Annotated[bool, Field(description="true: preview only; false: delete")] = True,
) -> str:
    """Delete up to 100 issues by ID. With dry_run true (the default) returns what would be deleted. An empty list deletes nothing. Use only when the user asks to delete specific issues."""
    return "Done"

Run against @modelcontextprotocol/server 2.4.0, mcp 2.3.0 and fastmcp 4.2.2 on 2026-11-18; the checker confirms this check passes on the tool list each snippet produces.

Questions

How does a bulk delete go wrong with an agent?

A filter built from a misread request, an empty list that the backend reads as "no filter", or a path that names the container instead of an item: each can select everything.

Is a confirm argument enough?

It helps, but a dry run shows the count and the items before anything is removed, which a yes/no confirm does not.

Further reading

How this check is graded

It counts toward: Write-surface design. See the rubric.

Last verified against MCP Write-Safety Requirements 0.9 on 2026-11-18. The rule above is quoted in the source’s own words. This page as Markdown.

Check your tool list: paste your tools/list, nothing is sent anywhere