@@ -196,12 +196,19 @@ class EmptyResult(Result):
196196 """A response that indicates success but carries no data."""
197197
198198
199- class Implementation (BaseModel ):
200- """Describes the name and version of an MCP implementation ."""
199+ class BaseMetadata (BaseModel ):
200+ """Base class for entities with name and optional title fields ."""
201201
202202 name : str
203+ """The programmatic name of the entity."""
204+
203205 title : str | None = None
204- """A human-readable title for the implementation."""
206+ """An optional human-readable title for the entity."""
207+
208+
209+ class Implementation (BaseMetadata ):
210+ """Describes the name and version of an MCP implementation."""
211+
205212 version : str
206213 model_config = ConfigDict (extra = "allow" )
207214
@@ -384,15 +391,11 @@ class Annotations(BaseModel):
384391 model_config = ConfigDict (extra = "allow" )
385392
386393
387- class Resource (BaseModel ):
394+ class Resource (BaseMetadata ):
388395 """A known resource that the server is capable of reading."""
389396
390397 uri : Annotated [AnyUrl , UrlConstraints (host_required = False )]
391398 """The URI of this resource."""
392- name : str
393- """A human-readable name for this resource."""
394- title : str | None = None
395- """A human-readable title for this resource."""
396399 description : str | None = None
397400 """A description of what this resource represents."""
398401 mimeType : str | None = None
@@ -413,18 +416,14 @@ class Resource(BaseModel):
413416 model_config = ConfigDict (extra = "allow" )
414417
415418
416- class ResourceTemplate (BaseModel ):
419+ class ResourceTemplate (BaseMetadata ):
417420 """A template description for resources available on the server."""
418421
419422 uriTemplate : str
420423 """
421424 A URI template (according to RFC 6570) that can be used to construct resource
422425 URIs.
423426 """
424- name : str
425- """A human-readable name for the type of resource this template refers to."""
426- title : str | None = None
427- """A human-readable title for the type of resource this template refers to."""
428427 description : str | None = None
429428 """A human-readable description of what this template is for."""
430429 mimeType : str | None = None
@@ -607,13 +606,9 @@ class PromptArgument(BaseModel):
607606 model_config = ConfigDict (extra = "allow" )
608607
609608
610- class Prompt (BaseModel ):
609+ class Prompt (BaseMetadata ):
611610 """A prompt or prompt template that the server offers."""
612611
613- name : str
614- """The name of the prompt or prompt template."""
615- title : str | None = None
616- """A human-readable title for the prompt."""
617612 description : str | None = None
618613 """An optional description of what this prompt provides."""
619614 arguments : list [PromptArgument ] | None = None
@@ -816,13 +811,9 @@ class ToolAnnotations(BaseModel):
816811 model_config = ConfigDict (extra = "allow" )
817812
818813
819- class Tool (BaseModel ):
814+ class Tool (BaseMetadata ):
820815 """Definition for a tool the client can call."""
821816
822- name : str
823- """The name of the tool."""
824- title : str | None = None
825- """A human-readable title for the tool."""
826817 description : str | None = None
827818 """A human-readable description of the tool."""
828819 inputSchema : dict [str , Any ]
0 commit comments