Loomal

Tool Calling (Function Calling)

Tool calling is the mechanism by which an LLM selects and invokes an external function or MCP tool to complete a task.

Also known as: function calling, structured tool invocation

What is tool calling?

Tool calling — also known as function calling — is the mechanism by which a large language model selects and invokes an external function to complete a task. Instead of only generating text, the model emits a structured request naming a tool and supplying arguments that match the tool's input schema; the host application executes it and returns the result.

It is the bridge between language and action. A model cannot fetch today's weather or query a database by generating prose, but it can generate a call to a tool that does.

The tool calling loop

The host application gives the model a list of available tools, each with a name, description, and JSON Schema for its inputs. When the conversation requires one, the model outputs a tool call — say, search_listings with {"query": "weather MCP servers"} — instead of a final answer.

The host executes the call, appends the result to the conversation, and the model continues: it may answer, call another tool, or chain several calls. This loop repeating autonomously is the core of what makes a system an agent rather than a chatbot.

What MCP standardizes

Model providers each ship their own tool calling API, but the tools themselves used to be bespoke — every application hand-wired its own functions. The Model Context Protocol standardizes the supply side: an MCP server publishes its tools with names, descriptions, and schemas in a uniform format, and any MCP client can discover and call them.

The practical effect is an interoperable tool ecosystem. The same web-scraping or database server works identically whether the caller is Claude Desktop, Cursor, or a custom agent — which is what makes a cross-client index of servers, like the Loomal Index, possible at all.

Writing tools that get called well

The model chooses tools based entirely on their declared name, description, and schema, so those fields are effectively your tool's API documentation and its marketing. Ambiguous descriptions cause missed or wrong calls; overly broad schemas cause malformed arguments.

Tool authors should name tools by action, describe exactly when to use them (and when not to), and constrain inputs with enums and required fields. On the Loomal Index, where live-probed tool lists are shown on each server listing, those descriptions are also what prospective users read before installing.

When a tool call costs money

Tool calling assumes execution is free, but the underlying work — a search query, an OCR pass, a paid data lookup — often is not. The x402 protocol attaches a price to the call itself: the server answers an unpaid call with HTTP 402, the agent's wallet pays the stated amount in USDC, settlement confirms on Base in about two seconds, and the handler runs.

Crucially, the model's side of the loop is unchanged — it emits the same structured call. Payment happens in the transport layer between client and server, which is why monetizing a tool (minimum $0.01 per call on Loomal) requires no changes to how agents call it.