+
    Q(iG             
        a  0 t $ R t^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIH	t	H
t
HtHt ^ RIHtHt ^ RIHt ^ RIHt ^ RIHt ^ RI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$ ^ RI%H&t& ^ RI'H(t( ^ RI)H*t* ^ RIH+t+H,t,H-t-H.t. ^ RI/H0t0 ^ RI/H1t2 ^ RI3H4t4 ^ RI5H6t6 ^ RI7t7^ RI8t7^ RI9H:t:H;t;H<t<H=t=H>t>H?t?H1t1 ^ RI@HAtA ^ RIBHCtC ^ RIDHEtE ^ RIFHGtG ^ RIHHItIHJtJ ^ RIKHLtL ^ RIMHNtNHOtOHPtP ^ RIQHRtRHStSHTtTHUtU ^ RIVHWtW ^ RIXHYtY ^ RIZH[t[H\t\ ^ RI]H^t^H_t_H`t` ^ R IaHbtbHctc ^ R!IdHete ^ R"IfHgtgHhth ^ R#IiHjtj ^ R$IkHltlHmtm ^ R%InHotoHptp ^ R&IqHrts ^ R'ItHutu ^ R(IvHwtwHxtx ^ R)IyHztz ^ R*I{H|t| ^ R+I}H~t~ ^ R,IHtHtHt ^ R-IHt ]'       d3   ^ R.IHt ^ R/IHt ^ R0IHt ^ R1IHtHt ^ R2IHt ^ R3IHt ^ R4IHt ^ R5IHt ]~! ]4      t]! R6]R7]3,          R87      t]Ri,          tr/ R9R:bR;R<bR=R>bR?R@bRARBbRCRDbRERFbRGRHbRIRJbRKRLbRMRLbRNRLbRORPbRQRRbRSRTbRURVbtRW]RX&   RY RZ lt]Rj,          t]EP:                  ! R[4      t]R\.]](,          3,          tR] R^ lt]R_ R` l4       tRa Rb lt ! Rc Rd]4      t ! Re Rf]e]^]_]`]](,          4      tRg Rh ltR# )kz5FastMCP - A more ergonomic interface for MCP servers.)annotationsN)AsyncIterator	AwaitableCallableSequence)AbstractAsyncContextManagerasynccontextmanager)replace)partial)Path)TYPE_CHECKINGAnyGenericLiteralTypeVarcastoverload)PydanticAdapter)AsyncKeyValue)MemoryStore)LifespanResultT)McpError)AnnotationsAnyFunctionCallToolRequestParamsToolAnnotations)AnyUrl)ValidationError)	BaseRoute)Self)AuthorizationErrorFastMCPErrorNotFoundErrorPromptErrorResourceError	ToolErrorr   )	MCPConfig)Prompt)FunctionPrompt)PromptResult)ResourceResourceResult)ResourceTemplate)	AppConfigapp_config_to_meta_dictresolve_ui_mime_type)	AuthCheckAuthContextAuthProviderrun_auth_checks)Lifespan)LowLevelServer)
MiddlewareMiddlewareContext)LifespanMixinMCPOperationsMixinTransportMixin)LocalProviderProvider)AggregateProvider)
TaskConfigTaskMeta)server_span)ToolTransform	Transform)apply_session_transforms
is_enabled)DuplicateBehavior)FunctionTool)Tool
ToolResult)ToolTransformConfig)FastMCPComponent)
get_logger)FastMCPBaseModelNotSetNotSetT)VersionSpec)Client)FastMCP1Server)SamplingHandler)ClientTransportClientTransportT)ComponentFn)RouteMap)
RouteMapFnFastMCPProxyF.)boundhostz7Pass `host` to `run_http_async()`, or set FASTMCP_HOST.portz7Pass `port` to `run_http_async()`, or set FASTMCP_PORT.sse_pathzKPass `path` to `run_http_async()` or `http_app()`, or set FASTMCP_SSE_PATH.message_pathzSet FASTMCP_MESSAGE_PATH.streamable_http_pathzWPass `path` to `run_http_async()` or `http_app()`, or set FASTMCP_STREAMABLE_HTTP_PATH.json_responsezYPass `json_response` to `run_http_async()` or `http_app()`, or set FASTMCP_JSON_RESPONSE.stateless_httpz[Pass `stateless_http` to `run_http_async()` or `http_app()`, or set FASTMCP_STATELESS_HTTP.debugzSet FASTMCP_DEBUG.	log_levelzAPass `log_level` to `run_http_async()`, or set FASTMCP_LOG_LEVEL.on_duplicate_toolszUse `on_duplicate=` instead.on_duplicate_resourceson_duplicate_promptstool_serializerzgReturn ToolResult from your tools instead. See https://gofastmcp.com/servers/tools#custom-serializationinclude_tagszCUse `server.enable(tags=..., only=True)` after creating the server.exclude_tagsz9Use `server.disable(tags=...)` after creating the server.tool_transformationszIUse `server.add_transform(ToolTransform(...))` after creating the server.zdict[str, str]_REMOVED_KWARGSc                    V ^8  d   QhRRRR/# )   kwargsdict[str, Any]returnNone )formats   "[/Users/agent/.openclaw/workspace/venv/lib/python3.14/site-packages/fastmcp/server/server.py__annotate__rv   ~   s     

 

. 

T 

    c                    V  F*  pV\         9   g   K  \        RV R\         V,           24      h	  V '       d%   \        RRP                  R V  4       4       24      hR# )z2Raise helpful TypeErrors for kwargs removed in v3.zFastMCP() no longer accepts `z`. z.FastMCP() got unexpected keyword argument(s): z, c              3  8   "   T F  p\        V4      x  K  	  R # 5iN)repr).0ks   & ru   	<genexpr>(_check_removed_kwargs.<locals>.<genexpr>   s     F_X^STtAwwX^s   N)rl   	TypeErrorjoin)ro   keys   & ru   _check_removed_kwargsr   ~   si    /!/uC8L7MN  
 <TYYF_X^F_=_<`a
 	
 rw   z^([^:]+://)(.*?)$FastMCP[LifespanResultT]c                   V ^8  d   QhRR/# )rn   rq   ztuple[bool, Any]rs   )rt   s   "ru   rv   rv      s     ' '+ 'rw   c                 f    ^ RI Hp  V P                  4       R8H  pV'       d   R# ^ RIHp RV! 4       3# )a,  Get auth context for the current request.

Returns a tuple of (skip_auth, token) where:
- skip_auth=True means auth checks should be skipped (STDIO transport)
- token is the access token for HTTP transports (may be None if unauthenticated)

Uses late import to avoid circular import with context.py.
)_current_transportstdio)get_access_tokenF)TN)fastmcp.server.contextr   getfastmcp.server.dependenciesr   )r   is_stdior   s      ru   _get_auth_contextr      s5     :!%%'72H<#%&&rw   c                    V ^8  d   QhRRRR/# )rn   serverr   rq   zAsyncIterator[Any]rs   )rt   s   "ru   rv   rv      s     	 	#; 	@R 	rw   c                  "   / 5x  R# 5i)zDefault lifespan context manager that does nothing.

Args:
    server: The server instance this lifespan is managing

Returns:
    An empty dictionary as the lifespan result.
Nrs   )r   s   &ru   default_lifespanr      s      Hs   
c                    V ^8  d   QhRRRR/# )rn   fastmcp_serverr   rq   zYCallable[[LowLevelServer[LifespanResultT]], AbstractAsyncContextManager[LifespanResultT]]rs   )rt   s   "ru   rv   rv      s      ,rw   c                ,   a  \         R  V 3R ll4       pV# )c                    V ^8  d   QhRRRR/# )rn   low_level_serverzLowLevelServer[LifespanResultT]rq   zAsyncIterator[LifespanResultT]rs   )rt   s   "ru   rv   %_lifespan_proxy.<locals>.__annotate__   s     . .9.	'.rw   c                  <"   SP                   \        J d   / 5x  R # SP                  '       g   \        R4      hSP                  5x  R # 5i)Na  FastMCP server has a lifespan defined but no lifespan result is set, which means the server's context manager was not entered.  Are you running the server in a way that supports lifespans? If so, please file an issue at https://github.com/PrefectHQ/fastmcp/issues.)	_lifespanr   _lifespan_result_setRuntimeError_lifespan_result)r   r   s   &ru   wrap_lifespan_proxy.<locals>.wrap   sL      ##'77H222^ 
 ---s
   -AA)r   )r   r   s   f ru   _lifespan_proxyr      s    
 . . Krw   c                  &    ] tR t^t$ RtR]R&   RtR# )
StateValuez(Wrapper for stored context state values.r   valuers   N)__name__
__module____qualname____firstlineno____doc____annotations____static_attributes__rs   rw   ru   r   r      s
    2Jrw   r   c            %        a  ] tR t^tRR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/R V 3R lllltR R lt]R R l4       t]R R l4       t]P                  R R l4       t]R R  l4       t
]R! R" l4       t]R# R$ l4       t]R% R& l4       tR' R( ltR) R* ltR+R,/R- V 3R. llltR/ V 3R0 lltR1 R2 ltR3 R4 ltR5 R6 ltR7R/R8 V 3R9 llltRR: V 3R; llltRR< V 3R= llltR7R/R> V 3R? llltRR@ V 3RA llltRRB V 3RC llltR7R/RD V 3RE llltRRF V 3RG llltRRH V 3RI llltR7R/RJ V 3RK llltRRL V 3RM llltRRN V 3RO lllt ]!RRRR7RRPR/RQ RR lll4       t"]!RRRR7R/RS RT lll4       t"RRRR7RRPR/RU RV lllt"]!RRR7RRPR/RW RX ll4       t#]!RRR7R/RY RZ ll4       t#RRR7RRPR/R[ R\ llt#]!RRRR7RRPR/R] R^ lll4       t$]!RRRR7R/R_ R` lll4       t$RRRR7RRPR/Ra Rb lllt$Rc Rd lt%RRe Rf llt&]!RgRRRRhRRiRRRRjRRk]'RlRRmRRnRRoRRpRRqRRR/Rr Rs ll4       t(]!RRgRRRRhRRiRRRRjRRk]'RlRRmRRnRRoRRpRRqRRR/Rt Ru lll4       t(RRgRRRRhRRiRRRRjRRk]'RlRRmRRnRRoRRpRRqRRR/Rv Rw lllt(Rx Ry lt)Rz R{ lt*RgRRRRhRRiRRRR|RRjRRlRRnRRoRRpRRR/R} R~ llt+R R lt,]!RgRRRRhRRiRRRRjRRnRRpRRR/	R R ll4       t-]!RRgRRRRhRRiRRRRjRRnRRpRRR/	R R lll4       t-RRgRRRRhRRiRRRRjRRnRRpRRR/	R R lllt-RR R llt.RR R llt/]0RR R ll4       t1]0RR R ll4       t2]0R R l4       t3]0RR R ll4       t4Rt5V ;t6# )FastMCPNversionwebsite_urliconsauth
middleware	providers
transformslifespantoolson_duplicatemask_error_detailsdereference_schemasTstrict_input_validationlist_page_sizetaskssession_state_storesampling_handlersampling_handler_behaviorc          *     l    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RR R!R"R#R$R%/# )&rn   name
str | Noneinstructionsr   r   r   list[mcp.types.Icon] | Noner   zAuthProvider | Noner   zSequence[Middleware] | Noner   zSequence[Provider] | Noner   zSequence[Transform] | Noner   z"LifespanCallable | Lifespan | Noner   z*Sequence[Tool | Callable[..., Any]] | Noner   zDuplicateBehavior | Noner   bool | Noner   boolr   r   z
int | Noner   r   zAsyncKeyValue | Noner   zSamplingHandler | Noner   z$Literal['always', 'fallback'] | Nonero   r   rs   )rt   s   "ru   rv   FastMCP.__annotate__   s     @
 @
