← Back to ToolBench
Utilities

Tool Annotations

Metadata hints about tool behavior and safety

What it does

Tool annotations provide metadata hints about a tool's behavior. Annotations include readOnlyHint (doesn't modify state), destructiveHint (may delete or irreversibly alter data), idempotentHint (safe to call repeatedly), and openWorldHint (interacts with external systems). These help clients make safety decisions about tool execution, like requiring confirmation for destructive operations.

How it works

Tool Definition readOnlyHint no side effects destructiveHint may delete data idempotentHint safe to retry openWorldHint external systems Clients use these to decide: auto-approve, require confirmation, or block

Example implementation

server.tool("delete_user", { id: z.string() },
  async ({ id }) => { /* ... */ },
  {
    annotations: {
      destructiveHint: true,
      idempotentHint: true,
      openWorldHint: false,
      readOnlyHint: false,
    }
  }
);