
    m3i>              	      X   U d dl mZ d dlmZmZ d dlmZmZmZ d dl	Z
d dl
mZ d dlmZ d dlmZmZ d dl	mZmZ d d	l	mZ d d
lmZ d dlmZ d dlmZ g dZ ede      Z G d deee         Zeeee   dz  eeeef   geeeeef   z  eeeeef   z     z     f   Z de!d<   	 	 	 	 ddZ"y)    )annotations)	AwaitableCallable)AnyGeneric	TypeAliasN)ClientSession)ElicitationFnT)LifespanContextTRequestContext)ElicitRequestFormParamsElicitRequestParams)ElicitResult)to_jsonable_python)TypeVar)json_schema_to_type)r   r   ElicitationHandlerT)defaultc                      e Zd ZU dZded<   y)r   NzT | Nonecontent)__name__
__module____qualname__r   __annotations__     d/mnt/e/genesis-system/.venvs/voice-bridge/lib/python3.12/site-packages/fastmcp/client/elicitation.pyr   r      s    GXr   r   r   r   c                      	 	 	 	 	 	 d fd}|S )Nc                t  K   	 t        |t              r+|j                  di dk(  rd }nt        |j                        }nd } |j                  |||        d {   }t        |t
              st        d|      }t        |j                        }t        |t        d z        st        d|j                        t        |j                  |j                  |      S 7 # t        $ rL}t        j                  j!                  t        j                  j"                  t%        |            cY d }~S d }~ww xY ww)Nobject)type
propertiesaccept)actionr   zNElicitation responses must be serializable as a JSON object (dict). Received: )_metar%   r   )codemessage)
isinstancer   requestedSchemar   r(   r   r   r   dict
ValueErrorMCPElicitResultmetar%   	Exceptionmcptypes	ErrorDataINTERNAL_ERRORstr)contextparamsresponse_typeresultr   eelicitation_handlers         r   _elicitation_handlerz9create_elicitation_callback.<locals>._elicitation_handler)   s    !	&"9:))hb-QQ$(M$78N8N$OM !%.vw F fl3%XvF(8Ggtd{3 d~~(*  #kk}} $  	99&&YY--A '  	sI   D8AC  CBC  D8C   	D5)AD0*D5+D80D55D8)r5   z/RequestContext[ClientSession, LifespanContextT]r6   r   returnz%MCPElicitResult | mcp.types.ErrorDatar   )r:   r;   s   ` r   create_elicitation_callbackr=   &   s+    %@%#% 
/%N  r   )r:   r   r<   r
   )#
__future__r   collections.abcr   r   typingr   r   r   	mcp.typesr0   r	   mcp.client.sessionr
   mcp.shared.contextr   r   r   r   r   r-   pydantic_corer   typing_extensionsr   "fastmcp.utilities.json_schema_typer   __all__r   r4   r"   r+   r   r   r=   r   r   r   <module>rH      s    " / * *   - ? B 5 , % B
GC?GAJ  !)Q
	}&667 a$sCx. <DcN0B#CCDF	! I 	* +* * r   