πŸ—“οΈ 21032026 2100

LLM TOOL USE

The mechanism by which LLMs generate structured function calls that a runtime executes, bridging language understanding with real-world actions

What Is Tool Use?​

Tool use (also called "function calling") allows an LLM to request the execution of external functions instead of generating a text-only response. The LLM doesn't execute anything itself β€” it produces a structured call that the runtime environment handles.

Request / Response Cycle​

  User              Runtime             LLM
β”‚ β”‚ β”‚
β”‚ "What's the β”‚ β”‚
β”‚ weather in β”‚ β”‚
β”‚ Tokyo?" β”‚ β”‚
β”‚ ────────────────>β”‚ β”‚
β”‚ β”‚ messages + β”‚
β”‚ β”‚ tool_definitionsβ”‚
β”‚ β”‚ ────────────────>β”‚
β”‚ β”‚ β”‚
β”‚ β”‚ tool_use: β”‚
β”‚ β”‚ get_weather β”‚
β”‚ β”‚ {"city":"Tokyo"}β”‚
β”‚ β”‚ <────────────────│
β”‚ β”‚ β”‚
β”‚ β”‚ [executes fn] β”‚
β”‚ β”‚ β”‚
β”‚ β”‚ tool_result: β”‚
β”‚ β”‚ "22Β°C, sunny" β”‚
β”‚ β”‚ ────────────────>β”‚
β”‚ β”‚ β”‚
β”‚ β”‚ "It's 22Β°C and β”‚
β”‚ β”‚ sunny in Tokyo"β”‚
β”‚ β”‚ <────────────────│
β”‚ "It's 22Β°C and β”‚ β”‚
β”‚ sunny in Tokyo"β”‚ β”‚
β”‚ <────────────────│ β”‚
  1. User sends a request to the runtime
  2. Runtime forwards the message along with available tool definitions to the LLM
  3. LLM decides to use a tool and returns a structured tool_use block
  4. Runtime executes the function and sends the result back as a tool_result
  5. LLM incorporates the result into its final response

Tool Definitions​

Tools are defined via JSON Schema, telling the LLM what's available and how to call it:

FieldPurpose
nameFunction identifier (e.g., get_weather)
descriptionWhen and why to use this tool β€” critical for the LLM's decision-making
input_schemaJSON Schema specifying parameter names, types, and constraints

Good descriptions matter: the LLM uses the description to decide when to call a tool. Vague descriptions lead to incorrect or missed tool calls.

How Tool Use Enables Agentic Patterns​

Tool use is the foundational capability that makes agentic patterns possible:

PatternHow Tools Are Used
Single agentAgent calls tools sequentially to accomplish a task
coordinator_router_patternCoordinator uses tools to delegate to specialist sub-agents
agent_as_tool_patternSub-agents are themselves exposed as callable tools
loop_review_critique_patternReviewer agent uses tools to validate outputs against criteria

Tool Use vs MCP​

AspectTool UseMCP
What it isLLM-side capability to call functionsInfrastructure protocol for exposing tools
ScopeSingle LLM ↔ runtime interactionEcosystem-wide tool discovery and access
Defined byEach LLM provider (Anthropic, OpenAI, Google)Open standard (MCP spec)
RelationshipThe mechanismThe plumbing that delivers tools to the mechanism

Think of tool use as the LLM's ability to "use its hands", and model_context_protocol as the standard that puts tools within reach.


References​