@
 !@

 @
  @
 +@
 "@
 0@
 -@
 /@
 5@
 :@
 /@
 (@
  "!@
" "-#@
$ #%@
& '@
( 2)@
* 1+@
, $H-@
. /@
rw   c               	  < \        V4       \        SV `	  4        T;'       g    R V n        Ve   TMRV n        RV n        RV n        . V n        T;'       g    \        4       V n	        \        \        ,          ! V P                  \        RR7      V n        \        V P                  R7      V n        V P                  V P                  4       T;'       g    .  F  pV P                  V4       K  	  T	;'       g    .  F  pV P!                  V4       K  	  Ve   TM\"        P$                  P&                  V n        Ve   V^ 8:  d   \+        R4      hVV n        V
e"   \/        \0        \2        ,          V
4      V n        M$\/        \0        \2        ,          \6        4      V n        RV n        RV n        \<        P>                  ! 4       V n         \B        \2        ,          ! T T;'       g    V PE                  4       T;'       g    \"        PF                  VVV\I        V R7      R7      V n%        W`n&        V'       dG   V F@  p\O        V\P        4      '       g   \P        PR                  ! V4      pV PU                  V4       KB  	  Ve   TM\"        P$                  PV                  V n+        \Y        T;'       g    . 4      V n-        V'       d'   ^ R	I.H/p V PZ                  Pa                  V! 4       4       V Pc                  4        VV n2        T;'       g    R
V n3        R# )warnNFfastmcp_state)	key_valuepydantic_modeldefault_collection)r   z)list_page_size must be a positive integer)r   )fastmcpr   r   r   r   r   r   )DereferenceRefsMiddlewarefallback)4r   super__init___on_duplicate_support_tasks_by_default_docket_worker_additional_http_routesr   _state_storager   r   _state_storer;   _local_provideradd_provideradd_transformr   settingsr   _mask_error_details
ValueError_list_page_sizer   LifespanCallabler   r   r   r   r   asyncioEvent_startedr5   generate_name__version__r   _mcp_serverr   
isinstancerG   from_functionadd_toolr   listr   %fastmcp.server.middleware.dereferencer   append_setup_handlersr   r   )selfr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   ro   pttoolr   	__class__s   &&&$$$$$$$$$$$$$$$$$$,    ru   r   FastMCP.__init__   s   2 	f% 	7C7M7Mv 9>8Iuu& 8:$ .A-Q-QKM9H9T))%.:
 /<++/
 	$../bAa  ! !!r!Aq! " "- !!44 	  %.A*=HII+9 @D 18ADN ""2?"CEUVDN8<*/!'.}} BPB
 --++-22w22%#$D9
B
 *.	!$----d3Dd#  '2 $!!99 	$ -11A1Ar,B OO""#<#>? 	8H%33 	&rw   c                   V ^8  d   QhRR/# rn   rq   strrs   )rt   s   "ru   rv   r   ]  s     7 7# 7rw   c                	N    \        V 4      P                   R V P                  : R2# )())typer   r   r   s   &ru   __repr__FastMCP.__repr__]  s$    t*%%&a		}A66rw   c                   V ^8  d   QhRR/# r   rs   )rt   s   "ru   rv   r   a  s     % %c %rw   c                	.    V P                   P                  # rz   )r   r   r   s   &ru   r   FastMCP.name`  s    $$$rw   c                   V ^8  d   QhRR/# rn   rq   r   rs   )rt   s   "ru   rv   r   e  s     - -j -rw   c                	.    V P                   P                  # rz   r   r   r   s   &ru   r   FastMCP.instructionsd  s    ,,,rw   c                    V ^8  d   QhRRRR/# )rn   r   r   rq   rr   rs   )rt   s   "ru   rv   r   i  s     . .* . .rw   c                	&    WP                   n        R # rz   r  )r   r   s   &&ru   r   r  h  s    (-%rw   c                   V ^8  d   QhRR/# r  rs   )rt   s   "ru   rv   r   m  s     ( ( (rw   c                	.    V P                   P                  # rz   )r   r   r   s   &ru   r   FastMCP.versionl  s    '''rw   c                   V ^8  d   QhRR/# r  rs   )rt   s   "ru   rv   r   q  s     , ,Z ,rw   c                	.    V P                   P                  # rz   )r   r   r   s   &ru   r   FastMCP.website_urlp  s    +++rw   c                   V ^8  d   QhRR/# )rn   rq   zlist[mcp.types.Icon]rs   )rt   s   "ru   rv   r   u  s     0 0+ 0rw   c                	t    V P                   P                  f   . # \        V P                   P                  4      # rz   )r   r   r   r   s   &ru   r   FastMCP.iconst  s0    !!)I((..//rw   c                   V ^8  d   QhRR/# )rn   rq   r;   rs   )rt   s   "ru   rv   r   |  s     	$ 	$ 	$rw   c                    V P                   # )a  The server's local provider, which stores directly-registered components.

Use this to remove components:

    mcp.local_provider.remove_tool("my_tool")
    mcp.local_provider.remove_resource("data://info")
    mcp.local_provider.remove_prompt("my_prompt")
)r   r   s   &ru   local_providerFastMCP.local_provider{  s     ###rw   c               $    V ^8  d   QhRRRRRR/# )rn   contextzMiddlewareContext[Any]	call_nextz2Callable[[MiddlewareContext[Any]], Awaitable[Any]]rq   r   rs   )rt   s   "ru   rv   r     s)     	$ 	$'	$ F	$ 
		$rw   c                   "   Tp\        V P                  4       F  p\        WCR7      pK  	  V! V4      G Rj  xL
 #  L5i)z)Builds and executes the middleware chain.)r  N)reversedr   r
   )r   r  r  chainmws   &&&  ru   _run_middlewareFastMCP._run_middleware  s9      4??+BB0E ,7^###s   6?=?c                    V ^8  d   QhRRRR/# )rn   r   r6   rq   rr   rs   )rt   s   "ru   rv   r     s     + + + +rw   c                	<    V P                   P                  V4       R # rz   )r   r   )r   r   s   &&ru   add_middlewareFastMCP.add_middleware  s    z*rw   	namespace c               $    V ^8  d   QhRRRRRR/# )rn   providerr<   r"  r   rq   rr   rs   )rt   s   "ru   rv   r     s!     < <X <S <$ <rw   c               (   < \         SV `  WR7       R# )a  Add a provider for dynamic tools, resources, and prompts.

Providers are queried in registration order. The first provider to return
a non-None result wins. Static components (registered via decorators)
always take precedence over providers.

Args:
    provider: A Provider instance that will provide components dynamically.
    namespace: Optional namespace prefix. When set:
        - Tools become "namespace_toolname"
        - Resources become "protocol://namespace/path"
        - Prompts become "namespace_promptname"
r"  N)r   r   )r   r%  r"  r   s   &&$ru   r   FastMCP.add_provider  s     	X;rw   c                   V ^8  d   QhRR/# )rn   rq   zSequence[FastMCPComponent]rs   )rt   s   "ru   rv   r     s     
 
!; 
rw   c                  <"   \        \        SV `	  4       G Rj  xL
 4      pV Uu. uF  p\        V\        4      '       g   K  VNK  	  ppV Uu. uF  p\        V\
        4      '       g   K  VNK  	  ppV Uu. uF  p\        V\        4      '       g   K  VNK  	  ppV Uu. uF  p\        V\        4      '       g   K  VNK  	  ppV P                   Fg  pVP                  V4      G Rj  xL
 pVP                  V4      G Rj  xL
 pVP                  V4      G Rj  xL
 pVP                  V4      G Rj  xL
 pKi  	  . VOVOVOVO#  EL.u upi u upi u upi u upi  Lt L] LF L/5i)zGet task-eligible components with all transforms applied.

Overrides AggregateProvider.get_tasks() to apply server-level transforms
after aggregation. AggregateProvider handles provider-level namespacing.
N)r   r   	get_tasksr   rG   r*   r,   r'   r   
list_toolslist_resourceslist_resource_templateslist_prompts)	r   
componentscr   	resources	templatesprompts	transformr   s	   &       ru   r+  FastMCP.get_tasks  sG      1 334
 '>Jq*Q*=J> *F
1jH.EQQ
	F *N
1j<L.MQQ
	N(BjJq&,A11jB I#..u55E'66yAAI'??	JJI%227;;G	 )


 
 	
 	
 4 ?FNB 6AJ;s   E'EE'EE
E'E-E3E'9EEE'"E?E%E'*E+E'E!E'E#E'5E%6E'E'!E'#E'%E'c                    V ^8  d   QhRRRR/# )rn   r5  rB   rq   rr   rs   )rt   s   "ru   rv   r     s     + +y +T +rw   c                <    V P                   P                  V4       R# )a  Add a server-level transform.

Server-level transforms are applied after all providers are aggregated.
They transform tools, resources, and prompts from ALL providers.

Args:
    transform: The transform to add.

Example:
    ```python
    from fastmcp.server.transforms import Namespace

    server = FastMCP("Server")
    server.add_transform(Namespace("api"))
    # All tools from all providers become "api_toolname"
    ```
N)_transformsr   )r   r5  s   &&ru   r   FastMCP.add_transform  s    $ 		*rw   c               $    V ^8  d   QhRRRRRR/# )rn   	tool_namer   transformationrI   rq   rr   rs   )rt   s   "ru   rv   r     s)     G GG.AG	Grw   c                    \         P                  P                  '       d   \        P                  ! R\
        ^R7       V P                  \        W/4      4       R# )zeAdd a tool transformation.

