+
    Q(iA                       R t ^ RIHt ^ RIt^ RIt^ RIHt ^ RIHtH	t	 ^ RI
HtHtHtHtHtHtHtHt ^ RIt^ RIt^ RIHt ^ RIHtHtHtHt ^ RIHt ^ R	IHt ^ RI t ^ R
I!H"t" ^ RI#H$t$ ^ RI%H&t& ^ RI'H(t( ^ RI)H*t*H+t+ ^ RI,H-t-H.t.H/t/ ^ RI0H1t1 ^ RI2H3t3 ^ RI4H5t5H6t6H7t7 ]3! ]84      t9]'       d   ^ RI:H;t; ^ RI<H=t= ]! R]R]3,          R7      t>] ! R R]4      4       t?]! RRR7       ! R R4      4       t@ ! R R]-4      tA]R  R! l4       tB]R"RR#RR$RR%RR&RR']5R(RR)RR*RR+RR,RR-RR.R/R/ R0 ll4       tB]R6R1RR"RR#RR$RR%RR&RR']5R(RR)RR*RR+RR,RR-RR.R/R2 R3 lll4       tBR6R1RR"RR#RR$RR%RR&RR']5R(RR)RR*RR+RR,RR-RR.R/R4 R5 llltBR# )7z'Standalone @tool decorator for FastMCP.)annotationsN)Callable)	dataclassfield)TYPE_CHECKING	AnnotatedAnyLiteralProtocolTypeVaroverloadruntime_checkable)McpError)	ErrorDataIconToolAnnotationsToolExecution)Field)SkipJsonSchema)resolve_task_config)	AuthCheck)without_injected_parameters)
TaskConfig)ParsedFunction_is_object_schema)Tool
ToolResultToolResultSerializerType)call_sync_fn_in_threadpool)
get_logger)NotSetNotSetTget_cached_typeadapter)Docket)	ExecutionF.)boundc                  2    ] tR t^7t$ RtR]R&   R R ltRtR# )DecoratedToolz,Protocol for functions decorated with @tool.ToolMeta__fastmcp__c               $    V ^8  d   QhRRRRRR/# )   argsr   kwargsreturn )formats   "a/Users/agent/.openclaw/workspace/venv/lib/python3.14/site-packages/fastmcp/tools/function_tool.py__annotate__DecoratedTool.__annotate__=   s    ==c=S=S=    c                	    R # Nr0   )selfr-   r.   s   &*,r2   __call__DecoratedTool.__call__=   s    #r5   r0   N)__name__
__module____qualname____firstlineno____doc____annotations__r9   __static_attributes__r0   r5   r2   r(   r(   7   s    6==r5   r(   T)frozenkw_onlyc                     ] tR t^@t$ Rt]! RRR7      tR]R&   RtR]R	&   Rt	R
]R&   Rt
R]R&   RtR]R&   RtR]R&   RtR]R&   ]tR]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   RtR]R&   RtR ]R!&   RtR"]R#&   R$tR%]R&&   R'tR# )(r)   z6Metadata attached to functions by the @tool decorator.toolF)defaultinitzLiteral['tool']typeN
str | Nonenamestr | int | Noneversiontitledescriptionlist[Icon] | Noneiconsset[str] | Nonetagsdict[str, Any] | NotSetT | Noneoutput_schemaToolAnnotations | Noner   dict[str, Any] | Nonemetar   appbool | TaskConfig | Nonetasklist[str] | Noneexclude_args
Any | None
serializerfloat | Nonetimeout"AuthCheck | list[AuthCheck] | NoneauthTboolenabledr0   )r;   r<   r=   r>   r?   r   rH   r@   rJ   rL   rM   rN   rP   rR   r    rT   r   rW   rX   rZ   r\   r^   r`   rb   rd   rA   r0   r5   r2   r)   r)   @   s    @!&u=D/=D* $G$E:"K"#E# D/ 5;M2;*.K'."&D
&CO%)D
")%)L")!J
! G\ /3D
,3GTr5   r)   c                     a  ] tR t^Wt$ R]R&   RtR]R&   R V 3R llt]RRR	RR
RRRRRRRRRRRRRR]RRRRRRRRRR/R R ll4       t	R R lt
R R ltRRRR/R R  lltR!tV ;t# )"FunctionToolz"SkipJsonSchema[Callable[..., Any]]fnNz3Annotated[SkipJsonSchema[Any], Field(exclude=True)]return_typec                    V ^8  d   QhRRRR/# )r,   	overridesr   r/   zmcp.types.Toolr0   )r1   s   "r2   r3   FunctionTool.__annotate__[   s       
r5   c                   < \         SV `  ! R/ VB pV P                  P                  4       '       d-   RV9  d&   \	        V P                  P
                  R7      Vn        V# )zqConvert the FastMCP tool to an MCP tool.

Extends the base implementation to add task execution mode if enabled.
	execution)taskSupportr0   )superto_mcp_tooltask_configsupports_tasksr   moderm   )r8   rj   mcp_tool	__class__s   &, r2   rp   FunctionTool.to_mcp_tool[   sS     7&33 **,,I1M!.4;K;K;P;P!QHr5   metadatarJ   rL   rM   rN   rP   rR   r   r\   rT   r^   rW   rZ   r`   rb   c          "     \    V ^8  d   QhRRRRRRRRR	RR
