𝗖𝗹𝗮𝘂𝗱𝗲 𝗔𝗣𝗜 𝗙𝘂𝗻𝗰𝘁𝗶𝗼𝗻 𝗖𝗮𝗹𝗹𝗶𝗻𝗴 𝗚𝘂𝗶𝗱𝗲
Claude does not run code. It asks you to run code.
This is tool use. Claude asks for data. Your code gets it. You send it back.
A tool needs three things:
- A name.
- A description.
- An input schema in JSON.
The tool use loop:
- Send a message with tools.
- Check if the stop reason is tool use.
- Run the tool in your system.
- Send the result back to Claude.
More tips:
- Parallel calls: Claude asks for multiple tools in one turn.
- Tool choice: Force Claude to use one specific tool. This gives you structured JSON.
- Error handling: Set is error to true if a tool fails. Claude will try again.
Rules for better tools:
- Name tools with verbs.
- Use enums for fixed options.
- Keep descriptions short.
- Limit total loop steps.
Source: https://dev.to/kalyna_pro/claude-api-function-calling-complete-guide-to-tool-use-2026-1kh3 Optional learning community: https://t.me/GyaanSetuAi