AI Codex
Tools & EcosystemHow It Works

How tool use works: what happens when Claude calls a function

Tool use is the mechanism that lets Claude do things, not just say things. Here's exactly what happens when Claude uses a tool.

4 min read·Tool Use

Tool use is what turns Claude from a text generator into something that can take actions in the world — search the web, query a database, send an email, run a calculation. Here's exactly how the mechanism works.

The basic sequence

  1. You define the tools. When you set up a Claude integration, you describe the functions Claude can call — their names, what they do, and what inputs they need. This happens in the system setup, not the conversation.

  2. The user asks something. Claude reads the question and the tools available to it.

  3. Claude decides whether to use a tool. If the question requires information or action that a tool can provide, Claude generates a structured call to that tool — the function name and the right inputs.

  4. The tool runs. Your system executes the function with Claude's inputs. This happens outside Claude — Claude hands off to your code, which calls whatever API or database is involved.

  5. The result comes back. Your system returns the tool's output to Claude.

  6. Claude incorporates it into the response. Claude uses the returned information to answer the original question.

What Claude actually controls

Claude decides whether to call a tool and what inputs to pass. Claude does not execute the tool itself — it just requests the call. Your system executes it. This matters for safety: you can validate Claude's tool calls before running them, limit what tools are available in different contexts, and log everything that happens.

An example: a customer support bot

The bot has two tools: search_knowledge_base(query) and get_account_status(account_id).

Customer asks: "Is my account on the Pro plan?"

Claude calls get_account_status with the customer's account ID. Gets back the plan ("starter") and renewal date (June 1st 2026). Responds: "Your account is currently on the Starter plan. Your renewal date is June 1st, 2026. Would you like information on upgrading to Pro?"

Claude didn't know the account status. It knew which tool to call and how to use the result. That's the division of labour.

The operator question

For most teams using Claude.ai: tool use is handled through Skills — you just enable them. For teams building with the API: defining tools well (clear names, accurate descriptions, the right input schema) is one of the most important decisions you make. Claude uses your descriptions to decide when and how to call each tool. Vague descriptions produce unreliable tool calls.


Further reading