
    Ki	                     |    d dl Z d dlmZ d dlmZmZmZ  ed      Z ed      Zdedef   de	e   d	eegef   fd
Z
y)    N)Callable)AnyTypeVarget_type_hintsTRfunc.request_typereturnc                 V    	 t        j                         }t               }|j                  j                         D ]w  \  }}|j                  t         j                  j                  k(  s.|j                  |      }||k(  sE|j                  t         j                  j                  ur fdc S  fdc S  |j                  j                         D ]  \  }}|j                  t         j                  j                  t         j                  j                  fv sG|j                  |      }||k(  s^|j                  t         j                  j                  ur fdc S dt         dt"        t$        gt$        f   f fd} ||      c S   fdS # t        t        t
        f$ r  fdcY S w xY w)	a  
    Create a wrapper function that knows how to call func with the request object.

    Returns a wrapper function that takes the request and calls func appropriately.

    The wrapper handles three calling patterns:
    1. Positional-only parameter typed as request_type (no default): func(req)
    2. Positional/keyword parameter typed as request_type (no default): func(**{param_name: req})
    3. No request parameter or parameter with default: func()
    c                             S N _r	   s    o/home/jay/workspace/scripts/.codegraph-venv/lib/python3.12/site-packages/mcp/server/lowlevel/func_inspection.py<lambda>z%create_call_wrapper.<locals>.<lambda>   s	         c                             S r   r   r   s    r   r   z%create_call_wrapper.<locals>.<lambda>!   	    TV r   c                      |       S r   r   )reqr	   s    r   r   z%create_call_wrapper.<locals>.<lambda>#   s    49 r   c                             S r   r   r   s    r   r   z%create_call_wrapper.<locals>.<lambda>,   r   r   namer   c                       fdS )Nc                      di | iS )Nr   r   )r   r	   r   s    r   r   zCcreate_call_wrapper.<locals>.make_keyword_wrapper.<locals>.<lambda>1   s    t':tSk': r   r   )r   r	   s   `r   make_keyword_wrapperz1create_call_wrapper.<locals>.make_keyword_wrapper0   s	    ::r   c                             S r   r   r   s    r   r   z%create_call_wrapper.<locals>.<lambda>6   s	    TV r   )inspect	signaturer   
ValueError	TypeError	NameError
parametersitemskind	ParameterPOSITIONAL_ONLYgetdefaultemptyPOSITIONAL_OR_KEYWORDKEYWORD_ONLYstrr   r   )r	   r
   sig
type_hints
param_nameparam
param_typer   s   `       r   create_call_wrapperr4   	   sh    %#D)

 !^^113 -
E::**:::#
3J\)==(9(9(?(??++,,- !^^113 8
E::'++AA7CTCTCaCabb#
3J\)==(9(9(?(??++;s ;xs
7K ; ,J778  ? 	9-   s    F F('F()r   collections.abcr   typingr   r   r   r   r   typer4   r   r   r   <module>r8      sY     $ / /CLCL-hsAv. -d1g -(TUSVXYSYJZ -r   