MCPcopy Index your code
hub / github.com/modelcontextprotocol/python-sdk / elicit_url

Method elicit_url

src/mcp/server/session.py:312–347  ·  view source on GitHub ↗

Send a URL mode elicitation/create request. This directs the user to an external URL for out-of-band interactions like OAuth flows, credential collection, or payment processing. Args: message: Human-readable explanation of why the interaction is needed.

(
        self,
        message: str,
        url: str,
        elicitation_id: str,
        related_request_id: types.RequestId | None = None,
    )

Source from the content-addressed store, hash-verified

310 )
311
312 async def elicit_url(
313 self,
314 message: str,
315 url: str,
316 elicitation_id: str,
317 related_request_id: types.RequestId | None = None,
318 ) -> types.ElicitResult:
319 """Send a URL mode elicitation/create request.
320
321 This directs the user to an external URL for out-of-band interactions
322 like OAuth flows, credential collection, or payment processing.
323
324 Args:
325 message: Human-readable explanation of why the interaction is needed.
326 url: The URL the user should navigate to.
327 elicitation_id: Unique identifier for tracking this elicitation.
328 related_request_id: Optional ID of the request that triggered this elicitation.
329
330 Returns:
331 The client's response indicating acceptance, decline, or cancellation.
332
333 Raises:
334 NoBackChannelError: The connection has no back-channel for
335 server-initiated requests.
336 """
337 return await self.send_request(
338 types.ElicitRequest(
339 params=types.ElicitRequestURLParams(
340 message=message,
341 url=url,
342 elicitation_id=elicitation_id,
343 ),
344 ),
345 types.ElicitResult,
346 metadata=ServerMessageMetadata(related_request_id=related_request_id),
347 )
348
349 async def send_ping(self) -> types.EmptyResult:
350 """Send a ping request."""

Callers 1

elicit_urlFunction · 0.45

Calls 2

send_requestMethod · 0.95

Tested by

no test coverage detected