orq.aiAdvent of Routing

Door 24 · still sealed

Hands off the wax, elf. This door opens on Dec 24.

-days--hours--min--sec

Rudolph is still polishing this one. Back to the calendar

Door 24 · Dec 24 Server tools & MCP

Elves with power tools

List web search and a Python sandbox as tools. The router runs every call itself, so your app gets one finished answer.

Eight minutes to take-off. The reindeer are harnessed, the last door of the calendar is open, and Santa is already pulling on his boots with one more question.

  1. Santa

    How much snow is on the route, and how late does it make me? I need it before I'm in the sleigh!

  2. Sprocket

    On it! I'll host a search scraper, spin up a Python box, and write a loop to glue them together. Three hours, tops.

  3. Tinsel

    Put the loop down again. List orq:web_search and orq:code_interpreter in tools, and the router runs both plus the loop between them.

  4. Sprocket

    So the workshop owns the power tools and I just borrow them? Cancelling my three hours! Best present yet!

  5. Rudolph

    Snow report in. Delay worked out. All twenty-four doors cleared. Runners up. See you next December.

clientYour apptools: [orq:*]orq.aiAI Routerruns the model's tool callsserver toolorq:web_searchserver toolorq:code_interpreterresultOne answerwritten by the model12searchrun code
  1. clientYour apptools: [orq:*]
  2. orq.aiAI Routerruns the model's tool calls
  3. server toolorq:web_search
    server toolorq:code_interpreter
  4. resultOne answerwritten by the model
The model asks for a search, then a Python run, and the router does both on its own bench, so your app only sees the finished answer.

How it works

Tinsel’s fix is two entries in a list you already send. A server tool is a tool that Orq runs for you, inside the request:

  1. Declare. Add one or more orq:* tools to the request’s tools array.
  2. Decide. The model chooses whether to call a tool and supplies its arguments.
  3. Run. The router executes the tool and returns the result to the model.
  4. Repeat or finish. The model can call another tool or write its final answer.

limits.max_iterations bounds that loop. It defaults to 10 model calls and accepts 1 to 100. Server tools work on POST /v3/router/responses and POST /v3/router/chat/completions. The selected model must support tool calling.

Try it with curl

curl -X POST https://my.orq.ai/v3/router/responses \
  -H "Authorization: Bearer $ORQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-5-5",
    "input": "How far is Sydney from the Pole? Hours at 1000 km/h?",
    "tools": [
      {"type": "orq:web_search", "max_results": 5, "max_uses": 3},
      {"type": "orq:code_interpreter"}
    ]
  }'

Or from the OpenAI SDK

from openai import OpenAI
import os

client = OpenAI(
    api_key=os.environ["ORQ_API_KEY"],
    base_url="https://my.orq.ai/v3/router",
)

response = client.responses.create(
    model="anthropic/claude-sonnet-5-5",
    input="How many days until next Christmas Eve in Amsterdam?",
    tools=[
        {"type": "orq:datetime", "timezone": "Europe/Amsterdam"},
        {"type": "orq:code_interpreter"},
    ],
)
print(response.output_text)
print(response.usage)

The model sees each tool with orq: replaced by orq_, so orq:web_search shows up as orq_web_search.

Who runs which tool

Tool type Who runs it Who gets the result
Server tool orq:* The router The model
Function tool function Your app Your app, which sends it back

Server tools fit generic jobs: search, fetch a page, run sandboxed Python, read the date. When a tool must touch your own systems, use a function tool. To share your own tools with MCP clients such as Claude Code or Cursor, serve them over public HTTPS, add them as an MCP Server, sync it so Orq discovers its tools, link it to a gateway, then connect a client:

npx add-mcp https://my.orq.ai/v3/mcp/workspace-tools \
  --name workspace-tools

A gateway runs in Code mode by default: the client gets three tools (search, describe, execute) instead of the whole catalog, and execute takes up to 20 calls at once. Pick Direct mode for a small catalog where the client expects every tool in its list. MCP Servers and MCP Gateways are free on every plan.

Limits and costs

  • Web search. max_results defaults to 5 (1 to 25). max_uses defaults to 20. Each search that starts costs $0.005; failed searches use a slot but are not charged.
  • Code interpreter. Each execution times out after 60 seconds. Stage up to 10 workspace files, each up to 10 MB. network.mode defaults to disabled, but egress enforcement is still rolling out, so for now the sandbox keeps the deployment’s default internet access.

Chat Completions

Chat Completions returns the usage counters but not the tool results themselves. Read results from the Responses API output items, or send store: true and retrieve the response. It also answers 400 if you combine orq:* tools with n above 1 or with provider-hosted tools such as web_search.

Nice list

  • Cap paid tools with max_uses. Each orq:web_search that starts costs $0.005, and the default allows 20 search attempts per request.
  • Use /v3/router/responses for reasoning models. On Chat Completions, a reasoning model rejects tools unless reasoning_effort is none.
  • Mix server tools and function tools in one request. The router runs the orq:* calls and hands function calls back to your app.

Naughty list

  • Setting max_tool_calls to stop a long loop. It is echoed back but does not limit the server-side loop: limits.max_iterations does.
  • Naming a function tool orq_web_search in a request that also lists orq:web_search. The model sees the server tool under that name, and tool names must be unique within a request.
  • Reading tool results from a Chat Completions response. It returns the usage counters but not the results: read them from the Responses API output items, or send store: true.
  • Pointing an MCP Server at a STDIO process. Upstream servers must use HTTP or SSE: STDIO is rejected.

Elf's challenge

Send this page's curl request and open usage.server_tool_use. Which two counters show up, and which of the two tools adds a server-tool charge to the response cost?

Stuck? Ask Tinsel for a hint

Look for web_search_requests and code_interpreter_sessions. Each web search that starts costs $0.005. Code interpreter has no separate server-tool charge in this release.

Christmas crackerWhich server tool does Santa call before anything else on Christmas Eve?Pull it for the punchline

orq:datetime. One shift a year: he double-checks it's tonight.