
    "<i                        d dl mZ d dlmZ d dlmZmZmZmZ d dl	m
Z
 d dlmZmZmZ d dlmZmZ d dlZd dlmZ  ed	e
          Z G d ded          ZddZ G d de          Z G d de          ZdS )    )annotations)Sequence)	AnnotatedAny	TypedDictcast)Icon)BeforeValidatorFieldPrivateAttr)SelfTypeVarN)FastMCPBaseModelTdefaultc                      e Zd ZU ded<   dS )FastMCPMetaz	list[str]tagsN)__name__
__module____qualname____annotations__     /Users/kimhansen/Desktop/03 Workspace/ceo-agents/chl-effectiveness/mcp-servers/whoop/.venv/lib/python3.11/site-packages/fastmcp/utilities/components.pyr   r      s         OOOOOr   r   F)total	maybe_setset[T] | Sequence[T] | Nonereturnset[T]c                n    | t                      S t          | t                     r| S t          |           S )z@Convert a sequence to a set, defaulting to an empty set if None.)set
isinstance)r   s    r   _convert_set_default_noner%      s5    uu)S!! y>>r   c                      e Zd ZU dZ ed          Zded<    edd          Zd	ed
<    edd          Zd	ed<    edd          Z	ded<    ee
d          Zded<    edd          Zded<    edd          Zded<    e            Zd	ed<   ddd4 fd"Zed5d#            Z	 d6d7d&Zdd'dd(d8 fd,Zd9d/Zd5d0Zd:d1Zd:d2Zd;d3Z xZS )<FastMCPComponentzIBase 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)keyr4   kwargsr   r    Nonec               H     t                      j        di | || _        d S Nr   )super__init__r3   )selfr4   r5   	__class__s      r   r:   zFastMCPComponent.__init__=   s+    ""6"""			r   c                    | j         p| j        S )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*   r;   s    r   r4   zFastMCPComponent.keyA   s     y%DI%r   include_fastmcp_metabool | Nonec                    |t           j        j        }| j        pi }|rCt	          t          | j                            }|                    d          x}r||z  }||d<   |p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settingsr?   r0   r   sortedr   get)r;   r?   r0   fastmcp_metaupstream_metas        r   get_metazFastMCPComponent.get_metaK   sz      '#*#3#H yB 	,&F49,=,=>>>L $ 4 44} <,|;+D|tr   F)updatedeepr4   rJ   rK   r   c                   t                                          ||          }|||_        t          t          |          S )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.
        )rJ   rK   )r9   
model_copyr3   r   r   )r;   rJ   rK   r4   copyr<   s        r   rM   zFastMCPComponent.model_copyc   s=    $ ww!!d!;;?DID$r   otherobjectc                    t          |           t          |          urdS t          |t          |                     sdS |                                 |                                k    S )NF)typer$   
model_dump)r;   rO   s     r   __eq__zFastMCPComponent.__eq__z   s\    ::T%[[((5%d,, 	5  E$4$4$6$666r   c                p    | j         j         d| j        d| j        d| j        d| j         d| j         dS )Nz(name=z, title=z, description=z, tags=z
, enabled=))r<   r   r*   r,   r(   r   r2   r>   s    r   __repr__zFastMCPComponent.__repr__   s    .)  b  b  b  bdj  b  bbfbr  b  b  ~B  ~G  b  b  SW  S_  b  b  b  	br   c                    d| _         dS )Enable the component.TNr2   r>   s    r   enablezFastMCPComponent.enable   s    r   c                    d| _         dS )Disable the component.FNrZ   r>   s    r   disablezFastMCPComponent.disable   s    r   c                *    |                                  S )zCreate a copy of the component.)rM   r>   s    r   rN   zFastMCPComponent.copy   s       r   )r4   r+   r5   r   r    r6   )r    r)   )N)r?   r@   r    r/   )rJ   r/   rK   r1   r4   r+   r    r   )rO   rP   r    r1   r    r6   r    r   )r   r   r   __doc__r   r*   r   r,   r(   r-   r#   r   r0   r2   r   r3   r:   propertyr4   rI   rM   rT   rW   r[   r^   rN   __classcell__r<   s   @r   r'   r'      s        SS0  D     F  E     $e7  K      %u^     E     MRE-M M MD     #(%"H# # #D     E7  G    
 #{}}D$$$$,0         & & & X& 37    6 )-               .7 7 7 7b b b b      ! ! ! ! ! ! ! !r   r'   c                  n     e Zd ZU dZ ed          Zded<   ddd fdZd fdZd fdZ	ddZ
 xZS )MirroredComponentzBase 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)rh   r5   r   r    r6   c               H     t                      j        di | || _        d S r8   )r9   r:   rh   )r;   rh   r5   r<   s      r   r:   zMirroredComponent.__init__   s+    ""6""""r   c                    | j         r t          d| j         d| j         d          t                                                       dS )rY   z"Cannot enable mirrored component '"'. Create a local copy first with ".copy() and add it to your server.N)rh   RuntimeErrorr*   r9   r[   r;   r<   s    r   r[   zMirroredComponent.enable   sh    > 	`TY ` `26)` ` `   	r   c                    | j         r t          d| j         d| j         d          t                                                       dS )r]   z#Cannot disable mirrored component 'rk   rl   N)rh   rm   r*   r9   r^   rn   s    r   r^   zMirroredComponent.disable   sh    > 	`di ` `26)` ` `   	r   r   c                <    |                                  }d|_        |S )z4Create a copy of the component that can be modified.F)rM   rh   )r;   copieds     r   rN   zMirroredComponent.copy   s      "" r   )rh   r1   r5   r   r    r6   r`   ra   )r   r   r   rb   r   rh   r   r:   r[   r^   rN   rd   re   s   @r   rg   rg      s           "k%000I0000,1 # # # # # # # #                 r   rg   )r   r   r    r!   )
__future__r   collections.abcr   typingr   r   r   r   	mcp.typesr	   pydanticr
   r   r   typing_extensionsr   r   rC   fastmcp.utilities.typesr   r   r   r%   r'   rg   r   r   r   <module>ry      sr   " " " " " " $ $ $ $ $ $ 2 2 2 2 2 2 2 2 2 2 2 2       8 8 8 8 8 8 8 8 8 8 + + + + + + + +  4 4 4 4 4 4GC    )5       q! q! q! q! q!' q! q! q!h$ $ $ $ $( $ $ $ $ $r   