Skip to content

feat(forge): output schemas and structured content behind experimentalOutputSchema - #326

Merged
mattzcarey merged 1 commit into
mainfrom
feat/forge-output-schema
Oct 22, 2026
Merged

mattzcarey merged 1 commit into
mainfrom
feat/forge-output-schema

Conversation

@mattzcarey

Copy link
Copy Markdown
Member

Adds &experimentalOutputSchema=true to the forge direct tools (?codemode=false&experimentalForge=true), so we can try output schemas and structured content before turning them on for everyone (#320 step 5, #257).

For 2026-07-28 requests, tools/list sends each tool's outputSchema and a successful call returns the whole parsed body as structuredContent, never truncated, next to the text. 2025-era requests get exactly what they get today: their clients expect object output schemas, and most of ours are a $ref, allOf or scalar, which 2026-07-28 allows. The era comes from the request's _meta envelope, so it costs one property read.

The forge generator now builds each tool's outputSchema with the tools (cloudflare/forge@ce4183c): the 2xx JSON body schema, or anyOf the distinct ones, with only the models it reaches in $defs. A tool with a 2xx response that has no JSON body gets none (129 of 3,059). listTools leaves them out unless asked, so the Worker only picks one of two cached listings.

Costs: the opt-in listing is ~12 MB instead of ~6 MB (0.98 vs 0.64 MB gzipped), loaded only when asked for. The forge tools bundle grows from 1.23 to 1.43 MB gzipped, and importing the generated tools takes ~40 ms longer in Node, which every forge tools isolate pays.

These are the soak's schemas, so a strict client will reject results the response checks already flag, such as Hyperdrive's write-only origin.password (cloudflare/forge#63). That's why this is a separate flag.

…lOutputSchema

With ?codemode=false&experimentalForge=true&experimentalOutputSchema=true,
2026-07-28 requests list each forge tool's generated outputSchema and get a
successful call's whole body as structuredContent. 2025-era requests are
unchanged. The generator (cloudflare/forge@ce4183c) builds the output schemas
with the tools, so the Worker only picks a listing.
@mattzcarey
mattzcarey merged commit 550e1be into main Oct 22, 2026
5 checks passed
@mattzcarey
mattzcarey deleted the feat/forge-output-schema branch October 22, 2026 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant