
    {h                     l    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  G d deej                        Zy)z2Base classes and interfaces for FastMCP resources.    N)	Annotated)AnyUrl	BaseModel
ConfigDictFieldUrlConstraintsValidationInfofield_validatorc                   T   e Zd ZU dZ ed      Z edd      Zee	 e
d      f   ed	<    ed
d      Zedz  ed<    edd      Zedz  ed<    edd      Zedz  ed<    eddd      Zeed<    edd      ededz  dedefd              Zej,                  deez  fd       Zy)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_typebefore)modeinforeturnc                 p    |r|S |j                   j                  d      x}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   s       b/var/www/html/hubwallet-dev/venv/lib/python3.12/site-packages/mcp/server/fastmcp/resources/base.pyset_default_namezResource.set_default_name    s9     K))--&&3&s8O>??    c                    K   yw)zRead the resource content.N )selfs    r    readzResource.read*   s      	s   )__name__
__module____qualname____doc__r   model_configr   r   r   r   r   __annotations__r   r   r   r   r   r
   classmethodr	   r!   abcabstractmethodbytesr&   r$   r"   r    r   r      s    't4LBGPSavBwC6>>>	?w)?ND#*N*PZ^_E3:_#0MW[\Kt\72Is  V(+@C$J @n @ @  ,@ 	C%K  r"   r   )r*   r.   typingr   pydanticr   r   r   r   r   r	   r
   ABCr   r$   r"   r    <module>r4      s/    8 
   y#'' r"   