Tool calling, also called function calling, is the way a language model asks the surrounding application to run a named function with structured arguments and then uses the result.
How tool calling works
The model never runs code itself. The loop is:
- The application tells the model which tools exist, each with a name, description, and JSON Schema for its arguments.
- The user asks for something.
- The model replies with a tool call: a tool name and arguments, instead of plain text.
- The application runs the tool and sends the result back.
- The model continues, possibly calling more tools, until it can answer.
The Model Context Protocol standardizes step 1 and step 4 across apps, so a tool defined once in an MCP server works in many clients.
An example
A user says, "Schedule the Bluesky post for tomorrow at 9." The model calls schedule_post with the draft ID and an ISO timestamp. The server checks permissions, stores the schedule, and returns a confirmation that the model reads back.
Why it matters for AI-agent publishing
Tool calling is what turns a chatbot into an AI agent. It also defines the limits: the model can only do what its tools allow, and the application decides whether each call is permitted.
So the safety of agent publishing rests on tool design, not on prompts. SocialHandoff's tools are split by permission. draft_post, schedule_post, and get_insights depend on the agent key's scopes, and approve_post works only with owner keys, so an agent calling it on its own draft is refused. See agent keys and permissions.