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

   ### SUMMARY
   
   Adds a `create_theme` mutation tool to the Superset MCP service, allowing AI 
agents to create themes with custom Ant Design token styling.
   
   The tool follows the existing mutation tool pattern (same as 
`create_virtual_dataset`):
   - `@tool(tags=["mutate"])` with `class_permission_name="Theme"` and 
`method_permission_name="write"`
   - Validates input via `ThemePostSchema` (same schema as the REST API `POST 
/api/v1/theme/`) to ensure theme name is non-empty and `json_data` is valid, 
sanitized Ant Design token JSON
   - Creates the theme with `is_system=False` (user-created, same as REST API)
   - Returns a typed `CreateThemeResponse` with the new theme's `id`, 
`theme_name`, and `json_data`, or an `error` field on validation failure
   
   New files:
   - `superset/mcp_service/theme/__init__.py`
   - `superset/mcp_service/theme/schemas.py` — `CreateThemeRequest` / 
`CreateThemeResponse` Pydantic models
   - `superset/mcp_service/theme/tool/__init__.py`
   - `superset/mcp_service/theme/tool/create_theme.py` — tool implementation
   
   `app.py` updated to import and register the tool.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   N/A — backend-only change.
   
   ### TESTING INSTRUCTIONS
   
   1. Start the MCP server (`python -m superset.mcp_service`)
   2. Connect an MCP client and call `create_theme` with:
      ```json
      {
        "theme_name": "My Blue Theme",
        "json_data": "{\"token\": {\"colorPrimary\": \"#1677ff\"}}"
      }
      ```
   3. Verify the response includes a non-null `id`
   4. Confirm the theme appears in Superset under Settings → Themes
   
   Unit test: run `pytest tests/unit_tests/mcp_service/` to exercise existing 
fixtures.
   
   ### 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