Dmitry-Kucher opened a new pull request, #45701: URL: https://github.com/apache/superset/pull/45701
### SUMMARY Reading a resource URI the MCP server does not have makes FastMCP raise its own `fastmcp.exceptions.NotFoundError` (`Unknown resource: 'foo://bar'`). `GlobalErrorHandlerMiddleware` didn't recognise it, so it fell through to the generic branch: - the client got `Internal error in unknown: An unexpected error occurred. Error ID: err_…. Please contact support if this persists.`, which gives an agent nothing to correct; - it was logged at ERROR and sent to `MCP_ERROR_HOOK`, paging for what is a caller mistake. This is easy to hit in practice: agents guess resource URIs (`<server>://dashboards`, etc.). The same happens for an unknown tool or prompt. This PR re-raises `NotFoundError` untouched so FastMCP returns its own protocol error (`Resource not found: 'foo://bar'`), and adds it to `_USER_ERROR_TYPES` so it is logged at WARNING and stays out of the error tracker. One subtlety: when the miss arrives *wrapped*, because a tool such as the `call_tool` search proxy looked up another tool via `ctx.fastmcp.call_tool`, re-raising it bare would make FastMCP report the proxy itself as the unknown tool (`Unknown tool: 'call_tool'`). In that case it is kept as a `ToolError` carrying the original message (`Unknown tool: 'bogus'`). ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF Before: ``` MCPError: Internal error in unknown: An unexpected error occurred. Error ID: err_abfc360c6881596d. Please contact support if this persists. ``` After: ``` MCPError: Resource not found: 'bogus://dashboards' ``` ### TESTING INSTRUCTIONS ``` pytest tests/unit_tests/mcp_service/test_error_classification.py -k unknown ``` The tests drive a real FastMCP client: an unknown resource (not-found message, no ERROR log, no error-hook call), an unknown tool called directly and through a proxy tool (the message names the missing tool, not the proxy), and an unknown prompt. ### ADDITIONAL INFORMATION - [ ] Has associated issue: - [ ] Required feature flags: - [ ] Changes UI - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351)) - [ ] Introduces new feature or API - [ ] Removes existing feature or API -- 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]
