Skip to content

Publish typed MCP structured output schemas - #5004

Merged
Widthdom merged 4 commits into
mainfrom
fix-issue4898
Jul 31, 2026
Merged

Publish typed MCP structured output schemas#5004
Widthdom merged 4 commits into
mainfrom
fix-issue4898

Conversation

@Widthdom

Copy link
Copy Markdown
Owner

Summary

  • Publish a bounded draft 2020-12 outputSchema for every full MCP tools/list definition, covering all 24 structured tools.
  • Require per-tool tool discriminators on success and typed-error payloads, including direct calls, batch-query children, and projected status results.
  • Model search recipes, empty excerpts, dependency graphs, partial/truncated results, and finite-depth compatibility values while rejecting incomplete and cross-tool payloads.
  • Fail catalog construction when a newly registered structured tool has no output contract.

Why

MCP clients could inspect input schemas but had no machine-readable contract for structured tool results. This made success, partial, and typed-error payloads difficult to validate or generate against, and permissive compatibility fields could hide incomplete or mismatched tool responses.

User impact

Clients can now validate full-catalog MCP structured results against tool-specific schemas. Compact catalogs remain lightweight and direct clients to the full definitions.

Validation

  • dotnet test tests/CodeIndex.Tests/CodeIndex.Tests.csproj -c Release -p:UseSharedCompilation=false --no-build --no-restore --filter 'FullyQualifiedName~ToolsList|FullyQualifiedName~OutputSchema' — 51 passed on net8.0 and 51 passed on net9.0.
  • Focused discriminator, exact-byte-budget, batch truncation, and actual-schema tests — 4 passed on each target framework.
  • Full-suite run before the final fixes: net8.0 had 10,975 passed / 7 skipped / 4 failed; net9.0 had 10,501 passed / 420 skipped / 4 failed. The three affected regressions per framework and the two distinct existing timing-race failures were rerun after the fixes and all passed on both target frameworks.
  • dotnet build CodeIndex.sln -c Release -p:UseSharedCompilation=false --no-restore — succeeded with 0 warnings and 0 errors.
  • make lint — passed.
  • dotnet tools/CodeIndex.Changelog/bin/Release/net8.0/CodeIndex.Changelog.dll check — validated 74 fragments.
  • git diff --check — passed.

Documentation and changelog

  • Updated the English and Japanese MCP contract sections in README.md, DEVELOPER_GUIDE.md, and TESTING_GUIDE.md.
  • Added/updated changelog.d/unreleased/4898.added.md.

Follow-up candidates

None.

Fixes #4898

@Widthdom
Widthdom marked this pull request as ready for review July 31, 2026 04:06
@Widthdom
Widthdom merged commit 7865d1b into main Jul 31, 2026
12 checks passed
@Widthdom
Widthdom deleted the fix-issue4898 branch July 31, 2026 04:06
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.

Publish MCP output schemas for structured tool results

1 participant