Skip to content

mcp: add ParseURLElicitationRequiredError - #1495

Merged
guglielmo-san merged 2 commits into
modelcontextprotocol:mainfrom
QuentinBisson:feat/parse-url-elicitation-required-error
Nov 5, 2026
Merged

guglielmo-san merged 2 commits into
modelcontextprotocol:mainfrom
QuentinBisson:feat/parse-url-elicitation-required-error

Conversation

@QuentinBisson

Copy link
Copy Markdown
Contributor

On 2025-11-25 a server can refuse a request with -32042 and a list of URL
elicitations, but the client only gets the *jsonrpc.Error back from the call.
ParseURLElicitationRequiredError decodes it into []*ElicitParams, the inverse of
URLElicitationRequiredError. Following the discussion in the issue, it is strict:
every elicitation must have mode "url", a URL and an elicitation ID.

Fixes #1492

AI assistance: used to draft the code, tests and this description; I reviewed every line.

ParseURLElicitationRequiredError is the inverse of
URLElicitationRequiredError: it decodes the URL mode elicitations a
-32042 error carries, so a client can act on them without decoding the
error data itself. It accepts only elicitations with mode "url", a URL
and an elicitation ID.

Fixes modelcontextprotocol#1492
@QuentinBisson
QuentinBisson marked this pull request as ready for review November 4, 2026 19:16
@QuentinBisson

Copy link
Copy Markdown
Contributor Author

@guglielmo-san hey, can you PTAL?

@QuentinBisson

Copy link
Copy Markdown
Contributor Author

One open point: URLElicitationRequiredError only validates the mode, so it can build a -32042 that this parser rejects (no url or elicitationId), and it panics on an empty mode where Elicit infers "url". Want me to make it infer the mode like Elicit does here, and handle the missing fields in a follow-up issue since that adds new panics? Or leave both for a follow-up?

@guglielmo-san
guglielmo-san merged commit 5ea06a0 into modelcontextprotocol:main Nov 5, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal: export urlElicitationMiddleware

2 participants