What is tool calling (function calling)?
Short answer
Tool calling, also called function calling, lets a large language model ask your application to run a function. You describe the available tools with names and JSON Schema parameters; the model replies with the tool to call and its arguments; your code runs it and returns the result, which the model then uses in its answer. It is how LLMs take actions.
How tool calling works
- You send the user’s message plus tool definitions, for example
get_order_status(order_id: string). - The model decides a tool is needed and returns a structured request: the tool name and arguments as JSON.
- Your code validates the arguments, runs the function (a database query, an API call) and sends the result back.
- The model writes the final answer using that result, or calls another tool.
The model never runs code itself; your application stays in control of what actually happens.
Tool calling and MCP
Tool calling is the mechanism inside one application. MCP standardises how tools are published, so many AI clients can discover and call the same tools.
Good practice
- Write clear tool descriptions: the model chooses tools from them.
- Validate arguments as untrusted input; in Laravel, the same validation rules as for a form request work well (see the Laravel Validation Rule Builder).
- Keep tools small and specific; prefer read-only tools; confirm before destructive actions.

