aminghadersohi opened a new pull request, #40446: URL: https://github.com/apache/superset/pull/40446
## Summary `StructuredContentStripperMiddleware.on_list_tools` had no exception handling. When inner middleware raises `ToolError`, it propagated to the MCP SDK layer which cannot encode a `ToolError` as a `tools/list` response — producing the cryptic `"encoding without a string argument"` error visible to Claude.ai users across **all** MCP tools simultaneously. Fix: wrap the `call_next` call in `on_list_tools` with try/except and return `[]` on any exception. `GlobalErrorHandlerMiddleware` already logs and records event_logger entries for the underlying error, so no observability is lost. Note: `on_call_tool` already had this protection — `on_list_tools` was the remaining unguarded path. ## Changes - `superset/mcp_service/middleware.py` — add try/except to `StructuredContentStripperMiddleware.on_list_tools`, return `[]` on exception - `tests/unit_tests/mcp_service/test_middleware_logging.py` — new test `test_list_tools_exception_returns_empty_list` exercises the full middleware chain ## Testing All 15 middleware tests pass including the new one. ``` pytest tests/unit_tests/mcp_service/test_middleware_logging.py -v # 15 passed in 0.80s ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
