justinpark opened a new pull request, #42660:
URL: https://github.com/apache/superset/pull/42660

   ### SUMMARY
   LoggingMiddleware and ResponseSizeGuardMiddleware extracted tool call 
parameters via getattr(context.message, "params", {}). The real MCP SDK type 
for a tools/call request (mcp.types.CallToolRequestParams) has no params 
attribute — it exposes name and arguments — so the getattr fallback always 
silently returned {}. As a result, every MCP tool call log recorded params: {} 
and dashboard_id/slice_id/dataset_id as null, regardless of what the caller 
actually sent, making the audit logs useless for debugging or analytics.
   
   Fixed both call sites to read context.message.arguments instead. Also 
updated the existing unit test mocks, which had been setting 
context.message.params on MagicMock objects — mirroring the same wrong 
attribute name as the bug, which is why the regression went undetected — and 
added a regression test that constructs a real mcp.types.CallToolRequestParams 
object to catch this class of attribute-name mismatch going forward.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   Before:
   
   ```
   {"tool": "get_dashboard_info", "agent_id": null, "params": {}, "method": 
"tools/call", "dashboard_id": null,
     "slice_id": null, "dataset_id": null, "success": false}
   ```
   
   After:
   
   ```
   {"tool": "get_dashboard_info", "agent_id": null, "params": {"request": 
{"identifier": 286}}, "method": "tools/call", "dashboard_id": null, "slice_id": 
null, "dataset_id": null, "success": false}
   ```
   
   ### TESTING INSTRUCTIONS
   
   - pytest tests/unit_tests/mcp_service/test_middleware.py 
tests/unit_tests/mcp_service/test_middleware_logging.py -q — all 124 tests 
pass, including the new regression test (verified it fails against the pre-fix 
code).
   - Manually verified end-to-end on a live dev pod: ran superset mcp run, 
called get_dashboard_info via a real MCP client, and confirmed via the logs 
table in the metadata DB that params now contains the actual call arguments 
(e.g. {"request": {"identifier": 286}}) instead of {}.
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] 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]

Reply via email to