Skip to content
bits
Give your model tools · Lesson 8 of 10

Tools Anthropic runs

Tutor:

Everything so far has been a client tool: Claude asks, your code runs it. Some tools are so common that Anthropic runs them for you. These are server tools. You add one line to tools, and the call, the run and the result all happen inside a single API request. Your code never sees a tool_use to handle.

As of October 2026, the main ones are web search (look things up, with citations), web fetch (read a page whose URL is already in the conversation), and code execution (run Python and Bash in a sandbox).

import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic();
const reply = await client.messages.create({
model: "claude-sonnet-5-5",
max_tokens: 4096,
messages: [{ role: "user", content: "What changed in the latest TypeScript release?" }],
tools: [
{ type: "web_search_20260209", name: "web_search", max_uses: 3 },
],
});
for (const block of reply.content) {
if (block.type === "text") console.log(block.text);
}
TypeScriptUTF-8● lines 9–11: one line turns it on
OUTPUT
npx tsx search.ts
example output, written for this lesson (not a live run)
server_tool_use web_search { query: "TypeScript latest release notes" }
web_search_tool_result 8 results
text The latest release adds … (with citations to the pages it used)
Tutor:

Notice the type: server tools don't take a name you make up or a schema you write. You pick a versioned type from Anthropic's docs, like web_search_20260209, and Anthropic owns the description. Newer versions add features, so check the docs for the current one and the models that support it.

Tutor:

Each one has its own controls and costs. Web search costs $10 per 1,000 searches plus tokens, and the search results count as input tokens, so cap it with max_uses and restrict it to trusted sites with allowed_domains when you can. Code execution runs in a container with no internet access. Each organization gets 1,550 free hours a month, then it's $0.05 an hour per container, and it's free when you use it alongside the newer web search or web fetch. (Prices as of October 2026.)

When a server tool fails, the request doesn't. You get a normal reply with a result block that holds an error_code, like max_uses_exceeded, and Claude usually explains what happened in its answer.

quick check+20 neurons
Tutor:

You add { type: "web_search_20260209", name: "web_search" } to your tools. Who runs the search?

    Type your answer or tap an option · Enter checks

    quick check+20 neurons
    Tutor:

    Which job needs a client tool you write yourself?

      Type your answer or tap an option · Enter checks

      Tutor:

      That's the rule of thumb: use a server tool when Anthropic already offers it, and write a client tool for your systems.