.. deprecated::
    Use ``add_transform(ToolTransform({...}))`` instead.
zladd_tool_transformation is deprecated. Use server.add_transform(ToolTransform({tool_name: config})) instead.
stacklevelN)r   r   deprecation_warningswarningsr   DeprecationWarningr   rA   )r   r<  r=  s   &&&ru   add_tool_transformationFastMCP.add_tool_transformation  sF     000MMT"	 	=))DEFrw   c                    V ^8  d   QhRRRR/# )rn   
_tool_namer   rq   rr   rs   )rt   s   "ru   rv   r     s      S T rw   c                    \         P                  P                  '       d    \        P                  ! R\
        ^R7       R# R# )zRemove a tool transformation.

.. deprecated::
    Tool transformations are now immutable. Use enable/disable controls instead.
zremove_tool_transformation is deprecated and has no effect. Transforms are immutable once added. Use server.disable(keys=[...]) to hide tools instead.r?  N)r   r   rA  rB  r   rC  )r   rG  s   &&ru   remove_tool_transformation"FastMCP.remove_tool_transformation  s4     000MM) # 1rw   run_middlewarec                    V ^8  d   QhRRRR/# )rn   rK  r   rq   zSequence[Tool]rs   )rt   s   "ru   rv   r     s     % %$ %. %rw   c          
       <a "   \         P                  P                  P                  S R7      ;_uu_4       GRj  xL
 pV'       d`   \	        \
        P                  P                  RR7      RRRVR7      pS P                  VV 3R lR	7      G Rj  xL
 uuRRR4      GRj  xL
  # \        \        S
S `-  4       G Rj  xL
 4      p\        V4      G Rj  xL
 pV Uu. uF  p\        V4      '       g   K  VNK  	  pp\        4       w  rg. pV F^  p	V'       gC   V	P                  e5   \!        WyR
7      p \#        V	P                  V4      G Rj  xL
 '       g   KL   VP'                  V	4       K`  	  TuuRRR4      GRj  xL
  #  ELH L L L Lu upi  LF  \$         d     K  i ; i L)  + GRj  xL 
 '       g   i     R# ; i5i)zList all enabled tools from providers.

Overrides Provider.list_tools() to add visibility filtering, auth filtering,
and middleware execution. Returns all versions (no deduplication).
Protocol handlers deduplicate for MCP wire format.
r   Nz
tools/list)methodclientrequestmessagesourcer   rO  fastmcp_contextc                (   < SP                  R R7      # F)rK  )r,  r  r   s   &ru   <lambda>$FastMCP.list_tools.<locals>.<lambda>  s    dooUo.Srw   r  r  token	component)r   r   r  Contextr7   mcptypesListToolsRequestr  r   r   r,  rC   rD   r   r   r1   r3   r    r   )r   rK  ctx
mw_contextr   r   	skip_authr]  
authorizedr   r   s   f$        ru   r,  FastMCP.list_tools  su     >>))11$1???3.II66l6K#"'$'
 "11&S 2   @?? uw1334E2599E %71AQQE702I%'J TYY%:%EBC!%4TYY%DDD$  E !!$'  = @?? @ 497  E- ! !7 @???s   7GFGAF)FF)G!F"G'F)=F
>F)FF)F5F;7F)3FF
	FF)0G=F'>GF)G
F)F)F)FF$	 F)#F$	$F)'G)G	/F20
G	;G	=	Gc               $    V ^8  d   QhRRRRRR/# rn   r   r   r   VersionSpec | Nonerq   zTool | Noners   )rt   s   "ru   rv   r   #  s$      "4	rw   c                &  <"   \         SV `  W4      G Rj  xL
 pVf   R# \        4       w  rEV'       gE   VP                  e7   \	        WSR7      p \        VP                  V4      G Rj  xL
 '       g   R#  V# V#  Ld L  \         d     R# i ; i5i)a+  Get a tool by name via aggregation from providers.

Extends AggregateProvider._get_tool() with component-level auth checks.

Args:
    name: The tool name.
    version: Version filter (None returns highest version).

Returns:
    The tool if found and authorized, None if not found or unauthorized.
Nr\  )r   	_get_toolr   r   r1   r3   r    )r   r   r   r   re  r]  rc  r   s   &&&    ru   rl  FastMCP._get_tool#  s      W&t55< -.	TYY2E:C,TYY<<< =
 t 6 =% E   BA;8BA? )A=*	A? 4B=A? ?B
BBBc               $    V ^8  d   QhRRRRRR/# ri  rs   )rt   s   "ru   rv   r   B  s$      "4	rw   c                   <"   \         SV `  W4      G Rj  xL
 pVf   R# \        V.4      G Rj  xL
 pV'       d   \        V^ ,          4      '       g   R# V^ ,          #  LI L15i)a  Get a tool by name, filtering disabled tools.

Overrides Provider.get_tool() to add visibility filtering after all
transforms (including session-level) have been applied. This ensures
session transforms can override provider-level disables.

Args:
    name: The tool name.
    version: Version filter (None returns highest version).

Returns:
    The tool if found and enabled, None otherwise.
N)r   get_toolrC   rD   )r   r   r   r   r   r   s   &&&  ru   rq  FastMCP.get_toolB  sZ       W%d44< /v66JuQx00Qx 5
 7$   A$A A$A"A$$A$"A$c                    V ^8  d   QhRRRR/# )rn   rK  r   rq   zSequence[Resource]rs   )rt   s   "ru   rv   r   \  s     ' '!%'	'rw   c          
     T  <a "   \         P                  P                  P                  S R7      ;_uu_4       GRj  xL
 pV'       dB   \	        / RRRVR7      pS P                  VV 3R lR7      G Rj  xL
 uuRRR4      GRj  xL
  # \        \        S
S `!  4       G Rj  xL
 4      p\        V4      G Rj  xL
 pV Uu. uF  p\        V4      '       g   K  VNK  	  pp\        4       w  rg. pV F^  p	V'       gC   V	P                  e5   \        WyR	7      p \        V	P                  V4      G Rj  xL
 '       g   KL   VP!                  V	4       K`  	  TuuRRR4      GRj  xL
  #  EL* L L L Lu upi  LF  \         d     K  i ; i L)  + GRj  xL 
 '       g   i     R# ; i5i)
zList all enabled resources from providers.

Overrides Provider.list_resources() to add visibility filtering, auth filtering,
and middleware execution. Returns all versions (no deduplication).
Protocol handlers deduplicate for MCP wire format.
rN  NrP  rQ  zresources/listrR  c                (   < SP                  R R7      # rW  )r-  rX  s   &ru   rY  (FastMCP.list_resources.<locals>.<lambda>p  s    d.A.AQV.A.Wrw   r[  r\  )r   r   r  r_  r7   r  r   r   r-  rC   rD   r   r   r1   r3   r    r   )r   rK  rc  rd  r2  rre  r]  rf  resourcer   s   f$        ru   r-  FastMCP.list_resources\  sc     >>))11$1???3.#"+$'
 "11&W 2   @?? 57#9#;;<I6yAAI$-?IqAII?02I)+J% X]]%>%EFC!%4X]]C%HHH$  I !!(+ & = @?? @ <A?  I- ! !7 @???   7F(E%F(3F2E(3F6F(E*F(	FE, F6E.7F?E0E07FE7.E5
/	E79FF(F	 F((F*F(,F.F0F5E77F	FF	F	F(F%	F
F%	F%		F(c               $    V ^8  d   QhRRRRRR/# rn   urir   r   rj  rq   zResource | Noners   )rt   s   "ru   rv   r     s$      !3	rw   c                &  <"   \         SV `  W4      G Rj  xL
 pVf   R# \        4       w  rEV'       gE   VP                  e7   \	        WSR7      p \        VP                  V4      G Rj  xL
 '       g   R#  V# V#  Ld L  \         d     R# i ; i5i)a8  Get a resource by URI via aggregation from providers.

Extends AggregateProvider._get_resource() with component-level auth checks.

Args:
    uri: The resource URI.
    version: Version filter (None returns highest version).

Returns:
    The resource if found and authorized, None if not found or unauthorized.
Nr\  )r   _get_resourcer   r   r1   r3   r    )r   r~  r   ry  re  r]  rc  r   s   &&&    ru   r  FastMCP._get_resource  s      .s<< -.	X]]6E>C,X]]C@@@ A
 x = A% rn  c               $    V ^8  d   QhRRRRRR/# r}  rs   )rt   s   "ru   rv   r     s$      !3	rw   c                   <"   \         SV `  W4      G Rj  xL
 pVf   R# \        V.4      G Rj  xL
 pV'       d   \        V^ ,          4      '       g   R# V^ ,          #  LI L15i)aU  Get a resource by URI, filtering disabled resources.

Overrides Provider.get_resource() to add visibility filtering after all
transforms (including session-level) have been applied.

Args:
    uri: The resource URI.
    version: Version filter (None returns highest version).

Returns:
    The resource if found and enabled, None otherwise.
N)r   get_resourcerC   rD   )r   r~  r   ry  r2  r   s   &&&  ru   r  FastMCP.get_resource  s\      -c;; 3H:>>	
9Q< 8 8| <
 ?rs  c                    V ^8  d   QhRRRR/# )rn   rK  r   rq   zSequence[ResourceTemplate]rs   )rt   s   "ru   rv   r     s     ) )!%)	#)rw   c          
     T  <a "   \         P                  P                  P                  S R7      ;_uu_4       GRj  xL
 pV'       dB   \	        / RRRVR7      pS P                  VV 3R lR7      G Rj  xL
 uuRRR4      GRj  xL
  # \        \        S
S `!  4       G Rj  xL
 4      p\        V4      G Rj  xL
 pV Uu. uF  p\        V4      '       g   K  VNK  	  pp\        4       w  rg. pV F^  p	V'       gC   V	P                  e5   \        WyR	7      p \        V	P                  V4      G Rj  xL
 '       g   KL   VP!                  V	4       K`  	  TuuRRR4      GRj  xL
  #  EL* L L L Lu upi  LF  \         d     K  i ; i L)  + GRj  xL 
 '       g   i     R# ; i5i)
