+
    Q(i"                       ^ RI Ht ^ RIHt ^ RIHtHtHtHtH	t	H
t
 ^ RIHt ^ RIHtHt ^ RIHtHt ^ RIHt ^ RIHt ]'       d   ^ R	IHt ^ R
IHt ]! R]R7      t ! R R]	RR7      tR R ltR R ltR R lt ! R R]4      t R# )    )annotations)Sequence)TYPE_CHECKING	AnnotatedAnyClassVar	TypedDictcast)Icon)BeforeValidatorField)SelfTypeVar
TaskConfig)FastMCPBaseModel)Docket)	ExecutionT)defaultc                  6    ] tR t^t$ R]R&   R]R&   R]R&   RtR# )FastMCPMetaz	list[str]tagsstrversionversions N)__name__
__module____qualname____firstlineno____annotations____static_attributes__r       b/Users/agent/.openclaw/workspace/venv/lib/python3.14/site-packages/fastmcp/utilities/components.pyr   r      s    
OLr$   r   F)totalc                    V ^8  d   QhRRRR/# )   metadict[str, Any] | Nonereturnr   r   )formats   "r%   __annotate__r-      s     P P4 P Pr$   c                    V '       g   / # \        \        V P                  R4      ;'       g    V P                  R4      ;'       g    / 4      # )zExtract FastMCP metadata from a component's meta dict.

Handles both the current `fastmcp` namespace and the legacy `_fastmcp`
namespace for compatibility with older FastMCP servers.
fastmcp_fastmcp)r
   r   get)r)   s   &r%   get_fastmcp_metadatar2      s;     	TXXi0NNDHHZ4HNNBOOr$   c                    V ^8  d   QhRRRR/# )r(   	maybe_setzset[T] | Sequence[T] | Noner+   zset[T]r   )r,   s   "r%   r-   r-   %   s      )D  r$   c                d    V f   \        4       # \        V \         4      '       d   V # \        V 4      # )z@Convert a sequence to a set, defaulting to an empty set if None.)set
isinstance)r4   s   &r%   _convert_set_default_noner8   %   s,    u)S!!y>r$   c                    V ^8  d   QhRRRR/# )r(   vzstr | int | Noner+   
str | Noner   )r,   s   "r%   r-   r-   .   s      ' J r$   c                T    V f   R# \        V 4      pRV9   d   \        RV: 24      hV# )ztCoerce version to string, accepting int or str.

Raises ValueError if version contains '@' (used as key delimiter).
N@z;Version string cannot contain '@' (used as key delimiter): )r   
ValueError)r:   r   s   & r%   _coerce_versionr?   .   s:    
 	y!fG
g~I'U
 	
 Nr$   c                    a  ] tR t^=t$ RtRtR]R&   R V 3R llt]! RR7      t	R	]R
&   ]! RRR7      t
R]R&   ]! RRR7      tR]R&   ]! RRR7      tR]R&   ]! RRR7      tR]R&   ]! ]RR7      tR]R&   ]! RRR7      tR]R&   ]! R R 7      tR!]R"&   ]R# R$ l4       t]R% R& l4       tR' R( ltR) R* ltR+ R, ltR- R. ltR/ R0 ltR1 R2 ltR3 R4 ltR5 R6 ltR7 R8 ltR9tV ;t # ):FastMCPComponentzIBase class for FastMCP tools, prompts, resources, and resource templates. zClassVar[str]
KEY_PREFIXc                    V ^8  d   QhRRRR/# )r(   kwargsr   r+   Noner   )r,   s   "r%   r-   FastMCPComponent.__annotate__B   s        r$   c                	   < \         SV `  ! R/ VB  V P                  '       g,   ^ RIpVP	                  V P
                   R2\        ^R7       R# R# )r   Nzb does not define KEY_PREFIX. Component keys will not be type-prefixed, which may cause collisions.)
