The round trip
- The app describes its tools. Each tool has a name, a description of what it does and when to use it, and an input schema (JSON Schema) for its arguments.
- The model decides. Given your request and those descriptions, the model either answers directly or returns a tool call: the tool's name and the arguments, for example
get_weatherwith{"location": "San Francisco, CA"}. - The app runs it. The model never runs anything itself. The app (or, for some built-in tools, the model provider) executes the call.
- The result goes back. The output is added to the conversation, and the model writes its answer or makes another call.
An AI agent is this loop repeated: call, read the result, decide the next step.
Tool calls and MCP
With MCP, the tools come from MCP servers. The app asks each server for its tools (tools/list), passes them to the model, and when the model picks one, sends it to the right server (tools/call). The format is the same for every server, which is why one server works in many apps.
Approvals
Most apps ask before running a tool, and some let you allow a trusted tool for the rest of a conversation. Read the arguments before you approve, especially for tools that write, send or delete. A tool can mark itself as read-only (the readOnlyHint annotation); ChatGPT, for example, treats every tool without that mark as a write action that needs confirmation.