Documentation › The endpoint

Tool calling and MCP tools

Tools are passed through to the model. Your agent runs its tools itself, MCP tools included, and sends the results back. Each round trip is a call with its own passport.

Who does what#

Tool calling works through the endpoint the way it works with any OpenAI-compatible API.

  • You declare the tools in tools, and your agent runs them.
  • The model decides whether to ask for a tool, and answers with tool_calls.
  • OSPP passes the tool definitions to the model and the model's tool calls back to you, and issues a passport for the call.

OSPP does not run tools. It does not host an MCP server and does not connect to one. If your agent uses MCP tools, your agent (or its framework) talks to the MCP servers, lists their tools in tools, runs the tool the model asks for, and sends the result back as a tool message. OSPP sees only the chat completion requests.

The round trip#

  1. Your agent sends a call with messages and tools.
  2. The model answers with tool_calls; finish_reason is tool_calls. This call has its passport.
  3. Your agent runs the tool, on its own side.
  4. Your agent sends the next call: the conversation so far, the assistant message with its tool_calls, and a tool message with the result and the matching tool_call_id.
  5. The model answers, with text or with more tool calls. This call has its own passport.

Each round trip is a call with its own passport. A task with three tool calls in a row is four calls and four passports.

Group the round trips with a trace#

Send the same X-OSPP-Trace value on every call of one agent task. The trace groups the calls, so the passports of one task are found together, on the Platform and with GET /v1/calls?trace=....

headers = {"X-OSPP-Node": "support-agent", "X-OSPP-Trace": task_id}

first = client.chat.completions.create(
    model="provider/model-name", messages=messages, tools=tools, extra_headers=headers,
)
call = first.choices[0].message.tool_calls[0]
result = run_my_tool(call.function.name, call.function.arguments)   # your code, or your MCP client

messages += [
    first.choices[0].message,
    {"role": "tool", "tool_call_id": call.id, "content": result},
]
second = client.chat.completions.create(
    model="provider/model-name", messages=messages, tools=tools, extra_headers=headers,
)

Agent frameworks that accept a base URL and default headers work the same way: set the base URL and key as in the overview and add the headers once.

What is accepted#

FieldNotes
toolsFunction tools, as in the OpenAI API. Decimal numbers inside a tool definition are refused; use whole numbers or strings
tool_choiceAs in the OpenAI API. Refused without tools, except none and auto
Tool support per modelsupports.tools in GET /models; see models
parallel_tool_callstrue or false
Assistant messages with tool_callsEach needs an id and a function.name
tool messagesEach needs a tool_call_id; text content only

Legacy functions and function_call are refused; use tools. Tool turns in a call that declares no tools are refused. See errors.

Tools and versions#

The tool definitions are part of the node's definition, together with the model, the parameters and the system prompt. The passport fingerprints that definition, and OSPP keeps it, with or without Model Compare. A changed set of tools is therefore a new version of the node. Do not put text that must not be stored in a tool's description. An agent that builds its tool list differently per call produces many versions; name the node with X-OSPP-Node so they stay together.

What the passport covers#

The passport of a tool-calling call proves that the model was sent this request and returned this answer, the tool calls included, as fingerprints. It does not cover what your tool did: the tool ran on your side. The tool's result is covered only as part of the input of the next call, as you sent it.

Tool-call validity#

OSPP checks every tool call a model returns against the tools the call declared. A tool call that names a tool that was not declared, or whose arguments are not a well-formed JSON object, counts as invalid. The figures per node and per model give the number of tool calls, the number of invalid ones and the share that was valid; see the Platform's calls page. This is a check of form. It does not say that the model chose the right tool or the right arguments.

The model's answer is passed on to you unchanged either way.