LLMscore
Tool / function calling
The model emits a structured request to call your function; your code runs it and returns the result.
What it is and why it exists
You describe tools (name, description, JSON-schema parameters). The model may answer with a tool call instead of text; your code executes it and sends the result back as a new message, and the model continues. The model never executes anything itself — your code is the security boundary.
Quick prototype
One or two tools, a while-loop that runs whatever the model asks for.
In production, at scale
A small set of well-described tools, validated arguments, permission checks per call, timeouts and idempotency for side effects, errors returned as observations the model can recover from, and parallel tool calls where independent.
Vendors and tools
| OpenAI function calling / Responses API | Parallel tool calls, strict schemas |
|---|---|
| Anthropic tool use | tool_use / tool_result blocks, parallel calls, tool choice |
| Gemini function calling | Function declarations, automatic or manual mode |
| MCP | Standard way to expose tools from separate servers |
On AWS: Bedrock Converse API toolConfig; Bedrock Agents action groups backed by Lambda; AgentCore Gateway to expose APIs as tools.
How it fails
- Hallucinated arguments (an order ID that doesn’t exist)
- Executing tool calls without checking the user is allowed to do that
- Returning a stack trace instead of a useful error the model can act on
What the interviewer asks next
Who is responsible when a tool call deletes the wrong record?
Your code. The model only proposes; authorisation, validation and confirmation of destructive actions happen in the tool layer.
How do you make tool errors recoverable?
Return a short, specific error as the tool result (“order 123 not found; recent orders: 481, 492”) so the next model turn can correct course.