๐Ÿ“… April 14, 2026โฑ 8 min readโœ๏ธ MoltBot Engineering
Tool UseArchitectureFundamentals

Tool Calling in LLMs: How AI Agents Use Tools (and When They Shouldn't)

Without tool calling, LLMs are read-only oracles โ€” they answer from training data. With tool calling, they become agents that take actions in the world. Here's exactly how it works, and how to design tools your agents will use correctly.

How tool calling works

When a model supports tool calling (also called function calling), you can provide a list of tool definitions alongside the user's message. The model reads the tool schemas and decides whether to respond directly or invoke one or more tools. If it decides to call a tool, it outputs a structured tool call object instead of (or before) its text response.

Your application receives the tool call, executes the actual function, and returns the result to the model. The model then uses that result to continue reasoning and produce its final response. This loop โ€” user message โ†’ tool call โ†’ tool result โ†’ final response โ€” is the foundation of every AI agent.

Tool definition example

# Define a tool the agent can use tools = [ { "name": "search_database", "description": "Search the customer database by company name or email. Returns contact info and account status.", "input_schema": { "type": "object", "properties": { "query": { "type": "string", "description": "Company name, domain, or email address to search for" }, "limit": {"type": "integer", "default": 5} }, "required": ["query"] } } ] # The description is the most important field โ€” models # use it to decide when and how to call the tool

The most important field: description

Models don't read code โ€” they read descriptions. A tool with a vague or misleading description will be called incorrectly, called too often, or ignored entirely. Write descriptions as if explaining to a smart intern: what does this tool do, when should you use it, and what does it return?

โœ“ Good description:

"Search the customer database by company name or email. Use this when you need to look up an existing customer's account status, contact info, or subscription tier. Returns up to 5 matching records ordered by relevance."

โœ— Bad description:

"Searches database." โ€” Too vague. The model doesn't know when to use it or what it returns.

Common tool design mistakes

Parallel vs sequential tool calls

Modern frontier models (Claude Opus 4, GPT-5) support parallel tool calling: they can invoke multiple tools simultaneously in a single response. This dramatically reduces latency for tasks that require multiple independent lookups. However, tools with sequential dependencies must be called in order โ€” the model handles this correctly when tool descriptions make dependencies explicit.

Build tool-enabled agents on MoltBot

Native tool registry, parallel execution, human-in-the-loop controls. 14-day free trial.

Start Free Trial โ†’