Tools policy
Function tools and the tool union (custom, computer, server) on passthrough vs translation — when the gateway errors vs rebuilds.
How tools are handled so agents never believe a tool was registered when it was dropped.
Summary
| Path | Behavior |
|---|---|
| Passthrough (OpenAI → openai / openai_compat) | Forward as-is (model rewrite only) |
| Translate → OpenAI | Rebuild full tool union: function, custom, computer, server |
| Translate → Anthropic / Google | function only — other kinds → HTTP 400 with a clear error |
Silent skip is intentionally rejected.
Tool kinds
| Kind | Wire example | OpenAI egress | Anthropic / Google |
|---|---|---|---|
function |
type: "function" + parameters schema |
yes | yes |
custom |
grammar / lark / regex tools | yes | error |
computer |
computer-use styles | yes | error |
server |
file_search, web_search, … |
yes | error |
Empty type is treated as function. Name is required for function and custom tools.
Function tools (all families)
{
"type": "function",
"function": {
"name": "lookup",
"description": "Look up a record",
"parameters": {
"type": "object",
"properties": { "id": { "type": "string" } },
"required": ["id"]
}
}
}Works on passthrough and on translate to Anthropic or Google.
Custom / grammar tools (OpenAI family)
{
"type": "custom",
"custom": {
"name": "date_tool",
"format": {
"type": "regex",
"definition": "[0-9]{4}-[0-9]{2}-[0-9]{2}"
}
}
}- Passthrough to OpenAI / openai_compat: forwarded.
- Translate to Claude/Gemini: fails closed — use function tools or stay on OpenAI family.
How it works internally
- OpenAI ingress parses tools into the canonical IR.
- Router selects upstream kind.
- Egress rebuilds vendor JSON, or returns
invalid_request_errorwith the unsupported kind name.
Multi-turn tool loops still rely on thinking/signature fidelity (reasoning_content, Anthropic thinking blocks, Google thoughtSignature) — see Chat field parity.
Practical guidance
- Vendor-specific tools → passthrough to that vendor.
- OpenAI client → Claude/Gemini → function tools only.
- Prefer fail-closed errors over silent drops when debugging agents.