Skip to content

Commit 44c327a

Browse files
committed
Improve type safety on MCPError.
1 parent 14c3973 commit 44c327a

File tree

1 file changed

+3
-3
lines changed
  • pydantic_ai_slim/pydantic_ai

1 file changed

+3
-3
lines changed

pydantic_ai_slim/pydantic_ai/mcp.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,17 @@ class MCPError(RuntimeError):
7171
code: int
7272
"""The error code returned by the server."""
7373

74-
data: Any | None
74+
data: dict[str, Any] | None
7575
"""Additional information about the error, if provided by the server."""
7676

77-
def __init__(self, message: str, code: int, data: Any | None = None):
77+
def __init__(self, message: str, code: int, data: dict[str, Any] | None = None):
7878
self.message = message
7979
self.code = code
8080
self.data = data
8181
super().__init__(message)
8282

8383
@classmethod
84-
def from_mcp_sdk_error(cls, error: Any) -> MCPError:
84+
def from_mcp_sdk_error(cls, error: mcp_exceptions.McpError) -> MCPError:
8585
"""Create an MCPError from an MCP SDK McpError.
8686
8787
Args:

0 commit comments

Comments
 (0)