aminghadersohi opened a new pull request, #40359:
URL: https://github.com/apache/superset/pull/40359
### SUMMARY
Adds the `create_report` MCP mutation tool that allows AI assistants to
create scheduled report and alert definitions in Superset via the Model Context
Protocol.
**New files:**
- `superset/mcp_service/report/__init__.py` — module init
- `superset/mcp_service/report/schemas.py` — Pydantic schemas:
`RecipientConfig`, `CreateReportRequest`, `CreateReportResponse`
- `superset/mcp_service/report/tool/__init__.py` — tool export
- `superset/mcp_service/report/tool/create_report.py` — tool implementation
**Tool behavior:**
- Wraps `CreateReportScheduleCommand` (same command as the REST `POST
/api/v1/report/` endpoint)
- Uses `ALERTS_REPORTS` creation method so callers can specify arbitrary
recipients
- Accepts `dashboard_id` or `chart_id` for attaching a visualization, plus
`database_id` + `sql` for alert conditions
- Supports Email, Slack, SlackV2, and Webhook recipient types
- Returns structured response with `id`, schedule metadata, a management
URL, and an `error` field on failure
- Tagged `mutate` with `readOnlyHint=False`; permission-checked against
`ReportSchedule/write`
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A — backend-only MCP tool, no UI changes.
### TESTING INSTRUCTIONS
1. Start the MCP server with a valid Superset instance
2. Call `create_report` via an MCP client with:
```json
{
"name": "Weekly Dashboard Report",
"type": "Report",
"crontab": "0 9 * * 1",
"dashboard_id": 1,
"recipients": [{"type": "Email", "target": "[email protected]"}]
}
```
3. Verify the response includes a non-null `id` and a `url`
4. Check the Superset admin UI under Alerts & Reports — the new schedule
should appear
### 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]