RRRRRRRRRRRRRRRRRRRRRRR /# )!r,   rg   Callable[..., Any]rw   zToolMeta | NonerJ   rI   rL   rK   rM   rN   rP   rO   rR   rQ   r   rU   r\   r[   rT   rS   r^   zToolResultSerializerType | NonerW   rV   rZ   rY   r`   r_   rb   ra   r/   rf   r0   )r1   s   "r2   r3   rk   n   s     M
 M
M
 "	M
 M
 "M
 M
  M
 !M
 M
 ,M
 'M
 7M
 4M
  $!M
" '#M
$ %M
& 1'M
( 
)M
r5   c                  \         ;QJ d(    R VVVVVVV	VVVVV3 4       F  '       g   K   RM	  RM! R VVVVVVV	VVVVV3 4       4      ;'       g    V\        J;'       g    V
RJpVe   V'       d   \        R4      hVf   \        VVVVVVVV	VVV
VVVR7      pVP                  e>   \
        P                  P                  '       d   \        P                  ! R\        ^R7       VP                  '       d>   \
        P                  P                  '       d   \        P                  ! R	\        ^R7       \        P                  ! WP                  R
7      pVP                  ;'       g    VP                  pVR8X  d   \        R4      hVP                   pVf   \#        RR7      pM/\%        V\&        4      '       d   \"        P(                  ! V4      pMTpVP+                  VV4       \%        VP,                  \.        4      '       d   VP,                  pMVP,                  pVe7   \%        V\0        4      '       d!   \3        V4      '       g   \        RV: 24      hT ! R / RVP4                  bRVP6                  bRVP                  ;'       g    VP                  bRVP8                  e   \;        VP8                  4      MRbRVP<                  bRVP>                  ;'       g    VP>                  bRVP@                  bRVPB                  bRVbRVPD                  bRVPF                  ;'       g    \I        4       bRVP                  bRVPJ                  bRVbRVPL                  bRVPN                  b # )!aC  Create a FunctionTool from a function.

Args:
    fn: The function to wrap
    metadata: ToolMeta object with all configuration. If provided,
        individual parameters must not be passed.
    name, title, etc.: Individual parameters for backwards compatibility.
        Cannot be used together with metadata parameter.
c              3  J   "   T F  pVR J;'       d	    V\         Jx  K  	  R # 5ir7   )r    ).0xs   & r2   	<genexpr>-FunctionTool.from_function.<locals>.<genexpr>   s.      A 11!6/1s   ##TFNz|Cannot pass both 'metadata' and individual parameters to from_function(). Use metadata alone or individual parameters alone.rJ   rL   rM   rN   rP   rR   rT   r   rW   rZ   r\   r^   r`   rb   zThe `serializer` parameter is deprecated. Return ToolResult from your tools for full control over serialization. See https://gofastmcp.com/servers/tools#custom-serialization for migration examples.
stacklevelzThe `exclude_args` parameter is deprecated as of FastMCP 2.14. Use dependency injection with `Depends()` instead for better lifecycle management. See https://gofastmcp.com/servers/dependency-injection#using-depends for examples.)r\   z<lambda>z,You must provide a name for lambda functions	forbidden)rs   zROutput schemas must represent object types due to MCP spec limitations. Received: rg   rh   rJ   rL   rM   rN   rP   
parametersrT   r   rR   r^   rW   rq   r`   rb   r0   )(anyr    	TypeErrorr)   r^   fastmcpsettingsdeprecation_warningswarningswarnDeprecationWarningr\   r   from_functionrJ   
ValueErrorrZ   r   
isinstancerc   	from_boolvalidate_functionrT   r!   dictr   rg   rh   rL   strrM   rN   rP   input_schemar   rR   setrW   r`   rb   )clsrg   rw   rJ   rL   rM   rN   rP   rR   r   r\   rT   r^   rW   rZ   r`   rb   individual_params_provided	parsed_fn	func_name
task_valuerq   final_output_schemas   &&$$$$$$$$$$$$$$$      r2   r   FunctionTool.from_functionm   s   B C  CCC    ( (" F*#( ($ 4'' 	#, $>E  '+')%H" *w/?/?/T/T/TMMg #    W%5%5%J%J%JMMe # #00BWBWX	MM33Y^^	
"KLL ]]
$+6K
D))$..z:K$K%%b)4 h,,g66"+"9"9"*"8"8*z:Mt/T/T$%899 !!4 79 
  
||
!--
 00)..
 .6-=-=-IC(()t	

 ..
 !,,EE	0E0E
 ..
 !--
 .
 !,,
 ''#%
  **
 
 $
 $$
  !
 	
r5   c                    V ^8  d   QhRRRR/# )r,   	argumentsdict[str, Any]r/   r   r0   )r1   s   "r2   r3   rk      s     ++ ++> ++j ++r5   c                  "   \        V P                  4      p\        V4      pV P                  e    \        P
                  ! V P                  4      ;_uu_ 4        \        P                  ! V4      '       d   VP                  V4      G Rj  xL
 pMD\        VP                  V4      G Rj  xL
 p\        P                  ! V4      '       d   VG Rj  xL
 pRRR4       Mz\        P                  ! V4      '       d   VP                  V4      G Rj  xL
 pMD\        VP                  V4      G Rj  xL
 p\        P                  ! V4      '       d   VG Rj  xL
 pV P#                  X4      #  L L L  + '       g   i     L'; i  \         dd    \        P                  RT P                   RT P                   R24       \        \!        RRT P                   RT P                   R2R7      4      Rhi ; i L L L5i)	zRun the tool with arguments.NzTool 'z' timed out after z`s. Consider using task=True for long-running operations. See https://gofastmcp.com/servers/tasksz' execution timed out after s)codemessagei )r   rg   r"   r`   anyio