a  List all enabled resource templates from providers.

Overrides Provider.list_resource_templates() to add visibility filtering,
auth filtering, and middleware execution. Returns all versions (no deduplication).
Protocol handlers deduplicate for MCP wire format.
rN  NrP  rQ  zresources/templates/listrR  c                (   < SP                  R R7      # rW  )r.  rX  s   &ru   rY  1FastMCP.list_resource_templates.<locals>.<lambda>  s    d.J.J', /K /rw   r[  r\  )r   r   r  r_  r7   r  r   r   r.  rC   rD   r   r   r1   r3   r    r   )r   rK  rc  rd  r3  r   re  r]  rf  templater   s   f$        ru   r.  FastMCP.list_resource_templates  sg     >>))11$1???3.#"5$'
 "11& 2   @??" 57#B#DDEI6yAAI$-?IqAII?02I13J% X]]%>%EFC!%4X]]C%HHH$  I !!(+ & A @?? @" EA?  I- ! !; @???r{  c               $    V ^8  d   QhRRRRRR/# rn   r~  r   r   rj  rq   zResourceTemplate | Noners   )rt   s   "ru   rv   r     s$      !3	 rw   c                &  <"   \         SV `  W4      G Rj  xL
 pVf   R# \        4       w  rEV'       gE   VP                  e7   \	        WSR7      p \        VP                  V4      G Rj  xL
 '       g   R#  V# V#  Ld L  \         d     R# i ; i5i)aS  Get a resource template by URI via aggregation from providers.

Extends AggregateProvider._get_resource_template() with component-level auth checks.

Args:
    uri: The template URI to match.
    version: Version filter (None returns highest version).

Returns:
    The template if found and authorized, None if not found or unauthorized.
Nr\  )r   _get_resource_templater   r   r1   r3   r    )r   r~  r   r  re  r]  rc  r   s   &&&    ru   r  FastMCP._get_resource_template  s      7EE -.	X]]6E>C,X]]C@@@ A
 x F A% rn  c               $    V ^8  d   QhRRRRRR/# r  rs   )rt   s   "ru   rv   r     s$      !3	 rw   c                   <"   \         SV `  W4      G Rj  xL
 pVf   R# \        V.4      G Rj  xL
 pV'       d   \        V^ ,          4      '       g   R# V^ ,          #  LI L15i)ag  Get a resource template by URI, filtering disabled templates.

Overrides Provider.get_resource_template() to add visibility filtering after
all transforms (including session-level) have been applied.

Args:
    uri: The template URI.
    version: Version filter (None returns highest version).

Returns:
    The template if found and enabled, None otherwise.
N)r   get_resource_templaterC   rD   )r   r~  r   r  r3  r   s   &&&  ru   r  FastMCP.get_resource_template  s]      6sDD 3H:>>	
9Q< 8 8| E
 ?rs  c                    V ^8  d   QhRRRR/# )rn   rK  r   rq   zSequence[Prompt]rs   )rt   s   "ru   rv   r      s     % %D %DT %rw   c          
     T  <a "   \         P                  P                  P                  S R7      ;_uu_4       GRj  xL
 pV'       dB   \	        / RRRVR7      pS P                  VV 3R lR7      G Rj  xL
 uuRRR4      GRj  xL
  # \        \        S
S `!  4       G Rj  xL
 4      p\        V4      G Rj  xL
 pV Uu. uF  p\        V4      '       g   K  VNK  	  pp\        4       w  rg. pV F^  p	V'       gC   V	P                  e5   \        WyR	7      p \        V	P                  V4      G Rj  xL
 '       g   KL   VP!                  V	4       K`  	  TuuRRR4      GRj  xL
  #  EL* L L L Lu upi  LF  \         d     K  i ; i L)  + GRj  xL 
 '       g   i     R# ; i5i)
zList all enabled prompts from providers.

Overrides Provider.list_prompts() to add visibility filtering, auth filtering,
and middleware execution. Returns all versions (no deduplication).
Protocol handlers deduplicate for MCP wire format.
rN  NrP  rQ  zprompts/listrR  c                (   < SP                  R R7      # rW  )r/  rX  s   &ru   rY  &FastMCP.list_prompts.<locals>.<lambda>2  s    d.?.?u.?.Urw   r[  r\  )r   r   r  r_  r7   r  r   r   r/  rC   rD   r   r   r1   r3   r    r   )r   rK  rc  rd  r4  r   re  r]  rf  promptr   s   f$        ru   r/  FastMCP.list_prompts   sc     >>))11$1???3.#")$'
 "11&U 2   @?? !5!778G4W==G");'QZ]qq'G;02I')J! V[[%<%EDC!%4V[[#%FFF$  G !!&) " = @?? @ 8=;  G- ! !7 @???r{  c               $    V ^8  d   QhRRRRRR/# rn   r   r   r   rj  rq   zPrompt | Noners   )rt   s   "ru   rv   r   G  s$      "4	rw   c                &  <"   \         SV `  W4      G Rj  xL
 pVf   R# \        4       w  rEV'       gE   VP                  e7   \	        WSR7      p \        VP                  V4      G Rj  xL
 '       g   R#  V# V#  Ld L  \         d     R# i ; i5i)a3  Get a prompt by name via aggregation from providers.

Extends AggregateProvider._get_prompt() with component-level auth checks.

Args:
    name: The prompt name.
    version: Version filter (None returns highest version).

Returns:
    The prompt if found and authorized, None if not found or unauthorized.
Nr\  )r   _get_promptr   r   r1   r3   r    )r   r   r   r  re  r]  rc  r   s   &&&    ru   r  FastMCP._get_promptG  s      w*499> -.	V[[4E<C,V[[#>>> ?
 v : ?% rn  c               $    V ^8  d   QhRRRRRR/# r  rs   )rt   s   "ru   rv   r   f  s$      "4	rw   c                   <"   \         SV `  W4      G Rj  xL
 pVf   R# \        V.4      G Rj  xL
 pV'       d   \        V^ ,          4      '       g   R# V^ ,          #  LI L15i)aN  Get a prompt by name, filtering disabled prompts.

Overrides Provider.get_prompt() to add visibility filtering after all
transforms (including session-level) have been applied.

Args:
    name: The prompt name.
    version: Version filter (None returns highest version).

Returns:
    The prompt if found and enabled, None otherwise.
N)r   
get_promptrC   rD   )r   r   r   r  r4  r   s   &&&  ru   r  FastMCP.get_promptf  s[      w)$88> 1&::j44qz 9
 ;rs  	task_metac               0    V ^8  d   QhRRRRRRRRR	R
RR/# )rn   r   r   	argumentsdict[str, Any] | Noner   rj  rK  r   r  rr   rq   rH   rs   )rt   s   "ru   rv   r     sF       )
 $   
rw   c               	   "   R # 5irz   rs   r   r   r  r   rK  r  s   &&&$$$ru   	call_toolFastMCP.call_tool  s
         c               0    V ^8  d   QhRRRRRRRRR	R
RR/# rn   r   r   r  r  r   rj  rK  r   r  r?   rq   mcp.types.CreateTaskResultrs   )rt   s   "ru   rv   r     F     ) )) ))
 $) ) ) 
$)rw   c               	   "   R # 5irz   rs   r  s   &&&$$$ru   r  r    
      &)r  c               0    V ^8  d   QhRRRRRRRRR	R
RR/# )rn   r   r   r  r  r   rj  rK  r   r  TaskMeta | Nonerq   z'ToolResult | mcp.types.CreateTaskResultrs   )rt   s   "ru   rv   r     sV     ]P ]P]P )]P
 $]P ]P #]P 
1]Prw   c               "  a aa"   \         P                  P                  P                  S R7      ;_uu_4       GRj  xL
 pV'       dx   \        \
        ,          ! \        P                  P                  Y;'       g    / R7      RRRVR7      pS P                  VV VV3R lR	7      G Rj  xL
 uuRRR4      GRj  xL
  # \        R
V 2RS P                  RV4      ;_uu_ 4       pS P                  VSR7      G Rj  xL
 p	V	f   \        RV: 24      hVP                  V	P                  4       4       Se&   SP                  f   \!        SV	P"                  R7      o T	P%                  T;'       g    / SR7      G Rj  xL
 uuRRR4       uuRRR4      GRj  xL
  #  ELa L L L L) L  \&         d    \(        P+                  RT: 24       h \,        \.        3 d    \(        P+                  RT: 24       h \0         d   p
\(        P+                  RT: 24       \3        T
\4        P6                  4      '       d(   T
P8                  P:                  R8X  d   \=        R4      T
h\3        T
\4        P>                  4      '       d   \=        R4      T
hS P@                  '       d   \=        RT: 24      T
h\=        RT: RT
 24      T
hRp
?
ii ; i  + '       g   i     M; iRRR4      GRj  xL 
  R#   + GRj  xL 
 '       g   i     R# ; i5i)a  Call a tool by name.

This is the public API for executing tools. By default, middleware is applied.

Args:
    name: The tool name
    arguments: Tool arguments (optional)
    version: Specific version to call. If None, calls highest version.
    run_middleware: If True (default), apply the middleware chain.
        Set to False when called from middleware to avoid re-applying.
    task_meta: If provided, execute as a background task and return
        CreateTaskResult. If None (default), execute synchronously and
        return ToolResult.

Returns:
    ToolResult when task_meta is None.
    CreateTaskResult when task_meta is provided.

Raises:
    NotFoundError: If tool not found or disabled
    ToolError: If tool execution fails
    ValidationError: If arguments fail validation
rN  Nr   r  rP  rQ  z
tools/callrR  c                   < SP                  V P                  P                  V P                  P                  ;'       g    / SR SR7      # F)r   rK  r  )r  rS  r   r  r  r   r  r   s   &ru   rY  #FastMCP.call_tool.<locals>.<lambda>  s>    dnn,,1177R '',"+ /= /rw   r[  ztools/call r   r   zUnknown tool: fn_keyr  zError calling tool zError validating tool   0Rate limited by upstream API, please retry later(Upstream request timed out, please retry: )!r   r   r  r_  r7   r   r`  ra  r  r@   r   rq  r"   set_attributesget_span_attributesr  r	   r   _runr!   logger	exceptionr   PydanticValidationError	Exceptionr   httpxHTTPStatusErrorresponsestatus_coder%   TimeoutExceptionr   )r   r   r  r   rK  r  rc  rd  spanr   es   f&&d$d     ru   r  r    s    H >>))11$1???3./DEII;;!__" <  $"'$'
 "11& 2 	 	 @??0 dV$lDIIvt !]]4]AA<'.(ABB##D$<$<$>?(Y-=-=-E '	$(( CIP!%9??i!PP 1 @??	 @6 B QE @F $ $$':4(%CD')@A $$'=dX%FG  P$$':4(%CD "!U%:%:;;::11S8"+ R##$% "!U%;%;<<'F ! ///'*=dX(FGQN#&9$A3$GHaO!P# 1 @?????s  7LFL ;K2<-K2)F *K2-L:F";L $K2$K	;F$<AK	F*0F*<F&=F* 
K2
LF(L K2"L$K	&F*(L*3K	#K	K	BK!#KK		K	KK2L*K-+L2L	8K;9
L	L		Lc          
     ,    V ^8  d   QhRRRRRRRRR	R
/# )rn   r~  r   r   rj  rK  r   r  rr   rq   r+   rs   )rt   s   "ru   rv   r     s<       $	
   
rw   c               	   "   R # 5irz   rs   r   r~  r   rK  r  s   &&$$$ru   read_resourceFastMCP.read_resource  s
      r  c          
     ,    V ^8  d   QhRRRRRRRRR	R
/# )rn   r~  r   r   rj  rK  r   r  r?   rq   r  rs   )rt   s   "ru   rv   r     s<     ) )) $	)
 ) ) 
$)rw   c               	   "   R # 5irz   rs   r  s   &&$$$ru   r  r    s
      &)r  c          
     ,    V ^8  d   QhRRRRRRRRR	R
