
    k7iV)                        S r SSKJr  SSKJrJr  SSKJrJr  SSK	J
r
  SSKJr  SSKJr  SSKJr  \(       a  SS	KJr  S
rSrSrSrSrSr        S#S\S-  S\S-  S\\   S-  S\\\\4   -  S-  S\\   S-  S\\/\4   S-  S\\\4   S-  S\S-  S\\S\4   /\S\4   4   4S jjrSSSSSSSSS.S\S\S-  S\S-  S\S-  S\S-  S\\   S-  S\S-  S\\\4   S-  S\S-  S\\S\4   /\S\4   4   4S jjr      S$S\S-  S\S-  S\S-  S\\   S-  S\\\4   S-  S\S-  S\\S\4   /\S\4   4   4S  jjr  " S! S"5      r!g)%z_Provides a base mixin class and decorators for easy registration of class methods with FastMCP.    )Callable)TYPE_CHECKINGAny)AnnotationsToolAnnotations)Prompt)Resource)Tool)get_fn_name)FastMCP_mcp_tool_registration_mcp_resource_registration_mcp_prompt_registration_+Nnamedescriptiontagsannotationsexclude_args
serializermetaenabledreturn.c           	      p   ^ ^^^^^^^ S[         S[        4   S[         S[        4   4UUUUUU UU4S jjnU$ )zADecorator to mark a method as an MCP tool for later registration.func.r   c           	         > T	=(       d    [        U 5      TTTTT
TTS.nUR                  5        VVs0 s H  u  p#Uc  M
  X#_M     nnn[        U [        U5        U $ s  snnf )N)r   r   r   r   r   r   r   r   )r   itemssetattr_MCP_REGISTRATION_TOOL_ATTR)r   	call_argskvr   r   r   r   r   r   r   r   s       ]/home/james-whalen/.local/lib/python3.13/site-packages/fastmcp/contrib/mcp_mixin/mcp_mixin.py	decoratormcp_tool.<locals>.decorator%   sk    -K-&&($	
	 '0oo&7I&7da1TQT&7	I19= Js
   	AAr   r   )	r   r   r   r   r   r   r   r   r%   s	   ```````` r$   mcp_toolr(      s5    c* xS/A       )r   titler   	mime_typer   r   r   r   urir*   r+   c          
      t   ^ ^^^^^^^^ S[         S[        4   S[         S[        4   4UUUUUUUUU 4	S jjn	U	$ )zEDecorator to mark a method as an MCP resource for later registration.r   .r   c           
         >	 TT	=(       d    [        U 5      TTTT
TTTS.	nUR                  5        VVs0 s H  u  p#Uc  M
  X#_M     nnn[        U [        U5        U $ s  snnf )N)	r,   r   r*   r   r+   r   r   r   r   )r   r   r   _MCP_REGISTRATION_RESOURCE_ATTR)r   r!   r"   r#   r   r   r   r   r+   r   r   r*   r,   s       r$   r%   mcp_resource.<locals>.decoratorE   sn    -K-&"&

	 '0oo&7I&7da1TQT&7	I5yA	 Js   	A Ar'   )
r,   r   r*   r   r+   r   r   r   r   r%   s
   ````````` r$   mcp_resourcer1   7   s6    c* xS/A  $ r)   c                 h   ^ ^^^^^ S[         S[        4   S[         S[        4   4UUUU UU4S jjnU$ )zCDecorator to mark a method as an MCP prompt for later registration.r   .r   c                    > T=(       d    [        U 5      T	TTTTS.nUR                  5        VVs0 s H  u  p#Uc  M
  X#_M     nnn[        U [        U5        U $ s  snnf )N)r   r*   r   r   r   r   )r   r   r   _MCP_REGISTRATION_PROMPT_ATTR)
r   r!   r"   r#   r   r   r   r   r   r*   s
       r$   r%   mcp_prompt.<locals>.decoratord   se    -K-&
	 '0oo&7I&7da1TQT&7	I3Y? Js
   	AAr'   )r   r*   r   r   r   r   r%   s   `````` r$   
mcp_promptr6   Z   s5    c* xS/A   r)   c                       \ rS rSrSrS\4S jrS\4SSS\S-  S	\S
S4S jjrS\	4SSS\S-  S	\S
S4S jjr
S\4SSS\S-  S	\S
S4S jjrS\\	\4SSS\S-  S\S\S\S
S4S jjrSrg)MCPMixinv   a  Base mixin class for objects that can register tools, resources, and prompts
with a FastMCP server instance using decorators.

This mixin provides methods like `register_all`, `register_tools`, etc.,
which iterate over the methods of the inheriting class, find methods
decorated with `@mcp_tool`, `@mcp_resource`, or `@mcp_prompt`, and
register them with the provided FastMCP server instance.
registration_typec           
      
   [        U 5       Vs/ s Hh  n[        [        X5      5      (       d  M  [        [        X5      U5      (       d  M:  [        X5      [        [        X5      U5      R	                  5       4PMj     sn$ s  snf )z>Retrieves all methods marked for a specific registration type.)dircallablegetattrhasattrcopy)selfr:   method_names      r$   _get_methods_to_register!MCPMixin._get_methods_to_register   s{      #4y

  )23 24EF*24EFKKM  )
 	
 
s   B B 2B N
mcp_serverr   prefix	separatorr   c                    U R                  [        5       H  u  pEU(       a  U U US    3US'   [        R                  " UUR	                  S5      UR	                  S5      UR	                  S5      UR	                  S5      UR	                  S5      UR	                  S5      UR	                  S5      UR	                  S5      UR	                  S	5      S
9
nUR                  U5        M     g)a}  Registers all methods marked with @mcp_tool with the FastMCP server.

Args:
    mcp_server: The FastMCP server instance to register tools with.
    prefix: Optional prefix to prepend to tool names. If provided, the
        final name will be f"{prefix}{separator}{original_name}".
    separator: The separator string used between prefix and original name.
        Defaults to '_'.
r   r   r   r   r   r   output_schemar   r   )
fnr   r   r   r   r   r   rI   r   r   N)rC   r    r
   from_functiongetadd_tool)rA   rE   rF   rG   methodregistration_infotools          r$   register_toolsMCPMixin.register_tools   s     *.)F)F'*
%F hyk*;F*C)DE "&) %%&**62-11-@&**62-11-@.22>B,00>/33OD&**62)--i8D %+*
r)   c                    U R                  [        5       H  u  pEU(       a  U U US    3US'   U U US    3US'   [        R                  " UUS   UR	                  S5      UR	                  S5      UR	                  S5      UR	                  S5      UR	                  S5      UR	                  S5      UR	                  S5      UR	                  S	5      S
9
nUR                  U5        M     g)a  Registers all methods marked with @mcp_resource with the FastMCP server.

Args:
    mcp_server: The FastMCP server instance to register resources with.
    prefix: Optional prefix to prepend to resource names and URIs. If provided,
        the final name will be f"{prefix}{separator}{original_name}" and the
        final URI will be f"{prefix}{separator}{original_uri}".
    separator: The separator string used between prefix and original name/URI.
        Defaults to '+'.
r   r,   r*   r   r+   r   r   r   r   )
rJ   r,   r   r*   r   r+   r   r   r   r   N)rC   r/   r	   rK   rL   add_resource)rA   rE   rF   rG   rN   rO   resources          r$   register_resourcesMCPMixin.register_resources   s     *.)F)F+*
%F hyk*;F*C)DE "&) hyk*;E*B)CD "%(  --%e,&**62'++G4-11-@+//<&**62)--i8-11-@&**62H ##H-1*
r)   c                 t   U R                  [        5       H  u  pEU(       a  U U US    3US'   [        R                  " UUR	                  S5      UR	                  S5      UR	                  S5      UR	                  S5      UR	                  S5      UR	                  S5      S9nUR                  U5        M     g)	a  Registers all methods marked with @mcp_prompt with the FastMCP server.

Args:
    mcp_server: The FastMCP server instance to register prompts with.
    prefix: Optional prefix to prepend to prompt names. If provided, the
        final name will be f"{prefix}{separator}{original_name}".
    separator: The separator string used between prefix and original name.
        Defaults to '_'.
r   r*   r   r   r   r   )rJ   r   r*   r   r   r   r   N)rC   r4   r   rK   rL   
add_prompt)rA   rE   rF   rG   rN   rO   prompts          r$   register_promptsMCPMixin.register_prompts   s     *.)F)F)*
%F hyk*;F*C)DE "&) ))&**62'++G4-11-@&**62)--i8&**62F !!&)!*
r)   tool_separatorresource_separatorprompt_separatorc                 d    U R                  XUS9  U R                  XUS9  U R                  XUS9  g)a\  Registers all marked tools, resources, and prompts with the server.

This method calls `register_tools`, `register_resources`, and `register_prompts`
internally, passing the provided prefix and separators.

Args:
    mcp_server: The FastMCP server instance to register with.
    prefix: Optional prefix applied to all registered items unless overridden
        by a specific separator argument.
    tool_separator: Separator for tool names (defaults to '_').
    resource_separator: Separator for resource names/URIs (defaults to '+').
    prompt_separator: Separator for prompt names (defaults to '_').
)rF   rG   N)rQ   rV   r[   )rA   rE   rF   r]   r^   r_   s         r$   register_allMCPMixin.register_all   s?    * 	JP
EWXjCSTr)    )__name__
__module____qualname____firstlineno____doc__strrC   _DEFAULT_SEPARATOR_TOOLrQ   _DEFAULT_SEPARATOR_RESOURCErV   _DEFAULT_SEPARATOR_PROMPTr[   ra   __static_attributes__rc   r)   r$   r8   r8   v   s   

# 

 "0	$&$& d
$& 	$&
 
$&R "4	(.(. d
(. 	(.
 
(.Z "2	** d
* 	*
 
*H "5"= 9UU d
U 	U
  U U 
U Ur)   r8   )NNNNNNNN)NNNNNN)"rh   collections.abcr   typingr   r   	mcp.typesr   r   fastmcp.prompts.promptr   fastmcp.resources.resourcer	   fastmcp.tools.toolr
   fastmcp.utilities.typesr   fastmcp.serverr   r    r/   r4   rj   rk   rl   ri   setdictlistboolr(   r1   r6   r8   rc   r)   r$   <module>rz      s   e $ % 2 ) / # /&6 ">  :  !   " ;?%).2"&
*t c(T/ !4S>1D8	
 s)d" #$t+ sCx.4
 D[ xS!"HS#X$667B "  &*"& 	  *  :	 
 t  Tz  c(T/  t#  sCx.4
  D[  xS!"HS#X$667 H " "&
*: t c(T/	
 sCx.4
 D[ xS!"HS#X$6678^U ^Ur)   