UrlElicitationRequiredException

class UrlElicitationRequiredException(val elicitations: List<ElicitRequestURLParams>, message: String = defaultMessage(elicitations)) : McpException(source)

Signals that one or more URL-mode elicitations must be completed before a request can be processed.

Serialized over the wire as a JSON-RPC error with code RPCError.ErrorCode.URL_ELICITATION_REQUIRED and data holding the elicitations. A server throws this from a request handler to tell the client that a URL-mode elicitation is required; the client receives it from any request as a typed exception, equivalent to receiving an elicitation/create request.

The client is responsible for obtaining explicit user consent and surfacing each ElicitRequestURLParams before navigation — the SDK never opens or validates URLs.

Example client-side handling:

try {
client.callTool(name = "create_repo", arguments = args)
} catch (e: UrlElicitationRequiredException) {
for (elicitation in e.elicitations) {
// Show elicitation.message and the target domain, then ask the user for consent.
if (userConsents(elicitation.url)) openInBrowser(elicitation.url)
// Await completion via Client.setElicitationCompleteHandler, then optionally retry the call.
}
}

Constructors

Link copied to clipboard
constructor(elicitations: List<ElicitRequestURLParams>, message: String = defaultMessage(elicitations))

Properties

Link copied to clipboard
expect open val cause: Throwable?
Link copied to clipboard
val code: Int

the MCP/JSON-RPC error code

Link copied to clipboard

optional additional error payload as a JSON element

Link copied to clipboard

The required URL-mode elicitations (always non-empty).

Link copied to clipboard
expect open val message: String?