From bbf3e2c28e0681ef4c7a5a3d4139fdef61ef4eb1 Mon Sep 17 00:00:00 2001 From: Allen Porter Date: Sat, 28 Dec 2024 10:23:27 -0800 Subject: [PATCH] Add constructor for McpError to allow setting `error` field --- src/mcp/shared/exceptions.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mcp/shared/exceptions.py b/src/mcp/shared/exceptions.py index d8855b8d..97a1c09a 100644 --- a/src/mcp/shared/exceptions.py +++ b/src/mcp/shared/exceptions.py @@ -7,3 +7,8 @@ class McpError(Exception): """ error: ErrorData + + def __init__(self, error: ErrorData): + """Initialize McpError.""" + super().__init__(error.message) + self.error = error