Skip to content

Add typed MCP resource reads - #5005

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

Add typed MCP resource reads#5005
Widthdom merged 4 commits into
mainfrom
fix-issue4900

Conversation

@Widthdom

@Widthdom Widthdom commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add a discoverable read_resource MCP tool with typed URI, 1-based inclusive line-range, UTF-8 byte-budget, generated-file opt-in, and opaque continuation-cursor inputs.
  • Route typed and legacy resources/read calls through the same bounded reader while preserving existing cdidx://file/... and cdidx://file-path/... behavior.
  • Return file text once in content[0].text, with versioned identity and truncation/continuation metadata in structuredContent.
  • Integrate the tool with batching, capability metadata, filtering, validation, instructions, response-aware page sizing, and the typed MCP outputSchema/tool discriminator contract.

The root cause was that bounded read controls existed only as protocol extensions documented in prose, so typed clients could not discover them from a schema.

Validation

  • dotnet build CodeIndex.sln --configuration Release --no-restore -p:UseSharedCompilation=false — passed with 0 warnings and 0 errors.
  • dotnet test CodeIndex.sln --configuration Release --no-restore --no-build -p:UseSharedCompilation=false --logger trx — passed on net8.0 (10,968 passed, 7 skipped) and net9.0 (10,494 passed, 420 skipped).
  • Review-fix targeted tests — ReadResourceTool_ passed 2/2 on each TFM; BatchQuery_|ToolsList_ passed 78/78 on each TFM.
  • Latest-main integration at 49e72c616dd7ce5a72d224b439539eccf60f4f68 — Release build passed with 0 warnings and 0 errors; the combined ReadResourceTool_|OutputSchemas|ToolsList_|BatchQuery_|Issue4899 filter passed 98/98 on both net8.0 and net9.0.
  • dotnet format CodeIndex.sln --verify-no-changes --no-restore — passed.
  • dotnet run --project tools/CodeIndex.Changelog -- check — validated all 78 fragments after the latest-main integration.
  • git diff --check — passed.

Documentation

  • Updated the English and Japanese MCP resource-read sections in USER_GUIDE.md.
  • Updated the English and Japanese MCP design contracts in DEVELOPER_GUIDE.md.

Changelog

  • Added changelog.d/unreleased/4900.added.md.

Review

  • Completed two Codex adversarial-review rounds against origin/main..HEAD.
  • Addressed all four actionable findings from the first round; the final round found no actionable defects.

Follow-up candidates

None.

Fixes #4900

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

Make bounded MCP resource reads discoverable to typed clients

1 participant