Skip to content

Preserve structured MCP tool output in model requests - #1999

Merged
BlueHotDog merged 2 commits into
integration/mcp-2026-07-28from
structured-result-consumption
Oct 26, 2026
Merged

BlueHotDog merged 2 commits into
integration/mcp-2026-07-28from
structured-result-consumption

Conversation

@BlueHotDog

@BlueHotDog BlueHotDog commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Preserve unstructured blocks and arbitrary structured JSON, including explicit null, through a validated ToolOutput constructor using the existing MCP schema validator.
  • Project original blocks in order and append serialized structured JSON only when no existing text block parses to the same JSON value. Never infer prose equivalence or delete existing blocks.
  • Extend opaque CallToolResult constructors without breaking dictionary helpers; include a changeset.

Focused coverage

  • Replace the existing full-agent routing test with one structured-only model-provider-boundary regression, completing discovery with its advertised output schema. Keep the JSON-type matrix in focused constructor/projection tests instead of six runtime cases.
  • Align the existing mixed image/structured channel assertion and reuse its rejection helper for invalid structured-only output.
  • Keep explicit wire resultType enforcement unchanged. Historical persisted results still lack the discriminator and are normalized only for projection. No schema-engine, media-rendering, replay, cancellation, or MRTR-retry expansion.

Validation

Passed:

  • make -C libs/frontman-protocol test (32 tests; new constructor regression reproduced before fix)
  • make -C libs/frontman-protocol check-schemas
  • make -C libs/frontman-client check (112 tests)
  • make -C apps/frontman_server credo
  • make -C apps/frontman_server strict-compile (development and test)
  • targeted backend formatting and git diff --check

Pending, not claimed as passing:

  • Backend runtime suites and make precommit require the exclusive PaperTiger port 59001 slot, which has not been assigned. No backend runtime was started. Use a unique MIX_TEST_DB_SUFFIX when running them.
  • The model-request regression was added before production changes, but backend red/green execution is still pending that slot.

Coordination

No dependency on unmerged schema/retry work. Reuses Schema.validate_call_tool_result/2; schema ownership remains with the independent ValidatedSchema thread. Live-spec read-only review found no production regression in the consumption design. Base: integration 562eb08.

Size: 324 additions / 54 deletions, net +270 lines. Non-draft as requested; not ready to land until backend runtime validation completes. Do not merge automatically.

Review follow-up (04ecf6c)

  • Make result paging use the shared ToolOutput projection, including synthesized structured JSON and projected content counts; persistence stays unchanged.
  • Extend the existing UTF-8 paging test rather than add a test suite.
  • Align the existing persistence/model round-trip assertion with the projection policy (the sole backend test failure in the initial CI run, which passed 1081/1082 tests).
  • Move the inline historical-result explanation to module documentation; make check-source-comments now passes locally.
  • Updated local formatting, strict Credo, strict compilation, and diff checks pass. Runtime tests for the new commit remain pending CI/exclusive local slot.

Related Issue

No linked issue.

Checklist

  • Added/updated tests
  • Added changeset coverage for this user-facing change
  • Tested locally with make dev (not run)

Landing verification

Destination explicitly confirmed by BlueHotDog: integration/mcp-2026-07-28, not main. Exact head: 04ecf6c. Re-ran the CI warnings-as-errors build, protocol tests (32), client checks (112), and source-comment checks under installed Node 24.9.0 / Yarn 4.18.0; all passed. Backend strict compile/Credo evidence remains applicable. Local runtime/precommit remain unrun without the exclusive PaperTiger slot; remote backend CI and final-head Codex review must pass before merging.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T16:13:46.697052Z 04ecf6c Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ee6fa3bce4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@BlueHotDog

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 04ecf6cb73

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@BlueHotDog

Copy link
Copy Markdown
Collaborator Author

Landing verification for exact head 04ecf6c: CI run 40355049132 passed, including the full backend suite and paging regression; WordPress and Astro matrices and changelog/CLA checks passed. Codex completed review of this exact head with no findings. The original paging thread is addressed and resolved. Local Node 24.9.0 warnings-as-errors build, protocol/client tests and source-comment check also pass. E2E workflow 40355048772 is still pending, so no merge yet. Destination remains integration/mcp-2026-07-28.

@BlueHotDog
BlueHotDog merged commit 0e6dd3b into integration/mcp-2026-07-28 Oct 26, 2026
36 checks passed
@BlueHotDog
BlueHotDog deleted the structured-result-consumption branch October 26, 2026 18:12
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