aminghadersohi opened a new pull request, #40358:
URL: https://github.com/apache/superset/pull/40358
### SUMMARY
Adds a new MCP mutation tool `create_tag` that allows AI agents to create
custom tags in Superset and optionally apply them to objects (charts,
dashboards, datasets, queries) in a single call.
**New files:**
- `superset/mcp_service/tag/schemas.py` — Pydantic request/response schemas
(`CreateTagRequest`, `CreateTagResponse`)
- `superset/mcp_service/tag/tool/create_tag.py` — the `create_tag` MCP tool
- `superset/mcp_service/tag/tool/__init__.py` — module exports
- `superset/mcp_service/tag/__init__.py` — package init
The tool follows the established mutation pattern (same as
`create_virtual_dataset`):
- `@tool(tags=["mutate"], class_permission_name="Tag",
method_permission_name="write")`
- Uses `CreateCustomTagWithRelationshipsCommand` (same as the REST API `POST
/api/v1/tag/`)
- Returns structured `CreateTagResponse` with tag ID, objects
tagged/skipped, and error field
- Wraps operation with `event_logger.log_context`
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A — backend MCP tool only.
### TESTING INSTRUCTIONS
1. Start the MCP server
2. Call `create_tag` with `{"name": "my-tag", "description": "test tag"}`
3. Verify the tag is created and the response includes the tag ID
4. Optionally provide `objects_to_tag: [["chart", 1]]` to tag an object at
creation time
### 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
- [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]