/# )rn   r~  r   r   rj  rK  r   r  r  rq   z+ResourceResult | mcp.types.CreateTaskResultrs   )rt   s   "ru   rv   r     sJ     CW CWCW $	CW
 CW #CW 
5CWrw   c               b	  a aa"   \         P                  P                  P                  S R7      ;_uu_4       GRj  xL
 pV'       dm   \	        V4      p\        \        P                  P                  VR7      RRRVR7      pS P                  VV VV3R lR	7      G Rj  xL
 uuRRR4      GRj  xL
  # \        R
V 2RS P                  RVVR7      ;_uu_ 4       pS P                  VSR7      G Rj  xL
 p	V	e   VP                  V	P                  4       4       Se&   SP                  f   \!        SV	P"                  R7      o V	P%                  SR7      G Rj  xL
 uuRRR4       uuRRR4      GRj  xL
  # S PA                  VSR7      G Rj  xL
 pVf'   Sf   \C        RV: 24      h\C        RV: RS: 24      hVP                  VP                  4       4       VPE                  V4      pVf   Q hSe&   SP                  f   \!        SVP"                  R7      o VP%                  WSR7      G Rj  xL
 uuRRR4       uuRRR4      GRj  xL
  #  EL EL EL ELm EL	 L  \&        \(        3 d    \*        P-                  RT: 24       h \.         d   p
\*        P-                  RT: 24       \1        T
\2        P4                  4      '       d(   T
P6                  P8                  R8X  d   \;        R4      T
h\1        T
\2        P<                  4      '       d   \;        R4      T
hS P>                  '       d   \;        RT: 24      T
h\;        RT: RT
 24      T
hRp
?
ii ; i EL EL3 EL  \&        \(        3 d    \*        P-                  RT: 24       h \.         d   p
\*        P-                  RT: 24       \1        T
\2        P4                  4      '       d(   T
P6                  P8                  R8X  d   \;        R4      T
h\1        T
\2        P<                  4      '       d   \;        R4      T
hS P>                  '       d   \;        RT: 24      T
h\;        RT: RT
 24      T
hRp
?
ii ; i  + '       g   i     M; iRRR4      GRj  xL 
  R#   + GRj  xL 
 '       g   i     R# ; i5i)a  Read a resource by URI.

This is the public API for reading resources. By default, middleware is applied.
Checks concrete resources first, then templates.

Args:
    uri: The resource URI
    version: Specific version to read. If None, reads highest version.
    run_middleware: If True (default), apply the middleware chain.
        Set to False when called from middleware to avoid re-applying.
    task_meta: If provided, execute as a background task and return
        CreateTaskResult. If None (default), execute synchronously and
        return ResourceResult.

Returns:
    ResourceResult when task_meta is None.
    CreateTaskResult when task_meta is provided.

Raises:
    NotFoundError: If resource not found or disabled
    ResourceError: If resource read fails
rN  N)r~  rP  rQ  zresources/readrR  c                h   < SP                  \        V P                  P                  4      SR SR7      # r  )r  r   rS  r~  r  s   &ru   rY  'FastMCP.read_resource.<locals>.<lambda>9  s1    d.@.@GOO//0 '',"+	 /A /rw   r[  zresources/read ry  )resource_urir  r  r  zError reading resource r  r  r  r  zUnknown resource: 	 version )#r   r   r  r_  r   r7   r`  ra  ReadResourceRequestParamsr  r@   r   r  r  r  r  r	   r   _readr!   r   r  r  r  r   r  r  r  r  r$   r  r   r  r"   matches)r   r~  r   rK  r  rc  	uri_paramrd  r  ry  r  r  paramss   f&d$d        ru   r  r    s\    J >>))11$1???3"3K	.II??I?N#"+$'
 "11& 2   @??* !#' 		   !%!2!23!2!HH'''(D(D(FG ,1A1A1I$+Ihll$K	!%-^^i^%HH + @??| "&!;!;C!;!QQ#+.@,HII',SG9WKH  ##H$@$@$BC!))#.)))(Y-=-=-E '	(,, GIW!)y!QQm + @?? @< I  II @J )(3 ((+B3')JK$ !((+B3')JK%a)>)>?? zz55<&3$V'"'(!) &a)?)?@@"/ J##$%  333"/"9# A##$% ,5cWBqcB !#!, R RW @X %h/ $$'>sg%FG  W$$'>sg%FG!!U%:%:;;::11S8"/ R##$% "!U%;%;<<+F ! ///+.EcW,MNTUU'*A#1#(NOUVVWu + @?????sd  7R/IR/ ARIR"R//I0R/5&RQ,	2I3AQ,	I'I"I'
R'R/4I%5R/:Q,	M%BQ,	M.5M(6M.9
RR/M+R/RR/Q,	"I'%R/'3M"M"BM:#MM""Q,	(M.+R/.3Q)"Q)#BQ$#Q$$Q))Q,	,Q<7R?R/
RR/R,	R
R,	$R,	&	R/c               0    V ^8  d   QhRRRRRRRRR	R
RR/# )rn   r   r   r  r  r   rj  rK  r   r  rr   rq   r)   rs   )rt   s   "ru   rv   r     sF       )
 $   
rw   c               	   "   R # 5irz   rs   r  s   &&&$$$ru   render_promptFastMCP.render_prompt  s
      r  c               0    V ^8  d   QhRRRRRRRRR	R
RR/# r  rs   )rt   s   "ru   rv   r     r  rw   c               	   "   R # 5irz   rs   r  s   &&&$$$ru   r  r    r  r  c               0    V ^8  d   QhRRRRRRRRR	R
RR/# )rn   r   r   r  r  r   rj  rK  r   r  r  rq   z)PromptResult | mcp.types.CreateTaskResultrs   )rt   s   "ru   rv   r     sV     JV JVJV )JV
 $JV JV #JV 
3JVrw   c                 a aa"   \         P                  P                  P                  S R7      ;_uu_4       GRj  xL
 pV'       db   \	        \
        P                  P                  WR7      RRRVR7      pS P                  VV VV3R lR	7      G Rj  xL
 uuRRR4      GRj  xL
  # \        R
V 2RS P                  RV4      ;_uu_ 4       pS P                  VSR7      G Rj  xL
 p	V	f   \        RV: 24      hVP                  V	P                  4       4       Se&   SP                  f   \!        SV	P"                  R7      o V	P%                  VSR7      G Rj  xL
 uuRRR4       uuRRR4      GRj  xL
  #  ELA L L L L) L  \&        \(        3 d    \*        P-                  RT: 24       h \.         dT   p
\*        P-                  RT: 24       S P0                  '       d   \3        RT: 24      T
h\3        RT: RT
 24      T
hRp
?
ii ; i  + '       g   i     M; iRRR4      GRj  xL 
  R#   + GRj  xL 
 '       g   i     R# ; i5i)aE  Render a prompt by name.

This is the public API for rendering prompts. By default, middleware is applied.
Use get_prompt() to retrieve the prompt definition without rendering.

Args:
    name: The prompt name
    arguments: Prompt arguments (optional)
    version: Specific version to render. If None, renders highest version.
    run_middleware: If True (default), apply the middleware chain.
        Set to False when called from middleware to avoid re-applying.
    task_meta: If provided, execute as a background task and return
        CreateTaskResult. If None (default), execute synchronously and
        return PromptResult.

Returns:
    PromptResult when task_meta is None.
    CreateTaskResult when task_meta is provided.

Raises:
    NotFoundError: If prompt not found or disabled
    PromptError: If prompt rendering fails
rN  Nr  rP  rQ  zprompts/getrR  c                   < SP                  V P                  P                  V P                  P                  SR SR7      # r  )r  rS  r   r  r  s   &ru   rY  'FastMCP.render_prompt.<locals>.<lambda>  s9    d.@.@,,11 '',"+ /A /rw   r[  zprompts/get r  r  zUnknown prompt: r  r  zError rendering prompt r  )r   r   r  r_  r7   r`  ra  GetPromptRequestParamsr  r@   r   r  r"   r  r  r  r	   r   _renderr!   r   r  r  r  r   r#   )r   r   r  r   rK  r  rc  rd  r  r  r  s   f&&d$d     ru   r  r    s    @ >>))11$1???3.II<<! =  $"($'
 "11& 2 	 	 @??0 tf%}dii4 #tWEE>'*:4((CDD##F$>$>$@A(Y-=-=-E '	&** EI	V!'	Y!OO 1 @??	 @6 F PE @F %h/ $$'>th%GH  V$$'>th%GH///),CD8*LMSTT%(?xr!&MNTUU	V 1 @?????s   7IE=I AH;F H;I$F%I*$H;H	%F&AH	F
FF
 
