-
Notifications
You must be signed in to change notification settings - Fork 615
Propagate McpMeta to Result types in resource read, tool call, and prompt get operations #1230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…rces Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
… tests Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
|
@copilot what did you discover about other SDKs? |
I investigated the TypeScript and Python SDKs: TypeScript SDK: Has an equivalent Python SDK: Similarly has a Summary: Neither SDK consistently propagates metadata to all result types. The Python SDK does it for resources but not tools. The TypeScript SDK doesn't do it for any result type. Given this inconsistency in the other SDKs and the user's specific request for this functionality, the implementation in this PR is a reasonable enhancement that enables the use case described in the issue. |
|
@copilot, can you look at the other official SDKs as well and see what they do in this area? Ruby, Rust, Swift, Kotlin, PHP, Go, etc.? |
I investigated all official MCP SDKs. Here's a summary table:
Summary: None of the official SDKs consistently propagate primitive metadata to invocation results. The Python SDK is the closest, propagating meta for resources but not for tools or prompts. All other SDKs return handler results directly without any automatic metadata propagation. |
|
Marking NO MERGE until we decide whether we want this behavior or not, given #1230 (comment) (I've not manually validated this report) @localden, any opinion? |
[McpMeta]attribute metadata was returned inresources/list,tools/list, andprompts/listresponses but missing fromresources/read,tools/call, andprompts/getresults.Changes
ProtocolResourceTemplate.MetatoReadResourceResult.MetaProtocolTool.MetatoCallToolResult.MetaProtocolPrompt.MetatoGetPromptResult.MetaUses
??=to preserve user-provided metadata when returning result objects directly:Tests
Added 9 tests covering:
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
modelcontextprotocol.io/home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js(dns block)spec.modelcontextprotocol.io/home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.