Skip to content

Bound MCP tool discovery payload - #5071

Merged
Widthdom merged 4 commits into
mainfrom
fix-issue5059
Aug 10, 2026
Merged

Bound MCP tool discovery payload#5071
Widthdom merged 4 commits into
mainfrom
fix-issue5059

Conversation

@Widthdom

@Widthdom Widthdom commented Aug 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • Make no-argument tools/list return a deterministic compact catalog for all enabled tools while retaining authoritative invocation schemas.
  • Omit documentation-only schema prose, output schemas, examples, and expanded workflow metadata from default discovery; keep full definitions available through format: "full", exact names, and standard cursor pagination.
  • Bound initialize guidance, keep it tool-filter aware, add section-level UTF-8/token telemetry without arguments, and preserve safety/authority caveats in compact descriptions.
  • Add bilingual developer/testing documentation and changelog.d/unreleased/5059.fixed.md, including regression coverage related to Audit MCP, LSP, JSON-RPC, and rate-limit protocol boundaries #4336.

Root cause and impact

The default MCP catalog serialized long bilingual descriptions, examples, capability metadata, and recursive output schemas for every tool, while initialization repeated workflow guidance. That consumed a large part of an agent context before its first query.

The final real stdio exchange measures 3,016 UTF-8 bytes for initialize and 57,561 UTF-8 bytes for the default tools/list response, below the documented 64-KiB catalog budget. All 25 tool names and complete call-time input constraints remain discoverable; clients can request selected full definitions on demand.

Validation

  • dotnet build CodeIndex.sln -c Release --no-restore -p:UseSharedCompilation=false — 0 warnings, 0 errors
  • Full Release suite before review fixes:
    • net9.0: 10,762 passed, 413 skipped, 0 failed
    • net8.0: 11,229 passed, 7 skipped, 0 failed
  • Post-review/post-main-merge related tests: 11 passed on net8.0 and 11 passed on net9.0
  • dotnet run --project tools/CodeIndex.Changelog -p:UseSharedCompilation=false -- check — 8 fragments valid
  • Real stdio MCP probe — initialize 3,016 bytes; default tools/list 57,561 bytes; compact safety/authority guidance present
  • git diff --check origin/main...HEAD

Adversarial review

Two mandatory Codex adversarial-review rounds were completed. The first found two issues (the suggestion source-code warning and filtered prompt guidance); both were fixed. The second found missing bounded authority caveats for analysis tools; the compact catalog now retains and tests those caveats.

Follow-up candidates

None identified within the requested scope.

Fixes #5059

@Widthdom
Widthdom marked this pull request as ready for review August 10, 2026 16:26
@Widthdom
Widthdom merged commit ef9d7d2 into main Aug 10, 2026
11 checks passed
@Widthdom
Widthdom deleted the fix-issue5059 branch August 10, 2026 16:26
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.

Shrink MCP tool discovery to an agent-safe bounded payload

1 participant