fail_afterinspectiscoroutinefunctionvalidate_pythonr   isawaitableTimeoutErrorloggerwarningrJ   r   r   convert_result)r8   r   
wrapper_fntype_adapterresults   &&   r2   runFunctionTool.run   s    09
-j9 <<#%%dll3322:>>'3'C'CI'N!N (B(88)( " #..v66+1\F 434 **:66+;;IFF9 00)   &&v..#)\F""6**A "O"
 &2 43   TYYK'9$,, H> ?
 #"(3OPTP\P\~]^ _
  G *s   /G9(F 1E/E)E/*E++E/E/E-E/F G9:G9G3G9-G5.G9G9G7G9)E/+E/-E//E?	:F >G9?F A.G00G95G97G9c                    V ^8  d   QhRRRR/# )r,   docketr#   r/   Noner0   )r1   s   "r2   r3   rk   *  s     3 36 3d 3r5   c                    V P                   P                  4       '       g   R# VP                  V P                  V P                  .R7       R# )zRegister this tool with docket for background execution.

FunctionTool registers the underlying function, which has the user's
Depends parameters for docket to resolve.
N)names)rq   rr   registerrg   key)r8   r   s   &&r2   register_with_docket!FunctionTool.register_with_docket*  s6     ..00z2r5   fn_keytask_keyc               0    V ^8  d   QhRRRRRRRRRR	R
R/# )r,   r   r#   r   r   r   rI   r   r.   r   r/   r$   r0   )r1   s   "r2   r3   rk   4  sN     C CC "C
 C C C 
Cr5   c                  "   T;'       g    V P                   pV'       d   WER&   VP                  ! V3/ VB ! R/ VB G Rj  xL
 #  L5i)aq  Schedule this tool for background execution via docket.

FunctionTool splats the arguments dict since .fn expects **kwargs.

Args:
    docket: The Docket instance
    arguments: Tool arguments
    fn_key: Function lookup key in Docket registry (defaults to self.key)
    task_key: Redis storage key for the result
    **kwargs: Additional kwargs passed to docket.add()
r   Nr0   )r   add)r8   r   r   r   r   r.   
lookup_keys   &&&$$, r2   add_to_docketFunctionTool.add_to_docket4  sD     ( ''txx
$5MZZ
5f5B	BBBBs   A AAAr0   )r;   r<   r=   r>   r@   rh   rp   classmethodr    r   r   r   r   rA   __classcell__)ru   s   @r2   rf   rf   W   s   **GKKDK $ M
 %)	M
  M
 %)M
 !M
 #'M
 $(M
 !%M
 /3M
 *.M
 :@M
 7;M
  '+!M
" *.#M
$ !%%M
& 48'M
 M
^++Z3C
 "C  $C Cr5   rf   c                    V ^8  d   QhRRRR/# r,   rg   r%   r/   r0   )r1   s   "r2   r3   r3   O  s      Q 1 r5   c                    R # r7   r0   )rg   s   &r2   rE   rE   N  s    r5   rL   rM   rN   rP   rR   rT   r   rW   rZ   r\   r^   r`   rb   c               T    V ^8  d   QhRRRRRRRRRR	R
RRRRRRRRRRRRRRRRRRR/# )r,   
name_or_fnr   rL   rK   rM   rI   rN   rP   rO   rR   rQ   rT   rS   r   'ToolAnnotations | dict[str, Any] | NonerW   rV   rZ   rY   r\   r[   r^   r]   r`   r_   rb   ra   r/   Callable[[F], F]r0   )r1   s   "r2   r3   r3   Q  s        	
    3 9   # #   -  !r5   c                   R # r7   r0   )r   rL   rM   rN   rP   rR   rT   r   rW   rZ   r\   r^   r`   rb   s   &$$$$$$$$$$$$$r2   rE   rE   P  s    " r5   rJ   c                X    V ^8  d   QhRRRRRRRRRRR	R
RRRRRRRRRRRRRRRRRRRR/# )r,   r   r   rJ   rI   rL   rK   rM   rN   rP   rO   rR   rQ   rT   rS   r   r   rW   rV   rZ   rY   r\   r[   r^   r]   r`   r_   rb   ra   r/   r   r0   )r1   s   "r2   r3   r3   c  s        	
     3 9   # #    -!" #r5   c                   R # r7   r0   )r   rJ   rL   rM   rN   rP   rR   rT   r   rW   rZ   r\   r^   r`   rb   s   &$$$$$$$$$$$$$$r2   rE   rE   b  s    $ r5   c                X    V ^8  d   QhRRRRRRRRRRR	R
RRRRRRRRRRRRRRRRRRRR/# )r,   r   zstr | Callable[..., Any] | NonerJ   rI   rL   rK   rM   rN   rP   rO   rR   rQ   rT   rS   r   r   rW   rV   rZ   rY   r\   r[   r^   r]   r`   r_   rb   ra   r/   r   r0   )r1   s   "r2   r3   r3   w  s     b b/b b 	b
 b b b b 3b 9b  b #b #b b b  -!b" 	#br5   c                 aaaaaaaa	a
aaaaaaaa \        S\        4      '       d   \        R/ SB o\        V \        4      '       d   \	        R4      hR VVVVVV	VVVV
VVV3R lloR VVVVVV	VVVV
VVV3R lloR VV3R llo\
        P                  ! V 4      '       d	   S! W4      # \        V \        4      '       d   Ve   \	        R4      hV oMV f   VoM\	        R	\        V 4       24      hR
 VV3R llpV# )zStandalone decorator to mark a function as an MCP tool.

Returns the original function with metadata attached. Register with a server
using mcp.add_tool().
zsTo decorate a classmethod, use @classmethod above @tool. See https://gofastmcp.com/servers/tools#using-with-methodsc               $    V ^8  d   QhRRRRRR/# )r,   rg   ry   	tool_namerI   r/   rf   r0   )r1   s   "r2   r3   tool.<locals>.__annotate__  s'     B B* Bz Bl Br5   c                t   < \        VSSSSSS	SS\        S4      SS
SSR 7      p\        P                  WR7      # )r   )rw   )r)   r   rf   r   )rg   r   	tool_metar   rb   rN   r\   rP   rW   rT   r^   rR   rZ   r`   rM   rL   s   && r2   create_tooltool.<locals>.create_tool  sR    #'#$T*%!
	  ))")AAr5   c               $    V ^8  d   QhRRRRRR/# r,   rg   r%   r   rI   r/   r0   )r1   s   "r2   r3   r     s!      A *  r5   c                   < \        VSSSSSS
SS	SSSSSR 7      p\        V R4      '       d   V P                  MT pW#n        V # )r   __func__)r)   hasattrr   r*   )rg   r   rw   targetr   rb   rN   r\   rP   rW   rT   r^   rR   rZ   r`   rM   rL   s   &&  r2   attach_metadatatool.<locals>.attach_metadata  s[    #'#%!
  !(J 7 7R%	r5   c               $    V ^8  d   QhRRRRRR/# r   r0   )r1   s   "r2   r3   r     s!     	. 	.a 	.J 	.1 	.r5   c                   < \         P                  P                  R 8X  d&   \        P                  ! R\
        ^R7       S! W4      # S! W4      # )objectzdecorator_mode='object' is deprecated and will be removed in a future version. Decorators now return the original function with metadata attached.r   )r   r   decorator_moder   r   r   )rg   r   r   r   s   &&r2   	decoratortool.<locals>.decorator  sG    **h6MMV"	 r--r--r5   z6Cannot specify name both as first argument and keywordzInvalid first argument: c                    V ^8  d   QhRRRR/# r   r0   )r1   s   "r2   r3   r     s     ( (A (! (r5   c                   < S! V S4      # r7   r0   )rg   r   r   s   &r2   wrappertool.<locals>.wrapper  s    Y''r5   r0   )	r   r   r   r   r   r   	isroutiner   rH   )r   rJ   rL   rM   rN   rP   rR   rT   r   rW   rZ   r\   r^   r`   rb   r   r   r   r   r   s   &$ddddddddddddd @@@@r2   rE   rE   w  s    . +t$$%44*k**I
 	

B B B(  *	. 	. $$**	J	$	$TUU				24
3C2DEFF( ( Nr5   r7   )Cr?   
__future__r   r   r   collections.abcr   dataclassesr   r   typingr   r   r   r	   r
   r   r   r   r   	mcp.typesmcpmcp.shared.exceptionsr   r   r   r   r   pydanticr   pydantic.json_schemar   r   fastmcp.decoratorsr   !fastmcp.server.auth.authorizationr   fastmcp.server.dependenciesr   fastmcp.server.tasks.configr   fastmcp.tools.function_parsingr   r   fastmcp.tools.toolr   r   r   fastmcp.utilities.async_utilsr   fastmcp.utilities.loggingr   fastmcp.utilities.typesr    r!   r"   r;   r   r   r#   docket.executionr$   r%   r(   r)   rf   rE   r0   r5   r2   <module>r      s   - "   $ (	 	 	   * E E  /  2 7 C 2 L 
 E 0  
H	*CxS)* >H > > $%  &,tC4 tCn 
  
 	 !% 	
 #  $ ! 6< <@ #' &* &* " ! 04 
" 
  !%	
  #  $ ! 6< <@ #' &* &* " !  04! 
(b b !%	b
 b #b  $b !b 6<b <@b #'b &*b &*b "b !b  04!b br5   