H;*I7F8I H;IH	F
I
3H>H?AHHH	H% H;(I3H64I;I	I
I	I		Ic                    V ^8  d   QhRRRR/# )rn   r   zTool | Callable[..., Any]rq   rG   rs   )rt   s   "ru   rv   r     s     3 36 34 3rw   c                8    V P                   P                  V4      # )a<  Add a tool to the server.

The tool function can optionally request a Context object by adding a parameter
with the Context type annotation. See the @tool decorator for examples.

Args:
    tool: The Tool instance or @tool-decorated function to register

Returns:
    The tool instance that was added to the server.
)r   r   )r   r   s   &&ru   r   FastMCP.add_tool  s     ##,,T22rw   c               $    V ^8  d   QhRRRRRR/# )rn   r   r   r   r   rq   rr   rs   )rt   s   "ru   rv   r     s!       j D rw   c                *   \         P                  P                  '       d   \        P                  ! R\
        ^R7        V P                  P                  W4       R#   \         d,    Tf   \        RT: R24      Rh\        RT: RT: R24      Rhi ; i)a+  Remove tool(s) from the server.

.. deprecated::
    Use ``mcp.local_provider.remove_tool(name)`` instead.

Args:
    name: The name of the tool to remove.
    version: If None, removes ALL versions. If specified, removes only that version.

Raises:
    NotFoundError: If no matching tool is found.
zNremove_tool() is deprecated. Use mcp.local_provider.remove_tool(name) instead.r?  NzTool z
 not foundr  )
r   r   rA  rB  r   rC  r   remove_toolKeyErrorr"   )r   r   r   s   &&&ru   r  FastMCP.remove_tool  s     000MM@"		  ,,T; 	#eD8:$>?TIxy:>	s   A 6Br   titledescriptiontagsoutput_schemar   exclude_argsmetaapptasktimeoutc                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/# )rn   
name_or_fnrZ   r   r   r   str | int | Noner  r  r   r   r  set[str] | Noner  dict[str, Any] | NotSetT | Noner   'ToolAnnotations | dict[str, Any] | Noner  list[str] | Noner  r  r  (AppConfig | dict[str, Any] | bool | Noner  bool | TaskConfig | Noner  float | Noner   "AuthCheck | list[AuthCheck] | Nonerq   rs   )rt   s   "ru   rv   r     s       	
 "    +  7 = ' $ 6 '  !" 1#$ 
%rw   c               	    R # rz   rs   r   r  r   r   r  r  r   r  r  r   r  r  r  r  r  r   s   &&$$$$$$$$$$$$$$ru   r   FastMCP.tool  s    & rw   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/# )rn   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
  rq   Callable[[F], F]rs   )rt   s   "ru   rv   r   0  s       	
 "    +  7 = ' $ 6 '  !" 1#$ 
%rw   c               	    R # rz   rs   r  s   &&$$$$$$$$$$$$$$ru   r   r  /  s    & rw   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/# )rn   r  str | AnyFunction | Noner   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
  rq   ztCallable[[AnyFunction], FunctionTool] | FunctionTool | partial[Callable[[AnyFunction], FunctionTool] | FunctionTool]rs   )rt   s   "ru   rv   r   D  s     a a,a 	a
 "a a  a +a a 7a =a 'a $a 6a 'a  !a" 1#a&	H'arw   c                   Ve6   VRJd0   V'       d   \        V4      M/ pVRJ d   RVR&   M\        V4      VR&   V P                  P                  TTTTTTTTT	T
TVe   TMV P                  VVR7      pV# )a  Decorator to register a tool.

Tools can optionally request a Context object by adding a parameter with the
Context type annotation. The context provides access to MCP capabilities like
logging, progress reporting, and resource access.

This decorator supports multiple calling patterns:
- @server.tool (without parentheses)
- @server.tool (with empty parentheses)
- @server.tool("custom_name") (with name as first argument)
- @server.tool(name="custom_name") (with name as keyword argument)
- server.tool(function, name="custom_name") (direct function call)

Args:
    name_or_fn: Either a function (when used as @tool), a string name, or None
    name: Optional name for the tool (keyword-only, alternative to name_or_fn)
    description: Optional description of what the tool does
    tags: Optional set of tags for categorizing the tool
    output_schema: Optional JSON schema for the tool's output
    annotations: Optional annotations about the tool's behavior
    exclude_args: Optional list of argument names to exclude from the tool schema.
        Deprecated: Use `Depends()` for dependency injection instead.
    meta: Optional meta information about the tool

Examples:
    Register a tool with a custom name:
    ```python
    @server.tool
    def my_tool(x: int) -> str:
        return str(x)

    # Register a tool with a custom name
    @server.tool
    def my_tool(x: int) -> str:
        return str(x)

    @server.tool("custom_name")
    def my_tool(x: int) -> str:
        return str(x)

    @server.tool(name="custom_name")
    def my_tool(x: int) -> str:
        return str(x)

    # Direct function call
    server.tool(my_function, name="custom_name")
    ```
FTui)r   r   r  r  r   r  r  r   r  r  r  r  r   )dictr.   r   r   r   )r   r  r   r   r  r  r   r  r  r   r  r  r  r  r  r   results   &&$$$$$$$$$$$$$$ ru   r   r  D  s    P ?s%/!%4:2Dd{!T
4S9T
 %%**#'#%)t/M/M + 
" rw   c                    V ^8  d   QhRRRR/# )rn   ry  zResource | Callable[..., Any]rq   zResource | ResourceTemplaters   )rt   s   "ru   rv   r     s     ; ;5;	$;rw   c                8    V P                   P                  V4      # )zAdd a resource to the server.

Args:
    resource: A Resource instance or @resource-decorated function to add

Returns:
    The resource instance that was added to the server.
)r   add_resource)r   ry  s   &&ru   r  FastMCP.add_resource  s     ##00::rw   c                    V ^8  d   QhRRRR/# )rn   r  r,   rq   rs   )rt   s   "ru   rv   r     s     	; 	;%5 	;:J 	;rw   c                8    V P                   P                  V4      # )zAdd a resource template to the server.

Args:
    template: A ResourceTemplate instance to add

Returns:
    The template instance that was added to the server.
)r   add_template)r   r  s   &&ru   r  FastMCP.add_template  s     ##00::rw   	mime_typec               P    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/# )rn   r~  r   r   r   r   r  r  r  r   r   r  r  r  r   z#Annotations | dict[str, Any] | Noner  r  r  r  r  r  r   r
  rq   r  rs   )rt   s   "ru   rv   r     s     u uu 	u
 "u u  u +u u u 9u $u 6u 'u 1u  
!urw   c                  \        V\        4      '       g   \        R4      h\        W4      p\        V\        4      '       d3   VP
                  e   \        R4      hVP                  e   \        R4      hVe6   VRJd0   V
'       d   \        V
4      M/ p
VRJ d   RV
R&   M\        V4      V
R&   V P                  P                  TTTTTTTTT	T
Ve   TMV P                  VR7      pV# )aR  Decorator to register a function as a resource.

The function will be called when the resource is read to generate its content.
The function can return:
- str for text content
- bytes for binary content
- other types will be converted to JSON

Resources can optionally request a Context object by adding a parameter with the
Context type annotation. The context provides access to MCP capabilities like
logging, progress reporting, and session information.

If the URI contains parameters (e.g. "resource://{param}") or the function
has parameters, it will be registered as a template resource.

Args:
    uri: URI for the resource (e.g. "resource://my-resource" or "resource://{param}")
    name: Optional name for the resource
    description: Optional description of the resource
    mime_type: Optional MIME type for the resource
    tags: Optional set of tags for categorizing the resource
    annotations: Optional annotations about the resource's behavior
    meta: Optional meta information about the resource

Examples:
    Register a resource with a custom name:
    ```python
    @server.resource("resource://my-resource")
    def get_data() -> str:
        return "Hello, world!"

    @server.resource("resource://my-resource")
    async get_data() -> str:
        data = await fetch_data()
        return f"Hello, world! {data}"

    @server.resource("resource://{city}/weather")
    def get_weather(city: str) -> str:
        return f"Weather for {city}"

    @server.resource("resource://{city}/weather")
    async def get_weather_with_context(city: str, ctx: Context) -> str:
        await ctx.info(f"Fetching weather for {city}")
        return f"Weather for {city}"

    @server.resource("resource://{city}/weather")
    async def get_weather(city: str) -> str:
        data = await fetch_weather(city)
        return f"Weather for {city}: {data}"
    ```
zThe @resource decorator was used incorrectly. It requires a URI as the first argument. Use @resource('uri') instead of @resourceu   resource_uri cannot be set on resources — the resource itself is the UI. Use resource_uri on tools to point to a UI resource.uC   visibility cannot be set on resources — it only applies to tools.FTr  )r   r   r  r  r   r  r  r   r  r  r   )r   r   r   r/   r-   r  r   
visibilityr  r.   r   ry  r   )r   r~  r   r   r  r  r   r  r  r   r  r  r  r   inner_decorators   &&$$$$$$$$$$$$ ru   ry  FastMCP.resource  s	   J #s##<  )8	 c9%%+ K 
 ~~) Y 
 ?s%/!%4:2Dd{!T
4S9T
 ..77##)t/M/M 8 
 rw   c                    V ^8  d   QhRRRR/# )rn   r  zPrompt | Callable[..., Any]rq   r'   rs   )rt   s   "ru   rv   r   6  s     	7 	7!< 	7 	7rw   c                8    V P                   P                  V4      # )zAdd a prompt to the server.

Args:
    prompt: A Prompt instance or @prompt-decorated function to add

Returns:
    The prompt instance that was added to the server.
)r   
add_prompt)r   r  s   &&ru   r'  FastMCP.add_prompt6  s     ##..v66rw   c               D    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/# )rn   r  rZ   r   r   r   r  r  r  r   r   r  r  r  r  r  r  r   r
  rq   rs   )rt   s   "ru   rv   r   B  sx       	
 "    +  $ ' 1 
rw   c       	        	    R # rz   rs   r   r  r   r   r  r  r   r  r  r  r   s   &&$$$$$$$$$ru   r  FastMCP.promptA  s     rw   c               D    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/# )rn   r  r   r   r   r  r  r  r   r   r  r  r  r  r  r  r   r
  rq   r  rs   )rt   s   "ru   rv   r   R  sx       	
 "    +  $ ' 1 
