Add MCP spec-compliant _meta field to tool results#2
Open
tbtmuse wants to merge 2 commits intoglommer:mainfrom
Open
Add MCP spec-compliant _meta field to tool results#2tbtmuse wants to merge 2 commits intoglommer:mainfrom
tbtmuse wants to merge 2 commits intoglommer:mainfrom
Conversation
- Add _meta field to read_file and read_files tools
- Returns files read: { "io.github.glommer.cachebro/files": ["/path"] }
- Dynamic namespace detection from package.json.mcpName
- Add test/mcp-meta.test.ts with 7 tests
- Rename test/smoke.ts to test/smoke.test.ts for Bun conventions
- Update package.json test script to use auto-discovery
- Update CI to run all tests
This enables MCP clients like OpenCode to track file reads
for validation (e.g., FileTime checks) in a spec-compliant way.
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.
Motivation
I use OpenCode with cachebro and it's been awesome for saving tokens. However, OpenCode has a file write protection feature that ensures files are read before they can be modified (FileTime validation). When using cachebro to read files, OpenCode would still show the error:
This happened because OpenCode couldn't detect that cachebro had already read the file.
Proposed solution
Add MCP spec-compliant _meta field to cachebro's read_file and read_files tool results to indicate which files were read:
This enables MCP clients like OpenCode to track file reads for validation (e.g., FileTime checks) in a spec-compliant way.
Changes
Testing
All tests pass