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
I searched the existing issues, and this has not been reported before.
This is a real problem that I ran into myself, using the latest release of the SDK.
I ran into it in a production system, not in a toy example, a benchmark, or an automated or AI-driven scan of the code.
I (a human) examined the relevant SDK code, and wrote or reviewed every line of this report. It is not unreviewed AI output.
This report is brief and concise, and sticks to the facts needed to understand the problem.
What problem are you trying to solve?
Our client handles URL mode elicitations in its ElicitationHandler. On 2026-07-28 the input requests of a tool result reach that handler. On 2025-11-25 a -32042 error does not: CallTool returns the *jsonrpc.Error, so we decode its elicitations data ourselves to get the same ElicitParams.
urlElicitationMiddleware in mcp/client.go already turns -32042 into handler calls, but it is unexported (see its TODO(rfindley) about exporting it). It returns a handler error wrapped, so it also works for a client that can't wait in-process: our handler returns an error carrying the URL and we pause the task for a person.
Where did you hit this?
kagent's Go ADK agent runtime relays an MCP server's URL elicitation to the person as an A2A input-required task (kagent-dev/kagent#3500).
What would help?
Export the middleware, e.g. func URLElicitationMiddleware() Middleware, or an option on ClientOptions that installs it. A smaller alternative: an exported helper that decodes -32042 data into []*ElicitParams, the inverse of URLElicitationRequiredError.
AI assistance: used to check the SDK code paths and draft this report.
@QuentinBisson, Thanks for the report.
I'd lean toward the smaller decoder helper :
// ParseURLElicitationRequiredError extracts the URL-mode elicitation requests// from err if err wraps a *jsonrpc.Error with code CodeURLElicitationRequired (-32042).//// If err does not have code CodeURLElicitationRequired, it returns (nil, false, nil).// If err has code CodeURLElicitationRequired, ok is true and a non-nil error is// returned if the error data is malformed or contains non-URL elicitations.funcParseURLElicitationRequiredError(errerror) (elicitations []*ElicitParams, okbool, parseErrerror)
Would ParseURLElicitationRequiredError work well for your kagent integration?
Yes, that works for us. It replaces the hand-rolled decode in kagent's ADK runtime. A few details we'd rely on:
Match with errors.As. call() already wraps the *jsonrpc.Error (calling %q: %w), and ADK's mcptoolset wraps it again.
A -32042 with missing data gives ok=true and a parseErr, since the schema makes data required.
On mode: URLElicitationRequiredError treats an empty mode as form and panics, while ServerSession.Elicit infers "url" from URL/ElicitationID. Should the parser follow the spec strictly (mode: "url" and elicitationId required), or apply inferElicitMode? Strict seems right to me, and the constructor could then infer the same way Elicit does.
Activity
guglielmo-san commentedon Nov 4, 2026
@QuentinBisson, Thanks for the report.
I'd lean toward the smaller decoder helper :
Would
ParseURLElicitationRequiredErrorwork well for yourkagentintegration?guglielmo-san commentedon Nov 4, 2026
I have also decided to remove urlElicitationMiddleware in #1494
It was not used, and it is meaningful only for an outdated version of the protocol
QuentinBisson commentedon Nov 4, 2026
Yes, that works for us. It replaces the hand-rolled decode in kagent's ADK runtime. A few details we'd rely on:
errors.As.call()already wraps the*jsonrpc.Error(calling %q: %w), and ADK's mcptoolset wraps it again.-32042with missingdatagivesok=trueand aparseErr, since the schema makesdatarequired.URLElicitationRequiredErrortreats an empty mode as form and panics, whileServerSession.Elicitinfers"url"fromURL/ElicitationID. Should the parser follow the spec strictly (mode: "url"andelicitationIdrequired), or applyinferElicitMode? Strict seems right to me, and the constructor could then infer the same wayElicitdoes.Happy to send the PR if you'd like.
guglielmo-san commentedon Nov 4, 2026
Yes lets keep the strict mode.
I assigned the Issue to you, you can now send a PR
mcp: add ParseURLElicitationRequiredError (modelcontextprotocol#1495)