Answer: You define a tool by four parts passed to the tool() helper in TypeScript or the @tool decorator in Python: name, description, input schema, and handler. Then you wrap it in a server with createSdkMcpServer (TypeScript) or create_sdk_mcp_server (Python), which runs in-process inside your application. Status: Confirmed Entry: tool/claude-code/agents-and-automation/create-custom-tool Revision: 2 Digest: sha256:88277ffeed5e106d (changes whenever the content changes) Timeline: Created: 2026-11-13T03:02:41Z Last changed: 2026-11-14T12:12:03Z (Required handler return field: — → content) Last verified: 2026-11-20T12:16:27Z Next check: 2026-11-21T12:16:27Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of TypeScript helper | tool() | [1] | 2026-11-20 Python decorator | @tool | [1] | 2026-11-20 TypeScript input schema | Zod schema | [1] | 2026-11-20 Python input schema | a dict mapping names to types, like `{"latitude": float}` | [1] | 2026-11-20 TypeScript server wrapper | createSdkMcpServer | [1] | 2026-11-20 Python server wrapper | create_sdk_mcp_server | [1] | 2026-11-20 Required handler return field | content | [1] | 2026-11-20 Sources: [1] Anthropic. "Give Claude custom tools". https://code.claude.com/docs/en/agent-sdk/custom-tools.md Role: primary. Accessed: 2026-11-20T12:16:27Z Quote: "passed as arguments to the [`tool()`](https://code.claude.com/docs/en/agent-sdk/typescript#tool) helper in TypeScript" (Supports: TypeScript helper) Quote: "the [`@tool`](https://code.claude.com/docs/en/agent-sdk/python#tool) decorator in Python" (Supports: Python decorator) Quote: "**TypeScript**: a [Zod schema](https://zod.dev/)." (Supports: TypeScript input schema) Quote: "**Python**: a dict mapping names to types, like `{"latitude": float}`, which the SDK converts to JSON Schema for you." (Supports: Python input schema) Quote: "wrap it in a server with [`createSdkMcpServer`](https://code.claude.com/docs/en/agent-sdk/typescript#createsdkmcpserver) (TypeScript)" (Supports: TypeScript server wrapper) Quote: "[`create_sdk_mcp_server`](https://code.claude.com/docs/en/agent-sdk/python#create_sdk_mcp_server) (Python)" (Supports: Python server wrapper) Quote: "`content` (required): an array of result blocks" (Supports: Required handler return field) Published: 2026-11-20T03:17:49Z Snapshot SHA-256: b07693fa054e2dfa05152f984f16332c405b2cba4c21f6318b5de68348eeb640 (captured 2026-11-20T12:16:27Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. Cross-check: not-available at 2026-11-20T12:16:27Z. No independent second source is configured for this entry Last successful check: 2026-11-20T12:16:27Z Last attempt: 2026-11-20T12:16:27Z Notes and limitations: Extracted automatically from a single official source (section "Create a custom tool"). Related: https://latestn.com/tool/claude-code/agents-and-automation/create-scheduled-task How do I create a scheduled task in Claude Code Desktop? https://latestn.com/tool/claude-code/agents-and-automation/create-scheduled-task-cli How do I create a scheduled task in Claude Code from the CLI? https://latestn.com/tool/claude-code/agents-and-automation/create-skill How do I create a skill for Claude Agent SDK sessions? https://latestn.com/tool/claude-code/agents-and-automation/continue-conversations How do I continue a conversation when running Claude Code programmatically? https://latestn.com/tool/claude-code/agents-and-automation/control-turns-and-budget How do I control how many turns or budget a Claude Code agent loop runs? https://latestn.com/tool/claude-code/agents-and-automation/create-custom-subagent How do I create a custom subagent in Claude Code? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-14T12:12:03Z | changed | Required handler return field: — → content | [1] 2026-11-14T12:12:03Z | changed | Python input schema: — → a dict mapping names to types, like `{"latitude": float}` | [1] 2026-11-14T12:12:03Z | changed | TypeScript input schema: — → Zod schema | [1] 2026-11-14T12:12:03Z | changed | required handler return field: content → — | [1] 2026-11-14T12:12:03Z | changed | tool parts: four parts → — | [1] 2026-11-13T03:02:41Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/claude-code/agents-and-automation/create-custom-tool/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/claude-code/agents-and-automation/create-custom-tool POST: https://latestn.com/dispute/tool/claude-code/agents-and-automation/create-custom-tool with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/claude-code/agents-and-automation/create-custom-tool?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How do I create a custom tool for Claude Code using the Agent SDK? Revision 2, last verified 2026-11-20T12:16:27Z. https://latestn.com/tool/claude-code/agents-and-automation/create-custom-tool (accessed 2026-11-21T09:57:22Z). @misc{LatestN_tool_claude_code_agents_and_automation_create_custom_tool_r2, title = {How do I create a custom tool for Claude Code using the Agent SDK?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/claude-code/agents-and-automation/create-custom-tool}}, note = {Revision 2; digest sha256:88277ffeed5e106d; last verified 2026-11-20T12:16:27Z; accessed 2026-11-21T09:57:22Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/claude-code/agents-and-automation/create-custom-tool