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

   ### SUMMARY
   LoggingMiddleware.on_call_tool logs every MCP tool call with a success flag, 
but for create-style tools (generate_chart, generate_dashboard) it always 
logged dashboard_id/slice_id as None — those were extracted only from the input 
params, and create tools don't take the new object's id as input. That made it 
impossible to tell, among a sequence of retried generate_chart calls (e.g. 
after a parameter-missing error), which call actually persisted a chart and 
which chart it created.
   
   This PR adds LoggingMiddleware._extract_output_ids(), which parses the 
tool's response body (chart.id/chart_id, dashboard.id/dashboard_id) and 
backfills dashboard_id/slice_id in the audit log on success, only when they 
weren't already known from the input. Input-derived ids (e.g. update_chart, 
which passes chart_id) always take precedence, and no id is ever recorded for 
failed calls.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   N/A
   
   ### TESTING INSTRUCTIONS
   specs
   
   ### 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