
    kKj_                    ^   d Z ddlmZ ddlZddlZddlmZ ddlmZm	Z	 ddlm
Z
 ddlmZmZ er
ddlmZmZmZ dd	lmZ dd
lmZmZ g dZ ee      Zeedgdf   Zeedgdf   Z G d dej8                        Z ed       G d d             Z eej>                        gZ 	 	 	 	 	 	 ddZ!y)z+Route mapping logic for OpenAPI operations.    )annotationsN)Callable)	dataclassfield)Pattern)TYPE_CHECKINGLiteral)OpenAPIResourceOpenAPIResourceTemplateOpenAPITool)
get_logger)
HttpMethod	HTTPRoute)ComponentFnMCPTypeRouteMap
RouteMapFnr   zMCPType | Nonez7OpenAPITool | OpenAPIResource | OpenAPIResourceTemplatec                       e Zd ZdZdZdZdZdZy)r   ax  Type of FastMCP component to create from a route.

    Enum values:
        TOOL: Convert the route to a callable Tool
        RESOURCE: Convert the route to a Resource (typically GET endpoints)
        RESOURCE_TEMPLATE: Convert the route to a ResourceTemplate (typically GET with path params)
        EXCLUDE: Exclude the route from being converted to any MCP component
    TOOLRESOURCERESOURCE_TEMPLATEEXCLUDEN)__name__
__module____qualname____doc__r   r   r   r        y/Users/ahmed/devFolder/Ultron/claude-voice/.venv/lib/python3.12/site-packages/fastmcp/server/providers/openapi/routing.pyr   r   *   s     DH+Gr   T)kw_onlyc                      e Zd ZU dZ ed      Zded<    ed      Zded<    eed	d
i      Z	ded<    ed	di      Z
ded<    eed	di      Zded<   y)r   zAMapping configuration for HTTP routes to FastMCP component types.*)defaultzlist[HttpMethod] | Literal['*']methodsz.*zPattern[str] | strpatterndescriptionz,A set of tags to match. All tags must match.)default_factorymetadatazset[str]tagsz(The type of FastMCP component to create.)r(   r   mcp_typez:A set of tags to apply to the generated FastMCP component.mcp_tagsN)r   r   r   r   r   r$   __annotations__r%   setr)   r*   r+   r   r   r   r   r   :   s    K/4S/AG,A"'"6G6!OPD(  !KLHg  W
Hh r   r   r*   c           	        |D ]!  }|j                   dk(  s| j                  |j                   v s,t        |j                  t              r&|j                  j                  | j                        }n*t        j
                  |j                  | j                        }|s|j                  r5t        | j                  xs g       }|j                  j                  |      st        j                  d| j                   d| j                   d|j                  j                          |c S  t        t         j"                        S )zEDetermine the FastMCP component type based on the route and mappings.r"   zRoute  z mapped to r.   )r$   method
isinstancer%   r   searchpathrer)   r-   issubsetloggerdebugr*   namer   r   r   )routemappings	route_mappattern_matchesroute_tags_sets        r   _determine_route_typer?   V   s    
 	#u||y7H7H'H)++W5"+"3"3":":5::"F"$))I,=,=uzz"J>>%()9r%:N$>>22>B U\\N!EJJ<{9CUCUCZCZB[\ ! ! $ W\\**r   )r:   r   r;   zlist[RouteMap]returnr   )"r   
__future__r   enumr5   collections.abcr   dataclassesr   r   r   typingr   r	   +fastmcp.server.providers.openapi.componentsr
   r   r   fastmcp.utilities.loggingr   fastmcp.utilities.openapir   r   __all__r   r7   r   r   Enumr   r   r   DEFAULT_ROUTE_MAPPINGSr?   r   r   r   <module>rL      s    1 "  	 $ (  )  1 ; 
H	 y),.>>?
A 		
dii   4  . gll# 
+++ +r   