Skip to content

Commit 1e77892

Browse files
committed
fix: Drop inheritance for Tool
1 parent 45b1ed6 commit 1e77892

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/mcp/types.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ class EmptyResult(Result):
199199
class BaseMetadata(BaseModel):
200200
"""Base class for entities with name and optional title fields."""
201201

202-
name: Annotated[str, StringConstraints(min_length=1, max_length=128, pattern=r"^[A-Za-z0-9_.-]+$")]
202+
name: str
203203
"""The programmatic name of the entity."""
204204

205205
title: str | None = None
@@ -868,9 +868,13 @@ class ToolAnnotations(BaseModel):
868868
model_config = ConfigDict(extra="allow")
869869

870870

871-
class Tool(BaseMetadata):
871+
class Tool(BaseModel):
872872
"""Definition for a tool the client can call."""
873873

874+
name: Annotated[str, StringConstraints(min_length=1, max_length=128, pattern=r"^[A-Za-z0-9_.-]+$")]
875+
"""The programmatic name of the tool. Must match pattern: A-Z, a-z, 0-9, underscore (_), dash (-), dot (.)."""
876+
title: str | None = None
877+
"""A human-readable title for the tool."""
874878
description: str | None = None
875879
"""A human-readable description of the tool."""
876880
inputSchema: dict[str, Any]

0 commit comments

Comments
 (0)