ModelRefs / Function-Calling Prompt — Prompt Pattern
Function-Calling Prompt — Prompt Pattern
Expose tools as typed functions and let the model decide when to call them. Foundation for tool-using agents.
Overview
Declare each tool with a JSON schema; the provider returns a structured tool call the runtime executes. Foundation for tool-using agents.
When to use it: You need the model to call APIs or tools deterministically.
Pattern details
| Pattern class | structured-output |
|---|---|
| Difficulty | intermediate |
| Also known as | tool calling, function call |
| Last reviewed | 2026-06-07 |
Known failure modes
- Over-calling — Model invents tool calls when prose would do. Mitigation: Add 'only call when necessary' to the system prompt.
- Schema violation — Args fail validation. Mitigation: Validate args; return error to model and let it retry.
When not to use it
- Stuffing all tools into one prompt for every request (use a tool-router).
Continue your research
Use these connected ModelRefs sections to compare alternatives, inspect implementation paths, and review the evidence and governance boundaries relevant to Function-Calling Prompt — Prompt Pattern.
Frequently asked questions
When should I use the Function-Calling Prompt prompt pattern?
You need the model to call APIs or tools deterministically.
What are common failure modes of Function-Calling Prompt?
Over-calling • Schema violation
Does Function-Calling Prompt work across models?
Yes when the anatomy is preserved — see model compatibility matrix on the pattern page.