o
    i<                     @   sh   d Z ddlZddlmZ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Any)AnyUrl	BaseModel
ConfigDictFieldUrlConstraintsValidationInfofield_validator)AnnotationsIconc                   @   s2  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Zeeef 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)Zvalidate_default.zURI of the resource)defaultdescriptionF)Z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 contentzG^[a-zA-Z0-9]+/[a-zA-Z0-9\-+.]+(;\s*[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annotationsz#Optional metadata for this resourcemeta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!   X/home/app/Keep/.python/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   Zmodel_configr   r   r   r   r   __annotations__r   r   r   r   r   r   listr   r   r   r   dictr   r
   classmethodr	   r#   abcabstractmethodbytesr%   r!   r!   r!   r"   r      s(   
 
" 
r   )r)   r.   typingr   r   Zpydanticr   r   r   r   r   r	   r
   Z	mcp.typesr   r   ABCr   r!   r!   r!   r"   <module>   s    $
