ToolAnnotations
Re-exported from @modelcontextprotocol/sdk/types.js. All fields are optional hints; clients should not rely on them for security decisions.
| Field | Type | Default | Description |
|---|---|---|---|
title | string | undefined | Human-readable title for the tool |
readOnlyHint | boolean | false | If true, the tool does not modify its environment |
destructiveHint | boolean | true | If true, the tool may perform destructive updates (only meaningful when readOnlyHint is false) |
idempotentHint | boolean | false | If true, repeated calls with the same arguments have no additional effect (only meaningful when readOnlyHint is false) |
openWorldHint | boolean | true | If true, the tool interacts with external entities (for example, web search). If false, the tool's domain is closed (for example, a memory tool) |
typescript
import { tool } from "@anthropic-ai/claude-agent-sdk";
import { z } from "zod";
const searchTool = tool(
"search",
"Search the web",
{ query: z.string() },
async ({ query }) => {
return { content: [{ type: "text", text: `Results for: ${query}` }] };
},
{ annotations: { readOnlyHint: true, openWorldHint: true } }
);createSdkMcpServer()
Creates an MCP server instance that runs in the same process as your application.
typescript
function createSdkMcpServer(options: {
name: string;
version?: string;
instructions?: string;
tools?: Array<SdkMcpToolDefinition<any>>;
alwaysLoad?: boolean;
timeout?: number;
}): McpSdkServerConfigWithInstance;