You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
mcp: requests to the client aren't checked against the capabilities it declared #1303
The spec has a rule on each side of some requests a server sends to a client. From client/sampling (2025-11-25), servers MUST NOT send tool-enabled sampling requests to a client that hasn't declared sampling.tools, and the schema says the client MUST return an error for such a request. From client/elicitation, "Error Handling": a client MUST answer a request for a mode it didn't declare with -32602.
Only ServerSession.Elicit checks the client's capabilities today. CreateMessageWithTools sends tools to any client, and a client with only a CreateMessageHandler, which declares sampling without tools, drops tools and toolChoice and answers anyway, so the server gets an answer produced without the tools it asked for. CreateMessage and ListRoots don't check sampling and roots either. On the client side, a url-mode elicitation reaches the handler of a client that declared only form mode, which is the default.
This came up in the review of #699 (#699 (comment)), with the suggestion to cover all capability-gated server→client requests consistently. I have a change that does that: those server methods return an error before sending, as Elicit does, and the client answers -32602 before calling its handler. I can send it as a PR if that's the direction you want.
Activity
guglielmo-san commentedon Sep 30, 2026
Hi @po-et , thank you for reporting this. Feel free to proceed with the PR