rw   c       	        	    R # rz   rs   r+  s   &&$$$$$$$$$ru   r  r,  Q  s     rw   c               D    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/# )rn   r  r  r   r   r   r  r  r  r   r   r  r  r  r  r  r  r   r
  rq   z|Callable[[AnyFunction], FunctionPrompt] | FunctionPrompt | partial[Callable[[AnyFunction], FunctionPrompt] | FunctionPrompt]rs   )rt   s   "ru   rv   r   a  s     b
 b
,b
 	b

 "b
 b
  b
 +b
 b
 $b
 'b
 1b
	Lb
rw   c       	        x    V P                   P                  TTTTTTTTV	e	   V	V
R7
      # V P                  V
R7
      # )a
  Decorator to register a prompt.

        Prompts can optionally request a Context object by adding a parameter with the
        Context type annotation. The context provides access to MCP capabilities like
        logging, progress reporting, and session information.

        This decorator supports multiple calling patterns:
        - @server.prompt (without parentheses)
        - @server.prompt() (with empty parentheses)
        - @server.prompt("custom_name") (with name as first argument)
        - @server.prompt(name="custom_name") (with name as keyword argument)
        - server.prompt(function, name="custom_name") (direct function call)

        Args:
            name_or_fn: Either a function (when used as @prompt), a string name, or None
            name: Optional name for the prompt (keyword-only, alternative to name_or_fn)
            description: Optional description of what the prompt does
            tags: Optional set of tags for categorizing the prompt
            meta: Optional meta information about the prompt

        Examples:

            ```python
            @server.prompt
            def analyze_table(table_name: str) -> list[Message]:
                schema = read_table_schema(table_name)
                return [
                    {
                        "role": "user",
                        "content": f"Analyze this schema:
{schema}"
                    }
                ]

            @server.prompt()
            async def analyze_with_context(table_name: str, ctx: Context) -> list[Message]:
                await ctx.info(f"Analyzing table {table_name}")
                schema = read_table_schema(table_name)
                return [
                    {
                        "role": "user",
                        "content": f"Analyze this schema:
{schema}"
                    }
                ]

            @server.prompt("custom_name")
            async def analyze_file(path: str) -> list[Message]:
                content = await read_file(path)
                return [
                    {
                        "role": "user",
                        "content": {
                            "type": "resource",
                            "resource": {
                                "uri": f"file://{path}",
                                "text": content
                            }
                        }
                    }
                ]

            @server.prompt(name="custom_name")
            def another_prompt(data: str) -> list[Message]:
                return [{"role": "user", "content": data}]

            # Direct function call
            server.prompt(my_function, name="custom_name")
            ```
        )	r   r   r  r  r   r  r  r  r   )r   r  r   r+  s   &&$$$$$$$$$ru   r  r,  a  sc    n ##**#) + 
 	
 04/M/M + 
 	
rw   c               0    V ^8  d   QhRRRRRRRRR	RR
R/# )rn   r   r   r"  r   as_proxyr   
tool_namesdict[str, str] | Noneprefixrq   rr   rs   )rt   s   "ru   rv   r     sN     \? \?(\? \? 	\?
 *\? \? 
\?rw   c           	        ^ RI p^ RIHp Ve,   VP                  ! R\        ^R7       Vf   TpM\        R4      hVeN   VP                  ! R\        ^R7       V'       d-   ^ RIHp \        W4      '       g   \        P                  V4      pV! V4      p	V'       dI   VP                  4        U
Uu/ uF  w  rV
\        VR7      bK  	  pp
pV	P                  \        V4      4      p	T P                  Y;'       g    R	R
7       R# u upp
i )a  Mount another FastMCP server on this server with an optional namespace.

Unlike importing (with import_server), mounting establishes a dynamic connection
between servers. When a client interacts with a mounted server's objects through
the parent server, requests are forwarded to the mounted server in real-time.
This means changes to the mounted server are immediately reflected when accessed
through the parent.

When a server is mounted with a namespace:
- Tools from the mounted server are accessible with namespaced names.
  Example: If server has a tool named "get_weather", it will be available as "namespace_get_weather".
- Resources are accessible with namespaced URIs.
  Example: If server has a resource with URI "weather://forecast", it will be available as
  "weather://namespace/forecast".
- Templates are accessible with namespaced URI templates.
  Example: If server has a template with URI "weather://location/{id}", it will be available
  as "weather://namespace/location/{id}".
- Prompts are accessible with namespaced names.
  Example: If server has a prompt named "weather_prompt", it will be available as
  "namespace_weather_prompt".

When a server is mounted without a namespace (namespace=None), its tools, resources, templates,
and prompts are accessible with their original names. Multiple servers can be mounted
without namespaces, and they will be tried in order until a match is found.

The mounted server's lifespan is executed when the parent server starts, and its
middleware chain is invoked for all operations (tool calls, resource reads, prompts).

Args:
    server: The FastMCP server to mount.
    namespace: Optional namespace to use for the mounted server's objects. If None,
        the server's objects are accessible with their original names.
    as_proxy: Deprecated. Mounted servers now always have their lifespan and
        middleware invoked. To create a proxy server, use create_proxy()
        explicitly before mounting.
    tool_names: Optional mapping of original tool names to custom names. Use this
        to override namespaced names. Keys are the original tool names from the
        mounted server.
    prefix: Deprecated. Use namespace instead.
N)FastMCPProviderz=The 'prefix' parameter is deprecated, use 'namespace' insteadr?  z,Cannot specify both 'prefix' and 'namespace'zas_proxy is deprecated and will be removed in a future version. Mounted servers now always have their lifespan and middleware invoked. To create a proxy server, use create_proxy() explicitly.rX   )r   r#  r'  )rB  )fastmcp.server.providers.fastmcp_providerr7  r   rC  r   fastmcp.server.providers.proxyrY   r   r   r2  itemsrI   wrap_transformrA   r   )r   r   r"  r2  r3  r5  rB  r7  rY   r%  old_namenew_namer   s   &&&&&&       ru   mountFastMCP.mount  s   ` 	M MMO"
  "	 !OPPMMK # G!&77$--f5F -V4  +5*:*:*<*<&H -8<<*<    ..}Z/HIH 	(oo2>s   .Dc               $    V ^8  d   QhRRRRRR/# )rn   r   r   r5  r   rq   rr   rs   )rt   s   "ru   rv   r   #  s2     aI aI(aI aI 
	aIrw   c           	       "   ^ RI pVP                  ! R\        ^R7       R R lpVP                  4       G Rj  xL
  F?  pV'       d$   VP	                  RV RVP
                   2/R7      pV P                  V4       KA  	  VP                  4       G Rj  xL
  FL  pV'       d1   V! \        VP                  4      V4      pVP	                  R	V/R7      pV P                  V4       KN  	  VP                  4       G Rj  xL
  FC  pV'       d(   V! VP                  V4      p	VP	                  R
V	/R7      pV P                  V4       KE  	  VP                  4       G Rj  xL
  F?  p
V'       d$   V
P	                  RV RV
P
                   2/R7      p
V P                  V
4       KA  	  VP                   \"        8w  d   ^ RI Hp V! R\$        ^R7       V'       d6   \&        P)                  RV P
                   RVP
                   RV R24       R# \&        P)                  RV P
                   RVP
                   24       R#  EL EL ELE L5i)a  
Import the MCP objects from another FastMCP server into this one,
optionally with a given prefix.

.. deprecated::
    Use :meth:`mount` instead. ``import_server`` will be removed in a
    future version.

Note that when a server is *imported*, its objects are immediately
registered to the importing server. This is a one-time operation and
future changes to the imported server will not be reflected in the
importing server. Server-level configurations and lifespans are not imported.

When a server is imported with a prefix:
- The tools are imported with prefixed names
  Example: If server has a tool named "get_weather", it will be
  available as "prefix_get_weather"
- The resources are imported with prefixed URIs using the new format
  Example: If server has a resource with URI "weather://forecast", it will
  be available as "weather://prefix/forecast"
- The templates are imported with prefixed URI templates using the new format
  Example: If server has a template with URI "weather://location/{id}", it will
  be available as "weather://prefix/location/{id}"
- The prompts are imported with prefixed names
  Example: If server has a prompt named "weather_prompt", it will be available as
  "prefix_weather_prompt"

When a server is imported without a prefix (prefix=None), its tools, resources,
templates, and prompts are imported with their original names.

Args:
    server: The FastMCP server to import
    prefix: Optional prefix to use for the imported server's objects. If None,
        objects are imported with their original names.
Nz0import_server is deprecated, use mount() insteadr?  c               $    V ^8  d   QhRRRRRR/# )rn   r~  r   r5  rq   rs   )rt   s   "ru   rv   +FastMCP.import_server.<locals>.__annotate__S  s!     	 	S 	# 	# 	rw   c                v    \         P                  V 4      pV'       d   VP                  4       w  r4V V RV 2# V # )uG   Add prefix to resource URI: protocol://path → protocol://prefix/path./)URI_PATTERNmatchgroups)r~  r5  rG  protocolpaths   &&   ru   add_resource_prefix2FastMCP.import_server.<locals>.add_resource_prefixS  s<    %%c*E!&"F81TF33Jrw   r   _)updater~  uri_template)r   zeWhen importing from a server with a lifespan, the lifespan from the imported server will not be used.)rS  categoryr@  [z] Imported server z with prefix '')rB  r   rC  r,  
model_copyr   r   r-  r   r~  r  r.  rO  r  r/  r'  r   r   RuntimeWarningr  rc   )r   r   r5  rB  rK  r   ry  new_urir  new_uri_templater  r   s   &&&         ru   import_serverFastMCP.import_server#  s    P 	>	
	 !++---Dv&499+7N.OPMM$ . %33555H-c(,,.?H#..ug6F.Gh'	 6 %<<>>>H#6x7L7Lf#U #..*,<= /  h' ? #//111F**6fXQv{{m;T2U*VOOF# 2
 //%' LLDII;0^F8STU LL1TYYK'9&++GHQ . 6 ? 2sP   7IH;AIH>A'I<I=AIIA8IA'I>IIIc               D    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/# )rn   openapi_specrp   rP  zhttpx.AsyncClient | Noner   r   
route_mapslist[RouteMap] | Noneroute_map_fnOpenAPIRouteMapFn | Nonemcp_component_fnOpenAPIComponentFn | None	mcp_namesr4  r  r  validate_outputr   r   r   rq   r   rs   )rt   s   "ru   rv   r     s     0@ 0@$0@ )0@ 	0@
 *0@ /0@ 40@ )0@ 0@ 0@ 0@ 
