Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
Protoverta 0.4.0
Logo
Protoverta 0.4.0

Using Protoverta

  • Getting started
  • Using the library
  • Running the gateway
  • HTTP API
  • Retries
  • Configuration files

Reference

  • Command reference
  • Python API
    • Conversion
    • Streaming
    • Gateway
    • Retry policy
    • Capabilities
    • Catalogs and token counts
    • Diagnostics
  • Compatibility guides
    • Provider integration and route diagnostics
    • Recorded provider/model capabilities
    • Bounded catalog discovery
    • Provider certification is separate from local conformance
    • Local Codex client acceptance checks
    • Optional context preflight
    • Token counting, caching and extended content contracts
    • Custom tools and client tool search
    • Gateway failures and resource boundaries
    • Penalties and disabled logprobs
    • Evidence-scoped generation profiles
    • User image input
    • Payload-free local diagnostics
    • OpenRouter conformance notes
    • Tool selection and output formats
    • Provider compatibility and known limits
    • Reasoning: transport is not model state
    • Request boundaries and error contracts
    • Generated Responses request metadata
    • Session replay compatibility
    • Route and policy evidence
    • Explicit session routing and local token quotas
    • Provider profiles, shared budgets and retry boundaries
    • Explicit sampling defaults
    • Reported serving tier
    • Text token probabilities: Chat and Responses
    • Function names and stream identity
    • UnoRouter observations

Project

  • Changelog
  • Security policy
  • Contributing to Protoverta
  • Development
    • Validation and release
    • ADR-001: Explicit policy for cross-protocol Messages streaming
    • Independent stream conformance
    • Tool, reasoning và MCP trong preview
    • Chạy thử bản mới mà không thay thế bản đang dùng
    • Official OpenResponses schema audit
    • Kiểm chứng vận hành trước phát hành
    • Incremental strict typing
    • Versioned compatibility and validation records
Back to top
View this page
Edit this page

Custom tools and client tool search¶

Native custom tools: completed JSON¶

Chat Completions and Responses both define custom tools. Protoverta maps their definitions, forced choices, calls and text results directly in either direction:

  • Chat custom.format.grammar.{syntax,definition} maps to Responses format.{syntax,definition} without rewriting the grammar.

  • Raw custom.input maps to custom_tool_call.input, not JSON arguments.

  • Call IDs and mixed function/custom call order survive history replay. Chat’s untyped role-tool results inherit the type only from a preceding matching ID; explicitly mismatched Responses output types fail.

  • Optional descriptions and absent/text/regex/lark formats remain distinct. Aliasing changes only protocol-defined names, never raw input or grammar.

  • Messages has no equivalent custom/grammar contract and is rejected. Rich custom results containing images also cannot be relocated into Chat user messages. Namespaced custom tools remain outside namespace flattening.

Provider support must be recorded separately as custom_tools. An OpenAI schema is not evidence that another Chat-compatible provider supports it. No live provider certification was performed for this feature.

Streaming boundary¶

The Responses custom-input delta/done/item lifecycle is decoded and validated against accumulated input, item identity and terminal snapshots. Native gateway forwarding remains byte-preserving and resource-bounded.

The published Chat streaming schema does not establish a custom delta wire. Cross-protocol requests combining custom tools/history with stream: true are therefore rejected before upstream I/O. Unexpected custom output in a translated stream fails without a fabricated terminal success. Do not infer compatibility from synthetic round-trip fixtures. Grammar is never silently converted into a function’s JSON schema.

Explicit client search policy¶

Set GatewayConfig(..., client_tool_search="function") or --client-tool-search function to adapt Responses client-executed search to an ordinary function on a Chat/Messages upstream for JSON or SSE. The default is reject; native Responses forwarding is unchanged. CodexApter’s integration editor exposes the policy for Chat/Messages gateways. ClaudApter has no Responses client and does not expose this policy.

This compatibility policy is not exact native deferred-loading semantics: tools returned in explicit search history are exposed eagerly for the current generation. It does not reproduce native cache or historical context placement. The application remains responsible for searching, authorizing schemas and executing any tools. Protoverta performs none of those actions.

The supported subset requires an explicit execution: "client", an object argument schema, and completed search call/output pairs with unique matching IDs. The reserved function name is pv_client_tool_search; collisions fail. Search arguments and results retain JSON objects, IDs and tool definitions. Unloaded deferred definitions are not sent as callable tools. Loaded function, custom or namespace definitions pass through the normal strict converter and optional namespace policy; conflicting definitions are rejected. Deferred namespace children stay unavailable until a matching completed search output explicitly loads them. Immediate children and loaded subsets are merged without dropping schema/description conflicts; an entirely unloaded namespace is omitted from the callable upstream tool list.

Returned calls are restored to tool_search_call with object arguments and client execution. Hosted/server search, missing execution, incomplete/unpaired history and additional_tools injection are not emulated. No unspecified execution mode is guessed from a call ID. No fallback, retry or external lookup is introduced.

For translated SSE, text remains incremental. Only each search call’s arguments are buffered under the ordinary tool-argument limit until a complete JSON object is available. The encoder then emits the documented output_item.added and output_item.done lifecycle with a completed client tool_search_call, preserving call ID, output index and arguments. No function-argument delta events or invented search-argument delta events are emitted for that item. The terminal snapshot matches the completed item and is held until verified upstream EOF. Malformed/truncated/oversized calls cannot produce successful completion. This is an explicit function-emulation policy, not native provider search or a guarantee of native deferred-loading/cache placement. Real-client search fixtures are a separate gate from codec tests. The Codex client acceptance checks record a passing native control and both translated Chat/Messages search→MCP-tool loops on CLI 0.164.0 and CLI 0.166.0, including source and isolated installed launchers. These use synthetic model metadata/upstreams and do not certify provider support.

Claude tool_reference and DeferredToolPlaceholder boundary¶

Claude Code (2.1.308) supports deferred tool search when its own tool-search feature is enabled, emitting tool_reference content blocks inside tool_result items on /v1/messages. Because neither OpenAI Chat Completions nor OpenAI Responses defines a cross-protocol wire equivalent for tool_reference blocks:

  • claudapter enforces ENABLE_TOOL_SEARCH=false in the child Claude Code process environment so Claude Code sends standard Agent, DeferredToolPlaceholder, and concrete tool schemas instead of dynamic tool_reference blocks.

  • Any raw tool_reference block arriving on /v1/messages is rejected immediately with ConversionError("unsupported Messages block: tool_reference") rather than silently dropped or coerced into plain text.

Client versus hosted tool classification¶

request_features() and GatewayCapabilities distinguish client-executed tools from provider-hosted tools:

  • Client-executed tools (type: "function", type: "custom", type: "namespace", and {"type": "tool_search", "execution": "client"}) are classified under tools / custom_tools, never hosted_tools.

  • Server/hosted tools ({"type": "tool_search", "execution": "server"}, web_search_preview, and other provider-executed tool types) are classified as hosted_tools and fail closed on cross-protocol translation.

Sources¶

  • Chat definitions and completed calls

  • Chat streaming schema

  • Responses custom-input events

  • Client-executed tool search

These references describe protocol shapes, not third-party provider guarantees.

Next
Gateway failures and resource boundaries
Previous
Token counting, caching and extended content contracts
Copyright © HaianCao
Made with Sphinx and @pradyunsg's Furo
On this page
  • Custom tools and client tool search
    • Native custom tools: completed JSON
    • Streaming boundary
    • Explicit client search policy
    • Claude tool_reference and DeferredToolPlaceholder boundary
    • Client versus hosted tool classification
    • Sources