o
    i                     @   sd   d Z ddlZddlmZ ddlmZmZmZmZm	Z	m
Z
mZ ddlmZmZ G dd deejZdS )z2Base classes and interfaces for FastMCP resources.    N)	Annotated)AnyUrl	BaseModel
ConfigDictFieldUrlConstraintsValidationInfofield_validator)AnnotationsIconc                   @   s  e Zd ZU dZeddZedddZee	e
ddf ed	< ed
ddZedB ed< edddZedB ed< edddZedB ed< eddddZeed< edddZee dB ed< edddZedB ed< edddededB dedefdd ZejdeeB fd!d"ZdS )#ResourcezBase class for all resources.T)validate_default.zURI of the resource)defaultdescriptionF)host_requiredurizName of the resourceN)r   r   namez$Human-readable title of the resourcetitlezDescription of the resourcer   z
text/plainz!MIME type of the resource contentz^[a-zA-Z0-9]+/[a-zA-Z0-9\-+.]+$)r   r   pattern	mime_typez(Optional list of icons for this resourceiconsz%Optional annotations for the resourceannotationsbefore)modeinforeturnc                 C   s(   |r|S |j d }rt|S td)z*Set default name from URI if not provided.r   z#Either name or uri must be provided)datagetstr
ValueError)clsr   r   r    r!   g/var/www/html/karishye-ai-python/venv/lib/python3.10/site-packages/mcp/server/fastmcp/resources/base.pyset_default_name$   s
   zResource.set_default_namec                    s   dS )zRead the resource content.Nr!   )selfr!   r!   r"   read.   s   zResource.read)__name__
__module____qualname____doc__r   model_configr   r   r   r   r   __annotations__r   r   r   r   r   r   listr   r   r
   r	   classmethodr   r#   abcabstractmethodbytesr%   r!   r!   r!   r"   r      s&   
 
"
r   )r)   r.   typingr   pydanticr   r   r   r   r   r   r	   	mcp.typesr
   r   ABCr   r!   r!   r!   r"   <module>   s    $
