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

   ### SUMMARY
   
   Adds a `create_saved_query` mutation tool to the MCP service so AI 
assistants can persist SQL queries to the Saved Queries list.
   
   **New files:**
   - `superset/commands/query/create.py` — `CreateSavedQueryCommand` validates 
database access (existence + security) and creates the record via 
`SavedQueryDAO`
   - `superset/commands/query/exceptions.py` — adds 
`SavedQueryCreateFailedError`
   - `superset/mcp_service/saved_query/` — new module with Pydantic 
request/response schemas and the `@tool`-decorated `create_saved_query` function
   - `superset/mcp_service/app.py` — registers the tool and updates LLM 
instructions
   
   **Tool signature:**
   ```
   create_saved_query(label, sql, db_id, schema?, description?, 
template_parameters?)
   → { id, label, sql, db_id, schema, description, url, error? }
   ```
   
   Follows the same mutation pattern as `create_virtual_dataset`.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   N/A — backend MCP tool only.
   
   ### TESTING INSTRUCTIONS
   
   1. Start the MCP server with a running Superset instance
   2. Connect an MCP client (e.g., Claude Desktop)
   3. Call `create_saved_query` with a valid `db_id`, `label`, and `sql`
   4. Verify the saved query appears in `/savedqueryview/list/` and can be 
opened in SQL Lab via the returned URL
   5. Call with an invalid `db_id` and verify a structured error is returned 
(no exception thrown to the client)
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration
   - [x] 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