Skip to main content
AI / MLAgents & ProtocolsDiagramBeginner

Tool Calling

KO: 도구 호출 (Tool Calling)·EN: Tool Calling·JA: ツール呼び出し(Tool Calling)

A capability that allows an LLM to emit structured function names and JSON arguments to invoke external APIs, databases, or code, then incorporate the returned results into its response

Table of Contents

Structure Diagram

LLM Tool Calling (Function Calling) ArchitectureTap a node
PromptJSON CallExecuteUser: Can…LLM (Tool…get_order…cancel_or…send_emai…
ROOTUser: Cancel Order
1 link
Quick Answer

What is Tool Calling?

A capability that allows an LLM to emit structured function names and JSON arguments to invoke external APIs, databases, or code, then incorporate the returned results into its response. It is a core concept in Agents & Protocols within AI / ML.

Core Principles

With Tool Calling (Function Calling), the LLM does not execute code itself. Instead, given tool names, descriptions, and JSON parameter schemas, it emits a structured call payload (e.g., get_order({ id: 'A-102' })). The host application validates and executes the function, then feeds the output back to the model to continue reasoning.

Practical Takeaways

  • Write tool schemas like API docs for an LLM: Clear descriptions, explicit parameter formats (ISO-8601), enums, and usage boundaries dramatically cut mis-invocations.
  • Keep the active toolset focused: Exposing 80 raw REST endpoints bloats prompts and confuses routing. Consolidate into 5–15 cohesive, task-oriented tools or dynamically load tools on demand.
  • Enforce server-side validation and least privilege: Treat LLM-generated arguments as untrusted input—validate permissions, ranges, and idempotency keys before mutating state.

Notable Examples

  • Customer Ops Assistants: Invoke lookup_order, issue_refund, and escalate_ticket to resolve support cases end to end.
  • BI & SQL Copilots: Execute read-only SQL queries via a sandboxed tool and synthesize executive insights.
  • Parallel Tool Calling: Emits multiple independent tool calls in one turn (e.g., fetching two regions simultaneously) to halve latency.