Follow Discord
Sweep 20 Nov 2026 · 19:55Z Build v2.1.330 547 read Stable v2.1.323 Latest v2.1.330 Next v2.1.330 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · api

define-tools changedagents-and-tools/tool-use/define-tools

Nearest release: v2.1.328, published 7 hours after this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.

Recorded here
Lines+5added
Lines−5removed
From line 577 where the diff opens
First seen 14 Aug 2026 this site's first read of the page
Recorded edits29to this page, all time

The whole hunk

from line 577, old and new numbered
/
lines
from line 577
577577 
578578### Requirements and limitations
579579 
580* **Schema validation** - Each example must be valid according to the tool’s `input_schema`. Invalid examples return a 400 error.
581* **Not supported for server-side tools or client toolsets** - Input examples work on user-defined and Anthropic-schema client tools other than the [computer use](https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool) and [browser use](https://platform.claude.com/docs/en/agents-and-tools/tool-use/browser-use-tool) toolsets, but not on server tools such as web search or code execution.
582* **Token cost** - Examples add to prompt tokens: \~20–50 tokens for simple examples, \~100–200 tokens for complex nested objects.
580* **Valid examples:** Validate each example against the tool’s `input_schema` yourself. The API usually returns a 400 error for an invalid example. In some cases, such as a schema with a `pattern`, it skips the check and Claude sees the invalid example.
581* **Supported tools:** Input examples work on user-defined tools and some Anthropic-schema client tools. To check which kinds of tools accept them, see the `input_examples` row of the tool reference’s [Tool definition properties](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-reference#tool-definition-properties) table.
582* **Token cost:** Each example adds input tokens: about 100 for an example with a few flat values and about 200 for one with nested objects.
583583 
584584## Controlling Claude’s output
585585 
from line 880
880880 When using [prompt caching](https://platform.claude.com/docs/en/build-with-claude/prompt-caching#what-invalidates-the-cache), changes to the `tool_choice` parameter will invalidate cached message blocks. Tool definitions and system prompts remain cached, but message content must be reprocessed.
881881</Note>
882882 
883This diagram illustrates how each option works:
883This diagram shows how the `auto`, `any`, and `tool` options work:
884884 
885885<Frame>
886886 ![Diagram of three tool\_choice options: auto (a tool or a plain response), any (one of the tools), and tool (the named tool)](https://platform.claude.com/docs/images/tool_choice.svg)
887887</Frame>
888888 
889Note that when you have `tool_choice` as `any` or `tool`, the API prefills the assistant message to force a tool to be used. This means that the models will not emit a natural language response or explanation before `tool_use` content blocks, even if explicitly asked to do so.
889When `tool_choice` is `any` or `tool`, the API makes Claude’s response start with a tool call. As a result, Claude doesn’t emit a natural-language response or explanation before `tool_use` content blocks, even if you ask it to.
890890 
891891Testing has shown that this should not reduce performance. If you would like the model to provide natural language context or explanations while still requesting that the model use a specific tool, you can use `{"type": "auto"}` for `tool_choice` (the default) and add explicit instructions in a `user` message. For example: `What's the weather like in London? Use the get_weather tool in your response.`
892892 
Feedback