Add support for _meta field in tool calls#68
Merged
ChrisJBurns merged 2 commits intomainfrom Jan 22, 2026
Merged
Conversation
Implements support for the optional _meta field in CallToolRequest as specified in the MCP specification (2025-11-25). The echo tool now accepts metadata in requests and echoes it back in responses, enabling validation of metadata propagation through MCP clients, proxies, and routers. Common metadata use cases include request tracking (progressToken), client context, debugging, and testing metadata propagation through complex MCP architectures. Fixes #67
There was a problem hiding this comment.
Pull request overview
This pull request adds support for the optional _meta field in tool call requests as specified in the MCP specification. The echo tool has been enhanced to accept metadata in requests and echo it back in responses, enabling validation of metadata propagation through MCP clients, proxies, and routers.
Changes:
- Enhanced
echoHandlerto extract and echo back metadata from tool call requests - Added comprehensive test coverage for metadata handling including single field, multiple fields, nested metadata, and no metadata scenarios
- Updated tool description to document metadata echoing capability
- Added detailed documentation in README explaining metadata support, use cases, and providing JSON examples
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| cmd/yardstick-server/main.go | Modified echoHandler to extract metadata from requests and return it in responses; updated tool description to document metadata echoing |
| cmd/yardstick-server/main_test.go | Added three new test functions covering metadata echoing scenarios and updated comments in existing tests to clarify nil result behavior |
| cmd/yardstick-server/integration_test.go | Updated concurrent request test logic to properly handle non-nil results with metadata; added clarifying comments |
| cmd/yardstick-server/README.md | Added comprehensive documentation section explaining metadata support, use cases, standard fields, and included JSON request/response examples |
Comments suppressed due to low confidence (1)
cmd/yardstick-server/main.go:71
- When validation fails and an error result is returned, the metadata from the request is not preserved in the error response. Consider whether metadata should be echoed back in error cases as well, to maintain consistency in metadata propagation even when requests fail. If metadata should be preserved in errors, add the Meta field to the error result at line 68.
if !validateAlphanumeric(params.Input) {
return &mcp.CallToolResult{
Content: []mcp.Content{&mcp.TextContent{Text: "input must be alphanumeric only"}},
IsError: true,
}, EchoResponse{}, nil
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
jhrozek
approved these changes
Jan 22, 2026
ChrisJBurns
approved these changes
Jan 22, 2026
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.
Implements support for the optional _meta field in CallToolRequest as specified in the MCP specification (2025-11-25). The echo tool now accepts metadata in requests and echoes it back in responses, enabling validation of metadata propagation through MCP clients, proxies, and routers.
Common metadata use cases include request tracking (progressToken), client context, debugging, and testing metadata propagation through complex MCP architectures.
Fixes #67