
    Ki<                         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eej                         Zy)z2Base classes and interfaces for FastMCP resources.    N)	AnnotatedAny)AnyUrl	BaseModel
ConfigDictFieldUrlConstraintsValidationInfofield_validator)AnnotationsIconc                      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      Zee   dz  ed<    edd      Zedz  ed<    edd      Zeeef   dz  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 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                 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       m/home/jay/workspace/scripts/.codegraph-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   listr   r   r   r   dictr   r   classmethodr
   r'   abcabstractmethodbytesr,   r*   r(   r&   r   r      sF   't4LBGPSavBwC6>>>	?w)?ND#*N*PZ^_E3:_#0MW[\Kt\7ZIs 
  %T?ijE4:j&+DFm&nKt#n"'Bg"hD$sCx.4
hV(+@C$J @n @ @  ,@ 	C%K  r(   r   )r0   r6   typingr   r   pydanticr   r   r   r   r	   r
   r   	mcp.typesr   r   ABCr   r*   r(   r&   <module>r=      s4    8 
 !   (y#'' r(   