Skip to content

Commit d02d331

Browse files
fix: add pragma no-cover to defensive except-Exception fallback
The except-Exception block in _handle_call_tool is now a defensive catch-all: Tool.run() wraps all non-ToolError exceptions in ToolError, so this path is only reachable if call_tool is overridden by a subclass. This matches the existing pragma pattern used throughout the file.
1 parent cc004da commit d02d331

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/mcp/server/mcpserver/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ async def _handle_call_tool(
316316
if e.content is not None:
317317
return CallToolResult(content=e.content, is_error=True)
318318
return CallToolResult(content=[TextContent(type="text", text=str(e))], is_error=True)
319-
except Exception as e:
319+
except Exception as e: # pragma: no cover
320320
return CallToolResult(content=[TextContent(type="text", text=str(e))], is_error=True)
321321
if isinstance(result, CallToolResult):
322322
return result

0 commit comments

Comments
 (0)