stacklevelr   )super__init_subclass__rC   warningswarnr   UserWarning)clsrE   rL   	__class__s   &, r%   rK   "FastMCPComponent.__init_subclass__B   sP    !+F+~~~MM<<. !X Y	   r$   zThe name of the component.)descriptionr   nameNzpOptional version identifier for this component. Multiple versions of the same component (same name) can coexist.)r   rR   z7Annotated[str | None, BeforeValidator(_coerce_version)]r   z0The title of the component for display purposes.r;   titlez!The description of the component.rR   zHOptional list of icons for this component to display in user interfaces.zlist[Icon] | NoneiconszTags for the component.)default_factoryrR   z?Annotated[set[str], BeforeValidator(_convert_set_default_none)]r   z$Meta information about the componentr*   r)   c                 	    \        R R7      # )	forbidden)moder   r   r$   r%   <lambda>FastMCPComponent.<lambda>m   s	    jk&Br$   )rV   z_Annotated[TaskConfig, Field(description='Background task execution configuration (SEP-1686).')]task_configc                    V ^8  d   QhRRRR/# )r(   
identifierr   r+   r   )r,   s   "r%   r-   rG   p   s      # # r$   c                L    V P                   '       d   V P                    RV 2# V# )zConstruct the lookup key for this component type.

Args:
    identifier: The raw identifier (name for tools/prompts, uri for resources)

Returns:
    A prefixed key like "tool:name" or "resource:uri"
:)rC   )rO   r^   s   &&r%   make_keyFastMCPComponent.make_keyo   s)     >>>nn%Qzl33r$   c                   V ^8  d   QhRR/# r(   r+   r   r   )r,   s   "r%   r-   rG   ~   s     2 2S 2r$   c                n    V P                  V P                  4      pT RV P                  ;'       g    R 2# )a  The globally unique lookup key for this component.

Format: "{key_prefix}:{identifier}@{version}" or "{key_prefix}:{identifier}@"
e.g. "tool:my_tool@v2", "tool:my_tool@", "resource:file://x.txt@"

The @ suffix is ALWAYS present to enable unambiguous parsing of keys
(URIs may contain @ characters, so we always include the delimiter).

Subclasses should override this to use their specific identifier.
Base implementation uses name.
r=   rB   )ra   rS   r   )selfbase_keys   & r%   keyFastMCPComponent.key}   s4     ==+1T\\//R011r$   c                   V ^8  d   QhRR/# r(   r+   zdict[str, Any]r   )r,   s   "r%   r-   rG      s      . r$   c                   V P                   '       d   \        V P                   4      M/ pR\        V P                  4      /pV P                  e   V P                  VR&   VP                  R4      ;pet   \        V\        4      '       g   \        R4      hVP                  4        UUu/ uF   w  rEVP                  R4      '       d   K  WEbK"  	  ppp\        \        Wb,          4      pW!R&   V# u uppi )a  Get the meta information about the component.

Returns a dict that always includes a `fastmcp` key containing:
- `tags`: sorted list of component tags
- `version`: component version (only if set)

Internal keys (prefixed with `_`) are stripped from the fastmcp namespace.
r   r   r/   zmeta['fastmcp'] must be a dict_)r)   dictsortedr   r   r1   r7   	TypeErroritems
startswithr
   r   )rf   r)   fastmcp_metaupstream_metakr:   public_upstreams   &      r%   get_metaFastMCPComponent.get_meta   s     #')))tDII%+VDII->$?<<#&*llL# "XXi00M=mT22 @AA "/!4!4!6!6all3>O!6    _-KLL&Ys   'C,C,c                    V ^8  d   QhRRRR/# )r(   otherobjectr+   boolr   )r,   s   "r%   r-   rG      s     7 7F 7t 7r$   c                	    \        V 4      \        V4      Jd   R # \        V\        V 4      4      '       g   R # V P                  4       VP                  4       8H  # )F)typer7   
model_dump)rf   rz   s   &&r%   __eq__FastMCPComponent.__eq__   sD    :T%[(%d,, E$4$4$666r$   c                   V ^8  d   QhRR/# rd   r   )r,   s   "r%   r-   rG      s     @ @# @r$   c                	V   R V P                   : 2.pV P                  '       d    VP                  RV P                  : 24       VP                  RV P                  : 2RV P
                  : 2RV P                   2.4       V P                  P                   RRP                  V4       R2# )zname=zversion=ztitle=zdescription=ztags=(z, ))
rS   r   appendextendrT   rR   r   rP   r   join)rf   partss   & r%   __repr__FastMCPComponent.__repr__   s    &'<<<LL8DLL#345't//23		{#	
 ..))*!DIIe,<+=Q??r$   c                   V ^8  d   QhRR/# r(   r+   rF   r   )r,   s   "r%   r-   rG      s     
 
 
