
    "<i                     |   d 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  ee          Zeedgdf         Zeedgdf         Z G d dej                  Z ed           G d d                      Z eej                  gZdedee         defdZg dZ dS )z+Route mapping logic for OpenAPI operations.    N)Callable)	dataclassfield)Pattern)TYPE_CHECKINGLiteral   )OpenAPIResourceOpenAPIResourceTemplateOpenAPITool)
get_logger)
HttpMethod	HTTPRouteMCPTypezMCPType | Nonez7OpenAPITool | OpenAPIResource | OpenAPIResourceTemplatec                   "    e Zd ZdZdZdZdZdZdS )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        /Users/kimhansen/Desktop/03 Workspace/ceo-agents/chl-effectiveness/mcp-servers/whoop/.venv/lib/python3.11/site-packages/fastmcp/server/openapi/routing.pyr   r   !   s/          DH+GGGr   T)kw_onlyc                      e Zd ZU dZ ed          Zee         ed         z  e	d<    ed          Z
ee         ez  e	d<    eeddi	          Zee         e	d
<    eddi          Zee	d<    eeddi	          Zee         e	d<   dS )RouteMapzAMapping configuration for HTTP routes to FastMCP component types.*)defaultmethodsz.*patterndescriptionz,A set of tags to match. All tags must match.)default_factorymetadatatagsz(The type of FastMCP component to create.)r&   mcp_typez:A set of tags to apply to the generated FastMCP component.mcp_tagsN)r   r   r   r   r   r"   listr   r   __annotations__r#   r   strsetr'   r(   r   r)   r   r   r   r   r   2   s        KK/4uS/A/A/AGT*,AAA"'%"6"6"6GWS\C666U!OP  D#c(    !KL  Hg    W
  Hc#h     r   r   r(   routemappingsreturnc           	         |D ]}|j         dk    s| j        |j         v rt          |j        t                    r |j                            | j                  }nt          j        |j        | j                  }|rs|j        r1t          | j        pg           }|j        
                    |          st                              d| j         d| j         d|j        j                    |c S t          t           j                  S )a'  
    Determines the FastMCP component type based on the route and mappings.

    Args:
        route: HTTPRoute object
        mappings: List of RouteMap objects in priority order

    Returns:
        The RouteMap that matches the route, or a catchall "Tool" RouteMap if no match is found.
    r    zRoute  z mapped to r.   )r"   method
isinstancer#   r   searchpathrer'   r-   issubsetloggerdebugr(   namer   r   r   )r/   r0   	route_mappattern_matchesroute_tags_sets        r   _determine_route_typer@   O   s     ! !	##u|y7H'H'H)+W55 K"+"3":":5:"F"F"$)I,=uz"J"J ! > !%()9r%:%:N$>22>BB ! \U\\\EJ\\9CUCZ\\   !    W\****r   )DEFAULT_ROUTE_MAPPINGSComponentFnr   r   
RouteMapFnr@   )!r   enumr8   collections.abcr   dataclassesr   r   r   typingr   r   
componentsr
   r   r   fastmcp.utilities.loggingr   fastmcp.utilities.openapir   r   r   r:   rC   rB   Enumr   r   r   rA   r*   r@   __all__r   r   r   <module>rM      s   1 1  				 $ $ $ $ $ $ ( ( ( ( ( ( ( (       ) ) ) ) ) ) ) )           1 0 0 0 0 0 ; ; ; ; ; ; ; ;	H		 y),.>>?
A 		
    di   " 4       0 Hgl### 
(+(+8n(+ (+ (+ (+ (+X  r   