+
    wi                        R t ^ RIHt ^ RIt^ RIt^ RIHtHt ]P                  ! ]	4      t
]P                  ! R4      tRt] ! R R4      4       tR R	 ltR
 R ltR R ltR# )a  Tool name validation utilities according to SEP-986.

Tool names SHOULD be between 1 and 128 characters in length (inclusive).
Tool names are case-sensitive.
Allowed characters: uppercase and lowercase ASCII letters (A-Z, a-z),
digits (0-9), underscore (_), dash (-), and dot (.).
Tool names SHOULD NOT contain spaces, commas, or other special characters.

See: https://modelcontextprotocol.io/specification/2025-11-25/server/tools#tool-names
)annotationsN)	dataclassfieldz^[A-Za-z0-9._-]{1,128}$zPhttps://modelcontextprotocol.io/specification/2025-11-25/server/tools#tool-namesc                  D    ] tR t^t$ RtR]R&   ]! R R7      tR]R&   RtR	# )
ToolNameValidationResultzResult of tool name validation.

Attributes:
    is_valid: Whether the tool name conforms to SEP-986 requirements.
    warnings: List of warning messages for non-conforming aspects.
boolis_validc                 	    . # N r       S/home/ubuntu/.local/lib/python3.14/site-packages/mcp/shared/tool_name_validation.py<lambda>!ToolNameValidationResult.<lambda>%   s    r   )default_factory	list[str]warningsr   N)	__name__
__module____qualname____firstlineno____doc____annotations__r   r   __static_attributes__r   r   r   r   r      s     N
;Hi;r   r   c                    V ^8  d   QhRRRR/# )   namestrreturnr   r   )formats   "r   __annotate__r    (   s     6F 6FS 6F%= 6Fr   c                   . pV '       g   \        RR.R7      # \        V 4      ^8  d   \        RR\        V 4       R2.R7      # RV 9   d   VP                  R4       RV 9   d   VP                  R	4       V P                  R
4      '       g   V P	                  R
4      '       d   VP                  R4       V P                  R4      '       g   V P	                  R4      '       d   VP                  R4       \
        P                  V 4      '       g   . p\        4       pV  FL  p\        P                  ! RV4      '       d   K"  WC9  g   K*  VP                  V4       VP                  V4       KN  	  VP                  RRP                  R V 4       4       24       VP                  R4       \        RVR7      # \        RVR7      # )zValidate a tool name according to the SEP-986 specification.

Args:
    name: The tool name to validate.

Returns:
    ToolNameValidationResult containing validation status and any warnings.
FzTool name cannot be empty)r   r   z=Tool name exceeds maximum length of 128 characters (current: ) z9Tool name contains spaces, which may cause parsing issues,z9Tool name contains commas, which may cause parsing issues-zUTool name starts or ends with a dash, which may cause parsing issues in some contexts.zTTool name starts or ends with a dot, which may cause parsing issues in some contextsz[A-Za-z0-9._-]z'Tool name contains invalid characters: z, c              3  8   "   T F  p\        V4      x  K  	  R # 5ir
   )repr).0cs   & r   	<genexpr>%validate_tool_name.<locals>.<genexpr>Y   s     Kk]jXYDQRGG]js   zLAllowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)T)r   lenappend
startswithendswithTOOL_NAME_REGEXmatchsetreaddjoin)r   r   invalid_charsseenchars   &    r   validate_tool_namer:   (   s    H '12
 	
 4y3'UVYZ^V_U``abc
 	
 d{ST
d{ST st}}S11opst}}S11no   &&#%D88-t449I$$T* 
 	A$))Kk]jKkBkAlmnfg'JJ#THEEr   c               $    V ^8  d   QhRRRRRR/# )r   r   r   r   r   r   Noner   )r   s   "r   r    r    a   s&     E E# E Et Er   c                   V'       g   R# \         P                  RV  R24       V F  p\         P                  RV 24       K  	  \         P                  R4       \         P                  R4       \         P                  R\         R24       R# )	zLog warnings for non-conforming tool names.

Args:
    name: The tool name that triggered the warnings.
    warnings: List of warning messages to log.
Nz"Tool name validation warning for "z":z  - zHTool registration will proceed, but this may cause compatibility issues.zKConsider updating the tool name to conform to the MCP tool naming standard.zSee SEP-986 (z) for more details.)loggerwarningSEP_986_URL)r   r   r?   s   && r   issue_tool_name_warningrA   a   sm     
NN7vR@AgY'( 
NN]^
NN`a
NN];-/BCDr   c                    V ^8  d   QhRRRR/# )r   r   r   r   r   r   )r   s   "r   r    r    s   s      c d r   c                Z    \        V 4      p\        WP                  4       VP                  # )a'  Validate a tool name and issue warnings for non-conforming names.

This is the primary entry point for tool name validation. It validates
the name and logs any warnings via the logging module.

Args:
    name: The tool name to validate.

Returns:
    True if the name is valid, False otherwise.
)r:   rA   r   r   )r   results   & r   validate_and_warn_tool_namerE   s   s$      %FD//2??r   )r   
__future__r   loggingr4   dataclassesr   r   	getLoggerr   r>   compiler1   r@   r   r:   rA   rE   r   r   r   <module>rK      sl   	 #  	 (			8	$ **78 a 	< 	< 	<6FrE$r   