Minideas

Idea 12 of 15 · The Claude API

Giving Claude tools

Describe a function, and Claude asks your code to run it when it needs to.

your codedef get_order_status(order_id):…looks it upthe request to Claudetools: [{name: "get_order_status",description:"Look up where an order is."input_schema: {order_id: int}}],messages: [ … ]the function stays hereClaude gets only the description, and uses it to decide when to call
1 / 5

Describe each tool

A tool is a function in your code. You send its description with every request, in a tools list next to messages: its name, what it does and when to use it, and its inputs as a JSON schema. Claude sees only the description, so write it with care.

Where’s myorder 418?Claude only writesthe request;your code runs itget_order_status(418)Claude writes a tool requestyour coderuns itshipped · arrives Frithe result goes back in
2 / 5

Claude asks, your code runs

A customer writes “Where’s my order 418?” From free text, your code can’t tell which function to call, or with what. Claude can: it replies with a tool request, get_order_status with order 418. Your code runs it and returns the result in the next message; Claude never runs anything itself.

Clauderepliesyour coderuns the toolresultsent backtext reply:doneloop until the reply is text, not a tool request
3 / 5

Loop until it answers

One question can take several tools in a row: find the order, then check with the courier. Your code keeps looping, running each request and sending the result back, until Claude replies with text instead. This loop is the heart of every agent, Claude Code included.

run by Anthropicweb search>_codeexecutionrun by your codetext editormade by Anthropic, so you don’t describe them
4 / 5

Built-in tools

Some tools come from Anthropic, so you don’t write their descriptions. Web search and code execution run on Anthropic’s side: you just switch them on. Others, like the text editor below, are defined by Anthropic but run by your code.

your request: add the tool by type, no descriptiontools: [{ type: "text_editor_20250728" }]Claude asks for a commandcommand: "str_replace", path: "cart.js",old_str: "total - discount - discount"new_str: "total - discount"your code edits cart.jsdone123Anthropic defines it; your code does the editing
5 / 5

The text editor tool

Add it to tools by its type, text_editor_20250728, with no description: Claude already knows it. Claude then asks for commands like view a file, or str_replace old text with new in cart.js. Your code carries out each command on your files and returns the result.

Swipe the card, or use the arrow keys.

Go deeper

Each card stack gives you the idea. These open resources go into the detail.

Notes on the Claude Partner Network learning path on Anthropic Academy.