openai / openai/codex

App Server: support output schemas for dynamic tools

Open
#41,346 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

app-server enhancement
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

Codex variant

App Server v2 with Code Mode dynamic tools.

Feature request

Allow a dynamic function tool to declare an optional JSON Schema for its successful result, alongside its existing inputSchema.

Today DynamicToolFunctionSpec describes only the input. When a client exposes a tool whose result is JSON, Code Mode receives the successful result as an opaque string. The client cannot communicate the result contract, so generated JavaScript cannot expose a typed structured value without encoding schema instructions into the tool description.

A representative flow is:

  1. Start a thread with a dynamic tool that returns JSON.
  2. Let Code Mode call that tool.
  3. Resolve the call with text such as {"items":[{"id":"1"}]}.
  4. The JavaScript binding receives a string rather than a structured value described by the tool contract.
Proposed contract

Add optional outputSchema support to dynamic function specifications and propagate it to the core tool definition's output_schema.

For Code Mode calls:

  • when outputSchema is present, parse a successful text result as JSON and expose the structured value;
  • when the result is not valid JSON, return a model-visible tool error;
  • when outputSchema is omitted, preserve the current string behavior;
  • preserve existing direct-call content-item behavior.

The field should be optional so existing App Server clients and stored requests remain backward compatible.

Why this belongs in the protocol

The client owns the dynamic tool's input and output contracts. Putting the result schema in description duplicates protocol data, consumes model context, and still leaves Code Mode without a machine-readable return type.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing DynamicToolFunctionSpec and the core tool definition's output_schema, then follow the Code Mode handling for successful dynamic-tool results. Verify the optional field remains backward compatible, structured JSON results are exposed when declared, invalid JSON becomes a model-visible tool error, and omitted schemas preserve string behavior without changing direct-call content items.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.