xjddlmZddlmZmZddlmZmZmZm Z m Z Gdde Z Gdde ZGdd eZGd d eZy ) ) annotations)Anycast)INVALID_REQUESTURL_ELICITATION_REQUIREDElicitRequestURLParams ErrorData JSONRPCErrorceZdZdZy)MCPDeprecationWarningaWA custom deprecation warning for the MCP SDK. Unlike the built-in `DeprecationWarning`, this inherits from `UserWarning` so it is shown by default, helping users discover deprecated features without enabling warnings explicitly. Reference: https://sethmlarson.dev/deprecations-via-warnings-dont-work-for-python-libraries N)__name__ __module__ __qualname____doc__i/mnt/ssd/data/Dropbox/adrian/sandbox/mcp-query/venv/lib/python3.12/site-packages/mcp/shared/exceptions.pyr r srr ceZdZUdZded<d d fd Zed dZeddZeddZ e ddZ e dd Z dd Z xZS)MCPErrorzCException type raised when an error arrives over an MCP connection.r errorcxt|||||t||||_yt|||_y)Ncodemessagedatarr)super__init__r r)selfrrr __class__s rrzMCPError.__init__s8 w-  "gDIDJ"g>DJrc.|jjSN)rrrs rrz MCPError.codezzrc.|jjSr")rrr#s rrzMCPError.message#szz!!!rc.|jjSr")rrr#s rrz MCPError.data'r$rc8|j|jSr")from_error_datarclsrs rfrom_jsonrpc_errorzMCPError.from_jsonrpc_error+s""5;;//rcT||j|j|jS)Nrrr)s rr(zMCPError.from_error_data/s EMM KKrc|jSr")rr#s r__str__zMCPError.__str__3s ||rr")rintrstrrr)returnr/)r1r0)r1r)rr r1r)rr r1r)r rrr__annotations__rpropertyrrr classmethodr+r(r. __classcell__r s@rrrs|M ?""00LLrrc$eZdZdZdfd ZxZS)NoBackChannelErrora|Raised when a server-initiated request has no channel that can deliver it. Raised by `DispatchContext.send_raw_request` when its request-scoped channel reports `TransportContext.can_send_request` as `False` (the cases are documented on that field), and by a connection's standalone channel when it has none; serializes to an `INVALID_REQUEST` error response. cFt|td|d||_y)Nz Cannot send zK: this transport context has no back-channel for server-initiated requests.r)rrrmethod)rr:r s rrzNoBackChannelError.__init__@s.  vj(st   r)r:r0)r rrrrr5r6s@rr8r87srr8cJeZdZdZddfd ZeddZeddZxZ S) UrlElicitationRequiredErrora:Specialized error for when a tool requires URL mode elicitation(s) before proceeding. Servers can raise this error from tool handlers to indicate that the client must complete one or more URL elicitations before the request can be processed. Example: ```python raise UrlElicitationRequiredError([ ElicitRequestURLParams( message="Authorization required for your files", url="https://example.com/oauth/authorize", elicitation_id="auth-001" ) ]) ``` c |dt|dkDrdndd}||_t| t|d|Dcgc]}|j dd c}i ycc}w) z'Initialize UrlElicitationRequiredError.NzURL elicitationsz required elicitationsT)by_alias exclude_noner)len _elicitationsrrr model_dump)rrArer s rrz$UrlElicitationRequiredError.__init__\sm ?'srWsB"ppK!y!H&-0(-0r