@@ -83,14 +83,11 @@ def __init__(self, message: str, code: int, data: dict[str, Any] | None = None):
8383 super ().__init__ (message )
8484
8585 @classmethod
86- def from_mcp_sdk_error (cls , error : mcp_exceptions .McpError ) -> MCPError :
86+ def from_mcp_sdk (cls , error : mcp_exceptions .McpError ) -> MCPError :
8787 """Create an MCPError from an MCP SDK McpError.
8888
8989 Args:
9090 error: An McpError from the MCP SDK.
91-
92- Returns:
93- A new MCPError instance with the error data.
9491 """
9592 # Extract error data from the McpError.error attribute
9693 error_data = error .error
@@ -549,7 +546,7 @@ async def list_resources(self) -> list[Resource]:
549546 try :
550547 result = await self ._client .list_resources ()
551548 except mcp_exceptions .McpError as e :
552- raise MCPError .from_mcp_sdk_error (e ) from e
549+ raise MCPError .from_mcp_sdk (e ) from e
553550 return [Resource .from_mcp_sdk (r ) for r in result .resources ]
554551
555552 async def list_resource_templates (self ) -> list [ResourceTemplate ]:
@@ -564,7 +561,7 @@ async def list_resource_templates(self) -> list[ResourceTemplate]:
564561 try :
565562 result = await self ._client .list_resource_templates ()
566563 except mcp_exceptions .McpError as e :
567- raise MCPError .from_mcp_sdk_error (e ) from e
564+ raise MCPError .from_mcp_sdk (e ) from e
568565 return [ResourceTemplate .from_mcp_sdk (t ) for t in result .resourceTemplates ]
569566
570567 @overload
@@ -595,7 +592,7 @@ async def read_resource(
595592 try :
596593 result = await self ._client .read_resource (AnyUrl (resource_uri ))
597594 except mcp_exceptions .McpError as e :
598- raise MCPError .from_mcp_sdk_error (e ) from e
595+ raise MCPError .from_mcp_sdk (e ) from e
599596
600597 return (
601598 self ._get_content (result .contents [0 ])
0 commit comments