Protocol

Tool Calling

Why Tool Calling Is Needed

Regular LLMs can only "talk" — give you a text response, but this response can't directly help you:

  • Check real weather
  • Write to a database
  • Send an email

Tool Calling transforms models from "can talk" to "can do" — enabling them to issue structured call instructions that let external systems truly execute actions.


What Is Tool Calling

One-line definition: Tool Calling is the ability that enables models to convert "what should I do" into "which tool should I call, what parameters should I pass."

Analogy: Tool Calling is like giving the model a "capability checklist" — each tool is a card, clearly stating "when to use it" and "what parameters to pass." Based on task needs, the model selects and fills out the appropriate cards.

Typical examples:

  • Call get_weather(city) to query weather
  • Call search_docs(query) to search the knowledge base
  • Call create_todo(title) to create a task

After the model initiates a call, the actual execution is done by an external system — this process needs Function Schema to define parameter contracts, telling the model how to use each tool.

Calling a tool once is just the beginning — real-world tasks often require consecutive calls. This leads to ReAct: the closed loop of think → act → observe → think again.


How to Do It: Keys to Tool Calling

1. Tool descriptions must be clear

  • query, text are too abstract
  • city, email_body, invoice_number are more specific

2. Parameter constraints must be explicit

  • Field types, required fields, enumerated values, defaults

3. execution results must be fed back

  • If tool execution doesn't return results to the model, the model can't enter the next reasoning step

Common Pitfalls

  • Not all models support Tool Calling
  • Models don't validate business correctness: may拼出 format-correct but business-incorrect parameters, server still needs validation
  • Tools can fail: timeouts, insufficient permissions, empty results are common
  • Too many tools increases selection difficulty

Remember this: Tool Calling transforms models from "can talk" to "can do" — it issues call instructions, and external systems do the actual execution.

Related terms: Function Schema · ReAct