AI & LLM
LLM Tool / Function Call JSON Example
A JSON example of LLM function calling — the tool definition you send and the tool_call the model returns with arguments. Copy-ready for OpenAI and Anthropic tool use.
Field Reference
idrequiredstringUnique id for this tool call; echo it back in the tool result messagetyperequiredstringCall type — 'function' for function callingfunction.namerequiredstringName of the tool the model chose to call; must match a defined toolfunction.argumentsrequiredstring (JSON)Arguments as a JSON-encoded string — parse it before use; the model may hallucinate fieldsVariants
Tool definition (sent to the model)The JSON Schema you register so the model knows the tool's parameters.
Tool result (sent back to the model)After running the function, return its output referencing the call id.
Common Use Cases
- →Letting an LLM trigger real functions like database lookups or API calls
- →Building agents that decide which tool to call and with what arguments
- →Forcing structured output by defining a single tool the model must call
function callingtool usellmopenai toolsagentsjson schema
Validate or format this JSON
One click loads this exact example into the tool — no copy-paste needed. Format it, validate it, explore the tree, or generate TypeScript types instantly.
Frequently Asked Questions
Related JSON Examples
AI & LLMOpenAI Chat Completion ResponseOpenAI Chat Completions API response with choices, message, finish_reason, and usage.AI & LLMAnthropic Claude Messages ResponseClaude Messages API response with content blocks, stop_reason, and token usage.AI & LLMAI Agent Run TraceAgent run with goal, reasoning steps, tool calls, observations, and final output.