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

   ### SUMMARY
   
   When MCP tools return "not found" errors for invalid resource IDs (database, 
chart, dataset, dashboard), the LLM has no signal to recover. This change adds 
actionable recovery guidance to all "not found" error messages in MCP tools.
   
   **Before:**
   ```
   Database with ID -1 not found
   ```
   
   **After:**
   ```
   Database with ID -1 not found. Use list_databases to get valid database IDs.
   ```
   
   **Affected tools:**
   - `execute_sql` — database not found → suggest `list_databases`
   - `open_sql_lab_with_context` — database not found → suggest `list_databases`
   - `query_dataset` — dataset not found → suggest `list_datasets`
   - `get_chart_data` — chart not found → suggest `list_charts`
   - `get_chart_preview` — chart not found → suggest `list_charts`
   - `update_chart` — chart not found → suggest `list_charts`
   - `add_chart_to_existing_dashboard` — dashboard/chart not found → suggest 
`list_dashboards`/`list_charts`
   - `generate_dashboard` — charts not found → suggest `list_charts`
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   N/A — error message text change only.
   
   ### TESTING INSTRUCTIONS
   
   1. Call `execute_sql` with an invalid `database_id` (e.g., `-1`)
   2. Verify the error message now includes `Use list_databases to get valid 
database IDs.`
   3. Repeat for other tools with invalid IDs
   
   Unit tests updated in 
`tests/unit_tests/mcp_service/sql_lab/tool/test_open_sql_lab_with_context.py`.
   
   ### 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))
     - [ ] 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