Anthropic Messages with and without a server prompt supports exactly two server tools. Claude API executes them, so your application does not send an ordinary client tool_result.
| Tool | Exact type | Required limits |
|---|---|---|
| Web search | web_search_20250305 | max_uses: 1–5 |
| Web fetch | web_fetch_20250910 | max_uses: 1–3; max_content_tokens: 1–25,000 (approximate, text only) |
json
{
"model": "claude-opus-5",
"max_tokens": 2048,
"tools": [
{
"type": "web_search_20250305",
"name": "web_search",
"max_uses": 3,
"allowed_domains": ["docs.python.org"]
},
{
"type": "web_fetch_20250910",
"name": "web_fetch",
"max_uses": 2,
"max_content_tokens": 12000,
"allowed_domains": ["docs.python.org"],
"citations": {"enabled": true}
}
],
"messages": [{
"role": "user",
"content": "Find the current asyncio docs and open the best result"
}]
}| Object | Allowed fields |
|---|---|
| Web search | type, name, max_uses; optional allowed_domains or blocked_domains, allowed_callers |
| Web fetch | Web search fields + required max_content_tokens; optional citations |
namemust be exactlyweb_searchorweb_fetch; at most one server tool of each type is allowed per request. Guard accepts only the listed fields: unknown fields (including the official search optionuser_location) and other typed tool variants are rejected with400.- If supplied,
allowed_callersmust be exactly["direct"]. allowed_domainsandblocked_domainsare mutually exclusive. Each list accepts at most 100 ASCII domains, with no scheme, IP address, query/fragment, backslash, or wildcard in the hostname.- Web search may include an optional path after the domain, such as
docs.python.org/3/*; Web fetch accepts a bare domain only, with no path. - Web fetch
citations, when supplied, must be exactly{"enabled": true}or{"enabled": false}with no extra fields. Client tools must omittypeor usetype: "custom".
- The client must pass the limits above explicitly. A value over the limit or an unknown server-tool version is rejected with
400before execution. - Both tools first return
server_tool_use, followed by the correspondingweb_search_tool_resultorweb_fetch_tool_result; search citations are always on, while fetch citations are optional. - A tool failure may arrive inside a successful HTTP
200: find a tool-result block whosecontent.typeends in_tool_result_error, then readcontent.error_code. - Web fetch accepts a URL no longer than 250 characters that already appeared in a user message, client tool result, or earlier search/fetch result. It supports text, HTML, and PDF; sites that require JavaScript rendering are unsupported, and failed fetches consume
max_uses. - A successful Web search with no matches returns
content: []; this is not a tool error.
| Item | Charge |
|---|---|
| Web search | $0.01 per provider-reported billed request + ordinary input tokens for generated content |
| Provider-nonbillable Web search error | No $0.01 tool charge |
| Web fetch | No separate fee; fetched content is billed as input tokens |
- Kimi. Search and page fetch live in two separate endpoints,
POST /v1/kimi/searchandPOST /v1/kimi/fetch. They never call the model: they return text that you put into your next chat request yourself. There is no separate charge for them, you pay only for the tokens of that request. Request bodies, limits and error codes are on Kimi · Chat Completions. - Composer and Grok. Built-in web search is available during a reply. There is no separate public call for controlling this search; typed Anthropic server tools are not accepted. Client functions are supplied separately through
toolsand run by your client.