r$   c                4    \        RV P                   R24      h)z6Removed in 3.0. Use server.enable(keys=[...]) instead.zHComponent.enable() was removed in FastMCP 3.0. Use server.enable(keys=['']) instead.NotImplementedErrorrh   rf   s   &r%   enableFastMCPComponent.enable   s$    !((,z?
 	
r$   c                   V ^8  d   QhRR/# r   r   )r,   s   "r%   r-   rG      s     
 
 
r$   c                4    \        RV P                   R24      h)z7Removed in 3.0. Use server.disable(keys=[...]) instead.zJComponent.disable() was removed in FastMCP 3.0. Use server.disable(keys=['r   r   r   s   &r%   disableFastMCPComponent.disable   s%    !))-
,@
 	
r$   c                   V ^8  d   QhRR/# )r(   r+   r   r   )r,   s   "r%   r-   rG      s     ! !d !r$   c                "    V P                  4       # )zCreate a copy of the component.)
model_copyr   s   &r%   copyFastMCPComponent.copy   s      r$   c                    V ^8  d   QhRRRR/# )r(   docketr   r+   rF   r   )r,   s   "r%   r-   rG      s      6 d r$   c                    R# )zRegister this component with docket for background execution.

No-ops if task_config.mode is "forbidden". Subclasses override to
register their callable (self.run, self.read, self.render, or self.fn).
Nr   )rf   r   s   &&r%   register_with_docket%FastMCPComponent.register_with_docket   s    r$   c               (    V ^8  d   QhRRRRRRRR/# )r(   r   r   argsr   rE   r+   r   r   )r,   s   "r%   r-   rG      s,     
 

%(
47
	
r$   c                   "   V P                   P                  4       '       g1   \        RV P                  P                   RV P
                   R24      h\        V P                  P                   R24      h5i)a  Schedule this component for background execution via docket.

Subclasses override this to handle their specific calling conventions:
- Tool: add_to_docket(docket, arguments: dict, **kwargs)
- Resource: add_to_docket(docket, **kwargs)
- ResourceTemplate: add_to_docket(docket, params: dict, **kwargs)
- Prompt: add_to_docket(docket, arguments: dict | None, **kwargs)

The **kwargs are passed through to docket.add() (e.g., key=task_key).
zCannot add z 'z)' to docket: task execution not supportedz# does not implement add_to_docket())r\   supports_tasksRuntimeErrorrP   r   rS   r   )rf   r   r   rE   s   &&*,r%   add_to_docketFastMCPComponent.add_to_docket   su      ..00dnn556b D/ 0  "~~&&''JK
 	
s   A3A5c                   V ^8  d   QhRR/# rk   r   )r,   s   "r%   r-   rG      s     3 3^ 3r$   c                    RV P                   /# )zkReturn span attributes for telemetry.

Subclasses should call super() and merge their specific attributes.
zfastmcp.component.key)rh   r   s   &r%   get_span_attributes$FastMCPComponent.get_span_attributes   s    
 (22r$   r   )!r   r   r    r!   __doc__rC   r"   rK   r   rS   r   rT   rR   rU   r6   r   r)   r\   classmethodra   propertyrh   rw   r   r   r   r   r   r   r   r   r#   __classcell__)rP   s   @r%   rA   rA   =   sI   S "J"  0D#  HMKHGD 
 FE:  $7K   %^ E  MR-MD
I  #("H#D
  	BC   D
   2 287@

!
,3 3r$   rA   N)!
__future__r   collections.abcr   typingr   r   r   r   r	   r
   	mcp.typesr   pydanticr   r   typing_extensionsr   r   fastmcp.server.tasks.configr   fastmcp.utilities.typesr   r   r   docket.executionr   r   r   r2   r8   r?   rA   r   r$   r%   <module>r      sb    " $ K K  + + 2 4*C)5 Pu3' u3r$   