
    k7ig                        S SK Jr  S SKJr  S SKJrJrJr  S SKJ	r	  S SK
JrJrJr  S SKJrJr  S SKrS SKJr  \" S	\S
9r " S S\SS9rSS jr " S S\5      r " S S\5      rg)    )annotations)Sequence)	AnnotatedAny	TypedDict)Icon)BeforeValidatorFieldPrivateAttr)SelfTypeVarN)FastMCPBaseModelTdefaultc                       \ rS rSr% S\S'   Srg)FastMCPMeta   z	list[str]tags N)__name__
__module____qualname____firstlineno____annotations____static_attributes__r       V/home/james-whalen/.local/lib/python3.13/site-packages/fastmcp/utilities/components.pyr   r      s    
Or   r   F)totalc                `    U c
  [        5       $ [        U [         5      (       a  U $ [        U 5      $ )z@Convert a sequence to a set, defaulting to an empty set if None.)set
isinstance)	maybe_sets    r   _convert_set_default_noner$      s,    u)S!!y>r   c                  ~  ^  \ rS rSr% Sr\" SS9rS\S'   \" SSS	9rS
\S'   \" SSS	9r	S
\S'   \" SSS	9r
S\S'   \" \SS9rS\S'   \" SSS	9rS\S'   \" SSS	9rS\S'   \" 5       rS
\S'   SS.S*U 4S jjjr\S+S j5       r S,   S-S  jjrSS!SS".       S.U 4S# jjjrS/S$ jrS+S% jrS0S& jrS0S' jrS1S( jrS)rU =r$ )2FastMCPComponent   zIBase class for FastMCP tools, prompts, resources, and resource templates.zThe name of the component.)descriptionstrnameNz0The title of the component for display purposes.)r   r(   
str | Nonetitlez!The description of the component.r(   zHOptional list of icons for this component to display in user interfaces.zlist[Icon] | NoneiconszTags for the component.)default_factoryr(   z?Annotated[set[str], BeforeValidator(_convert_set_default_none)]r   z$Meta information about the componentdict[str, Any] | NonemetaTz!Whether the component is enabled.boolenabled_key)keyc               2   > [         TU ]  " S0 UD6  Xl        g Nr   )super__init__r3   )selfr4   kwargs	__class__s      r   r8   FastMCPComponent.__init__=   s    "6"	r   c                @    U R                   =(       d    U R                  $ )a  
The key of the component. This is used for internal bookkeeping
and may reflect e.g. prefixes or other identifiers. You should not depend on
keys having a certain value, as the same tool loaded from different
hierarchies of servers may have different keys.
)r3   r*   r9   s    r   r4   FastMCPComponent.keyA   s     yy%DII%r   c                   Uc  [         R                  R                  nU R                  =(       d    0 nU(       a<  [	        [        U R                  5      S9nUR                  S5      =n(       a  XC-  nX2S'   U=(       d    S$ )z
Get the meta information about the component.

If include_fastmcp_meta is True, a `_fastmcp` key will be added to the
meta, containing a `tags` field with the tags of the component.
N)r   _fastmcp)fastmcpsettingsinclude_fastmcp_metar0   r   sortedr   get)r9   rD   r0   fastmcp_metaupstream_metas        r   get_metaFastMCPComponent.get_metaK   sm      '#*#3#3#H#H yyB&F499,=>L $ 44}4,;+|tr   F)updatedeepr4   c               4   > [         TU ]  XS9nUb  X4l        U$ )z
Create a copy of the component.

Args:
    update: A dictionary of fields to update.
    deep: Whether to deep copy the component.
    key: The key to use for the copy.
)rK   rL   )r7   
model_copyr3   )r9   rK   rL   r4   copyr;   s        r   rN   FastMCPComponent.model_copyc   s&    $ w!!;?Ir   c                    [        U 5      [        U5      La  g[        U[        U 5      5      (       d  gU R                  5       UR                  5       :H  $ )NF)typer"   
model_dump)r9   others     r   __eq__FastMCPComponent.__eq__z   sD    :T%[(%d,, E$4$4$666r   c                    U R                   R                   SU R                  < SU R                  < SU R                  < SU R
                   SU R                   S3$ )Nz(name=z, title=z, description=z, tags=z
, enabled=))r;   r   r*   r,   r(   r   r2   r>   s    r   __repr__FastMCPComponent.__repr__   s    ..))*&Xdjj^Sabfbrbrauu|  ~B  ~G  ~G  }H  HR  SW  S_  S_  R`  `a  b  	br   c                    SU l         g)Enable the component.TNr2   r>   s    r   enableFastMCPComponent.enable   s	    r   c                    SU l         g)Disable the component.FNr]   r>   s    r   disableFastMCPComponent.disable   s	    r   c                "    U R                  5       $ )zCreate a copy of the component.)rN   r>   s    r   rO   FastMCPComponent.copy   s      r   )r3   r2   )r4   r+   r:   r   returnNone)rf   r)   )N)rD   zbool | Nonerf   r/   )rK   r/   rL   r1   r4   r+   rf   r   )rT   objectrf   r1   rf   rg   rf   r   )r   r   r   r   __doc__r
   r*   r   r,   r(   r-   r!   r   r0   r2   r   r3   r8   propertyr4   rI   rN   rU   rY   r^   rb   rO   r   __classcell__r;   s   @r   r&   r&      s[   S0D#  FE:  $7K   %^ E  MR-MD
I  #("H#D
  7GT 
 #}D*$,0   & & 37$/	6 )- & 	
  
 .7b! !r   r&   c                  z   ^  \ rS rSr% Sr\" SS9rS\S'   SS.SU 4S jjjrSU 4S	 jjr	SU 4S
 jjr
SS jrSrU =r$ )MirroredComponent   zBase class for components that are mirrored from a remote server.

Mirrored components cannot be enabled or disabled directly. Call copy() first
to create a local version you can modify.
Fr   r1   	_mirrored)rr   c               2   > [         TU ]  " S0 UD6  Xl        g r6   )r7   r8   rr   )r9   rr   r:   r;   s      r   r8   MirroredComponent.__init__   s    "6""r   c                   > U R                   (       a&  [        SU R                   SU R                   S35      e[        TU ]  5         g)r\   z"Cannot enable mirrored component '"'. Create a local copy first with ".copy() and add it to your server.N)rr   RuntimeErrorr*   r7   r^   r9   r;   s    r   r^   MirroredComponent.enable   sF    >>4TYYK @226))<^`  	r   c                   > U R                   (       a&  [        SU R                   SU R                   S35      e[        TU ]  5         g)ra   z#Cannot disable mirrored component 'rv   rw   N)rr   rx   r*   r7   rb   ry   s    r   rb   MirroredComponent.disable   sF    >>5dii[ A226))<^`  	r   c                4    U R                  5       nSUl        U$ )z4Create a copy of the component that can be modified.F)rN   rr   )r9   copieds     r   rO   MirroredComponent.copy   s     " r   )rr   r1   r:   r   rf   rg   ri   rj   )r   r   r   r   rk   r   rr   r   r8   r^   rb   rO   r   rm   rn   s   @r   rp   rp      s:     "%0It0,1 # # r   rp   )r#   zset[T] | Sequence[T] | Nonerf   zset[T])
__future__r   collections.abcr   typingr   r   r   	mcp.typesr   pydanticr	   r
   r   typing_extensionsr   r   rB   fastmcp.utilities.typesr   r   r   r$   r&   rp   r   r   r   <module>r      s_    " $ , ,  8 8 +  4C)5 q!' q!h$( $r   