← 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
Example implementation
server.tool("delete_user", { id: z.string() },
async ({ id }) => { /* ... */ },
{
annotations: {
destructiveHint: true,
idempotentHint: true,
openWorldHint: false,
readOnlyHint: false,
}
}
);