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.
}
}Content copied to clipboard
Constructors
Link copied to clipboard
constructor(elicitations: List<ElicitRequestURLParams>, message: String = defaultMessage(elicitations))