go-sdk icon indicating copy to clipboard operation
go-sdk copied to clipboard

mcp: prompts/get calls the handler when a required argument is missing

Open po-et opened this issue 2 months ago • 0 comments

The prompts spec says a server SHOULD answer -32602 when a required argument is missing (server/prompts, "Error Handling", in both 2025-11-25 and 2026-07-28). Server.getPrompt checks that the prompt exists but not its arguments. A prompt declared with {Name: "code", Required: true} still has its handler called when the request has no code, so every handler has to repeat that check itself.

#1080 added the same kind of check for completion/complete, with an MCPGODEBUG opt-out. I have a PR that does it for prompts/get the same way.

po-et avatar Sep 25 '26 13:09 po-et