Add typed MCP resource reads - #5005
Merged
Merged
Conversation
Widthdom
marked this pull request as ready for review
July 31, 2026 08:47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
read_resourceMCP tool with typed URI, 1-based inclusive line-range, UTF-8 byte-budget, generated-file opt-in, and opaque continuation-cursor inputs.resources/readcalls through the same bounded reader while preserving existingcdidx://file/...andcdidx://file-path/...behavior.content[0].text, with versioned identity and truncation/continuation metadata instructuredContent.outputSchema/tooldiscriminator 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).ReadResourceTool_passed 2/2 on each TFM;BatchQuery_|ToolsList_passed 78/78 on each TFM.49e72c616dd7ce5a72d224b439539eccf60f4f68— Release build passed with 0 warnings and 0 errors; the combinedReadResourceTool_|OutputSchemas|ToolsList_|BatchQuery_|Issue4899filter 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
USER_GUIDE.md.DEVELOPER_GUIDE.md.Changelog
changelog.d/unreleased/4900.added.md.Review
origin/main..HEAD.Follow-up candidates
None.
Fixes #4900