Skip to main content
Tool calling (or function calling) is a language model’s ability to answer with a structured request to run a function: the tool’s name and its arguments in JSON, following a schema (usually JSON Schema) that the application defines. The application executes the function and returns the result so the model can continue. The model runs nothing itself. It only proposes the call; your code decides whether to execute it, runs it and sends back what happened.

Why it matters for generated documents

  • The model decides when a document is needed. It requests it with the right parameters, such as format, content and style.
  • The schema limits what can be asked. The application can validate the arguments before running anything.
  • Results cost context. What you send back to the model fills its context window, so a short summary with status and a link beats the whole file.
  • Errors should be results. An error returned as a tool result, with a clear code and the field at fault, lets the model fix its call and try again.

Tool calling in Doconda

doconda.tools() in the Python and TypeScript SDKs returns the Doconda tools ready for function calling with Claude, OpenAI, Gemini, Mistral, Bedrock, Vertex AI or the AI SDK. Their input schemas are JSON Schema, so they work as they are, and each tool’s run executes the call. Each tool returns a short summary with status and links. A failure comes back as a result, not an exception: { "error": "<code>", "message": "…" }, with a fields list naming the arguments at fault when there are any. See MCP server for the same tools over MCP.

What is MCP

A standard way to deliver tools to any client.

What is an AI agent

The loop that calls tools until a task is done.

Claude

Use the Doconda tools with Claude.

OpenAI

Use the Doconda tools with OpenAI.