Skip to content

fix(server): mirror structured MCP results into text - #2794

Merged
bokelley merged 2 commits into
mainfrom
fix/mcp-structured-content-text-fallback
Aug 31, 2026
Merged

fix(server): mirror structured MCP results into text#2794
bokelley merged 2 commits into
mainfrom
fix/mcp-structured-content-text-fallback

Conversation

@bokelley

@bokelley bokelley commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • append the final structuredContent JSON as a TextContent fallback on all SDK server responses
  • preserve adopter-authored summaries and avoid duplicate fallback blocks
  • certify the post-enhancer wire response for text-only MCP hosts
  • sync the checked-in registry OpenAPI cache and generated types to the current canonical registry source required by CI

Why

MCP clients such as the current Claude hosted connector can expose content text to the model without exposing structuredContent. SDK v14 response builders only put summaries such as “Found 5 products” in text, so complete product data disappeared on those hosts.

The MCP tools specification recommends mirroring structured results into text for backwards compatibility.

This did not cause Scope3 AI-7680 seller dispatch failures; that outage was an inactive deployment-barrier flag. It does fix the separate v14 host-compatibility regression exposed by the retest.

Verification

  • npm run build:lib
  • npm run typecheck
  • npm run generate-registry-types -- --sync (second run: no changes)
  • NODE_ENV=test node --test test/server-create-adcp-server.test.js (156 passed)
  • npx prettier --check src/lib/server/create-adcp-server.ts test/server-create-adcp-server.test.js

aao-secretariat[bot]
aao-secretariat Bot previously approved these changes Aug 31, 2026

@aao-secretariat aao-secretariat 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.

Ladon verdict: Approve

Approve — clean additive patch.

This PR mirrors MCP structuredContent into a trailing TextContent block for text-only hosts. The reviewer verified witness-fidelity (exact serialization, no fabrication or reshaping), content[] null-safety, that ctx_metadata/error-envelope stripping precedes serialization (no secret leak), dedup/double-append correctness, and changeset presence. No Critical/High/Medium findings.

Decision-table walkthrough: no critical/high findings (row 1 n/a); gated_paths is false (row 2 n/a); high_risk is false with no deletions (rows 3–5 n/a); no prior decision (row 6 n/a); no no-auto-approve team match (row 7 n/a); zero medium findings (row 8 n/a). Falls through to row 9 → approve.

Note: review_decision is REVIEW_REQUIRED, but with gated_paths: false this does not gate the outcome.

Copy link
Copy Markdown
Contributor Author

CI triage: the Webhook Delivery Backends failure was a lease-test timeout and passed on retry. The remaining Generated, Docs & Formatting failure is unrelated registry-source drift: the job regenerates changes in schemas/registry/registry.yaml and src/lib/registry/types.generated.ts from the external registry OpenAPI, while this PR changes only create-adcp-server.ts, its focused test, and one changeset. Retrying reproduced the same external diff. I have not weakened the check or committed unrelated generated artifacts.

@bokelley

Copy link
Copy Markdown
Contributor Author

Acknowledged. The CI triage makes sense — lease-test timeout resolved on retry, and the registry-source drift in schemas/registry/registry.yaml / src/lib/registry/types.generated.ts is an external pre-existing delta unrelated to this PR's changes. No action needed on the CI failures from this end.


Generated by Claude Code

@bokelley
bokelley enabled auto-merge August 31, 2026 12:25
@bokelley
bokelley disabled auto-merge August 31, 2026 12:26

@aao-secretariat aao-secretariat 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.

Ladon verdict: Approve

Approve.

Clean pass with no critical, high, or medium findings. The delta since the prior approve is a canonical registry OpenAPI sync (schemas/registry/registry.yaml) plus its regenerated exempt types file (src/lib/registry/types.generated.ts). The YAML and generated types are internally consistent across the new async-refresh endpoint, agent_visibility_summary, and Retry-After headers. Witness-not-translator holds — no fabrication or re-shaping. A changeset (.changeset/calm-tools-show.md) is present, and server + test changes are consistent.

Decision-table walkthrough:

  • Row 1 (critical/high): no such findings.
  • Row 2 (gated_paths): gated_paths is false — does not fire despite review_decision REVIEW_REQUIRED.
  • Row 3 (deleted high-risk path): no deletions.
  • Row 4/5 (medium on schema / modified high-risk file): no medium findings.
  • Row 6 (sticky escalate): prior decision was approve — n/a.
  • Row 7 (no-auto-approve team): no match.
  • Row 8 (≥3 medium): zero medium findings.

high_risk is true only because schemas/registry/registry.yaml was modified, but the reviewer found no medium-or-higher concern, so the modification is presumed safe. Falls through to row 9 → approve.

Copy link
Copy Markdown
Contributor Author

CI is fully green on eb101d8. The externally sourced registry OpenAPI drift was regenerated with the canonical sync command and verified idempotent; all generated/docs/formatting, typecheck/build, fast + slow unit, adapter integration, reference-seller, security, and automated review checks pass. This PR is ready for review/merge.

@bokelley
bokelley merged commit c6d609b into main Aug 31, 2026
38 checks passed
@bokelley
bokelley deleted the fix/mcp-structured-content-text-fallback branch August 31, 2026 12:44
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