App Server: support output schemas for dynamic tools
Nobody has claimed this yet.
- 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:
- Start a thread with a dynamic tool that returns JSON.
- Let Code Mode call that tool.
- Resolve the call with text such as
{"items":[{"id":"1"}]}. - 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
outputSchemais 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
outputSchemais 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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