0@rw   c
                H    ^RI Hp V! VVVVVVVV	R7      pV ! RRVRV./V
B # )a1  
Create a FastMCP server from an OpenAPI specification.

Args:
    openapi_spec: OpenAPI schema as a dictionary
    client: Optional httpx AsyncClient for making HTTP requests.
        If not provided, a default client is created using the first
        server URL from the OpenAPI spec with a 30-second timeout.
    name: Name for the MCP server
    route_maps: Optional list of RouteMap objects defining route mappings
    route_map_fn: Optional callable for advanced route type mapping
    mcp_component_fn: Optional callable for component customization
    mcp_names: Optional dictionary mapping operationId to component names
    tags: Optional set of tags to add to all components
    validate_output: If True (default), tools use the output schema
        extracted from the OpenAPI spec for response validation. If
        False, a permissive schema is used instead, allowing any
        response structure while still returning structured JSON.
    **settings: Additional settings passed to FastMCP

Returns:
    A FastMCP server with an OpenAPIProvider attached.
OpenAPIProvider)rZ  rP  r[  r]  r_  ra  r  rb  r   r   rs   )providers.openapire  )clsrZ  rP  r   r[  r]  r_  ra  r  rb  r   re  r%  s   &&&&&&&&&&,  ru   from_openapiFastMCP.from_openapi  sF    J 	7,%!%-+	
 ??
?h??rw   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/
# )rn   r  r   r   r   r[  r\  r]  r^  r_  r`  ra  r4  httpx_client_kwargsr  r  r  r   rq   r   rs   )rt   s   "ru   rv   r     sz     4G 4G4G 4G *	4G
 /4G 44G )4G 34G 4G 4G 
4Grw   c	           
        ^RI Hp
 Vf   / pVP                  RR4       \        P                  ! R	R\        P
                  ! VR7      /VB pT;'       g    VP                  pV
! VP                  4       VVVVVVR7      pV ! R	RVRV./V	B # )
a  
Create a FastMCP server from a FastAPI application.

Args:
    app: FastAPI application instance
    name: Name for the MCP server (defaults to app.title)
    route_maps: Optional list of RouteMap objects defining route mappings
    route_map_fn: Optional callable for advanced route type mapping
    mcp_component_fn: Optional callable for component customization
    mcp_names: Optional dictionary mapping operationId to component names
    httpx_client_kwargs: Optional kwargs passed to httpx.AsyncClient.
        Use this to configure timeout and other client settings.
    tags: Optional set of tags to add to all components
    **settings: Additional settings passed to FastMCP

Returns:
    A FastMCP server with an OpenAPIProvider attached.
rd  base_urlzhttp://fastapi	transport)r  )rZ  rP  r[  r]  r_  ra  r  r   r   rs   )rf  re  
setdefaultr  AsyncClientASGITransportr  openapi)rg  r  r   r[  r]  r_  ra  rk  r  r   re  rP  server_namer%  s   &&&&&&&&&,    ru   from_fastapiFastMCP.from_fastapi  s    > 	7&"$&&z3CD"" 
))c2
!

 ''cii,!%-
 FFzFXFFrw   c               $    V ^8  d   QhRRRRRR/# )rn   backend}Client[ClientTransportT] | ClientTransport | FastMCP[Any] | FastMCP1Server | AnyUrl | Path | MCPConfig | dict[str, Any] | strr   r   rq   rY   rs   )rt   s   "ru   rv   r     s*     "1 "1"1 "1 
"1rw   c                    \         P                  P                  '       d   \        P                  ! R\
        ^R7       \        V3/ VB # )a  Create a FastMCP proxy server for the given backend.

.. deprecated::
    Use :func:`fastmcp.server.create_proxy` instead.
    This method will be removed in a future version.

The `backend` argument can be either an existing `fastmcp.client.Client`
instance or any value accepted as the `transport` argument of
`fastmcp.client.Client`. This mirrors the convenience of the
`fastmcp.client.Client` constructor.
z{FastMCP.as_proxy() is deprecated. Use create_proxy() from fastmcp.server instead: `from fastmcp.server import create_proxy`r?  )r   r   rA  rB  r   rC  create_proxy)rg  rw  r   s   &&,ru   r2  FastMCP.as_proxy  s@    6 000MMT"	 G0x00rw   c                    V ^8  d   QhRRRR/# )rn   r   r   rq   r   rs   )rt   s   "ru   rv   r     s     A A As Arw   c                	    V P                   pVf   V R\        P                  ! ^4       2# V RV R\        P                  ! ^4       2# )N-)r   secrets	token_hex)rg  r   
class_names   && ru   r   FastMCP.generate_name  sP    \\
< \7#4#4Q#7"899 \4&'*;*;A*>)?@@rw   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )NNrz   )NNNN)NzOpenAPI ServerNNNNNT)NNNNNNN)7r   r   r   r   r   r   propertyr   r   setterr   r   r   r  r  r   r   r+  r   rD  rI  r,  rl  rq  r-  r  r  r.  r  r  r/  r  r  r   r  r  r  r   r  rM   r   r  r  ry  r'  r  r>  rW  classmethodrh  rt  r2  r   r   __classcell__)r   s   @ru   r   r      s(   @

 #@
 #'@
 .2@
 %)@
 37@
 04@
 26@
 8<@
 =A@
 26@
 +/@
  %)!@
" 04#@
$ &*%@
& "'@
( 59)@
* 48+@
, KO-@
 @
D7 % % - - . . ( ( , , 0 0 	$ 	$	$+<2 < <,
 
:+(G"% % %N > 4'(,' 'R > 2)(,) )V > 2%4 % %N > 2 
 '+  $   )
 '+)  $) )]P
 '+]P  $]P &*]P ]P~  '+	
  $   ) '+	)
  $) )CW '+	CW
  $CW &*CWJ 
 '+  $   )
 '+)  $) )JV
 '+JV  $JV &*JV JVX3:   	
 %) ! #' .2 !% :@ @D *. '+ 9= *.  !%!" 48# (   	
 %) ! #' .2 !% :@ @D *. '+ 9= *.  !%!" 48# (a  	a
 %)a !a #'a .2a !%a :@a @Da *.a '+a 9=a *.a  !%!a" 48#a aF;	;u  	u
 %)u !u #'u .2u !%u !%u <@u '+u 9=u *.u 48un	7   	
 %) ! #' .2 !% '+ *. 48    	
 %) ! #' .2 !% '+ *. 48 b
  	b

 %)b
 !b
 #'b
 .2b
 !%b
 '+b
 *.b
 48b
 b
H\?|aIF 0@ 0@d 4G 4Gl "1 "1H A Arw   r   c               $    V ^8  d   QhRRRRRR/# )rn   targetrx  r   r   rq   rY   rs   )rt   s   "ru   rv   rv   $  s*     4 4	4 4 4rw   c                6    ^ RI HpHp V! V 4      pV! RRV/VB # )as  Create a FastMCP proxy server for the given target.

This is the recommended way to create a proxy server. For lower-level control,
use `FastMCPProxy` or `ProxyProvider` directly from `fastmcp.server.providers.proxy`.

Args:
    target: The backend to proxy to. Can be:
        - A Client instance (connected or disconnected)
        - A ClientTransport
        - A FastMCP server instance
        - A URL string or AnyUrl
        - A Path to a server script
        - An MCPConfig or dict
    **settings: Additional settings passed to FastMCPProxy (name, etc.)

Returns:
    A FastMCPProxy server that proxies to the target.

Example:
    ```python
    from fastmcp.server import create_proxy

    # Create a proxy to a remote server
    proxy = create_proxy("http://remote-server/mcp")

    # Create a proxy to another FastMCP server
    proxy = create_proxy(other_server)
    ```
)rY   _create_client_factoryclient_factoryrs   )r9  rY   r  )r  r   rY   r  r  s   &,   ru   rz  rz  $  s1    V
 ,F3N %
 rw   )r   errorr	   ignore)r   httpssezstreamable-http)__conditional_annotations__r   
__future__r   r   rer  rB  collections.abcr   r   r   r   
contextlibr   r   dataclassesr	   	functoolsr
   pathlibr   typingr   r   r   r   r   r   r   r  	mcp.typesr`  key_value.aio.adapters.pydanticr   key_value.aio.protocolsr   key_value.aio.stores.memoryr   mcp.server.lowlevel.serverr   mcp.shared.exceptionsr   r   r   r   r   pydanticr   r   r  starlette.routingr   typing_extensionsr   r   fastmcp.serverfastmcp.exceptionsr    r!   r"   r#   r$   r%   fastmcp.mcp_configr&   fastmcp.promptsr'   fastmcp.prompts.function_promptr(   fastmcp.prompts.promptr)   fastmcp.resources.resourcer*   r+   fastmcp.resources.templater,   fastmcp.server.appsr-   r.   r/   fastmcp.server.authr0   r1   r2   r3   fastmcp.server.lifespanr4   fastmcp.server.low_levelr5   fastmcp.server.middlewarer6   r7   fastmcp.server.mixinsr8   r9   r:   fastmcp.server.providersr;   r<   "fastmcp.server.providers.aggregater=   fastmcp.server.tasks.configr>   r?   fastmcp.server.telemetryr@   fastmcp.server.transformsrA   rB   $fastmcp.server.transforms.visibilityrC   rD   fastmcp.settingsrE   DuplicateBehaviorSettingfastmcp.tools.function_toolrF   fastmcp.tools.toolrG   rH   fastmcp.tools.tool_transformrI   fastmcp.utilities.componentsrJ   fastmcp.utilities.loggingrK   fastmcp.utilities.typesrL   rM   rN   fastmcp.utilities.versionsrO   fastmcp.clientrP   fastmcp.client.clientrQ   fastmcp.client.samplingrR   fastmcp.client.transportsrS   rT    fastmcp.server.providers.openapirU   OpenAPIComponentFnrV   rW   OpenAPIRouteMapFnr9  rY   r   r  rZ   rl   r   r   	TransportcompilerF  r   r   r   r   r   r   rz  )r  s   @ru   <module>r     s   ; "  	        P P P   ; 1 3 6 *   ? ' "     ) " : / ? 7 
 V U , 3 C S S < @ < 0 V J 4 / < 9 0 E E %47KR9P;	H	CxS)*@A #
E#
E# ]# /	#
 u# p# s# !# T# 8# <# :#   A# Y# O#  g!# (

 =>	 jj-.  "=o"NN 
'& 	 	0! HAOHA`:4rw   