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.
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.
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.
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.
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.
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.