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

   ### SUMMARY
   
   Adds a new `create_role` MCP tool that allows Admin users to create FAB 
roles programmatically via the Model Context Protocol service.
   
   **New files:**
   - `superset/mcp_service/role/schemas.py` — `CreateRoleRequest` / 
`CreateRoleResponse` Pydantic schemas
   - `superset/mcp_service/role/tool/create_role.py` — the `create_role` async 
tool
   - `superset/mcp_service/role/tool/__init__.py` and `role/__init__.py` — 
module exports
   
   **Tool behaviour:**
   - Rejects creation if a role with the same name already exists (returns 
structured error)
   - Optionally accepts `permission_ids` (list of PermissionView IDs) to 
pre-assign permissions
   - Warns (but does not fail) if any supplied `permission_ids` are not found
   - Gated via `class_permission_name="security"` + 
`method_permission_name="write"` — only visible to users who have the FAB 
`can_write on security` permission (Admins)
   - Follows the existing mutation tool pattern (`create_virtual_dataset`)
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   N/A — backend-only change.
   
   ### TESTING INSTRUCTIONS
   
   1. Start the MCP service with an Admin API key
   2. Call `create_role(request={"name": "MyNewRole"})` — expect `{"id": <int>, 
"name": "MyNewRole", "error": null}`
   3. Call again with the same name — expect `{"error": "Role 'MyNewRole' 
already exists (id=<int>)."}`
   4. Call with `permission_ids=[1, 2]` — permissions are assigned; invalid IDs 
are skipped with a warning
   5. With a non-Admin user the tool should not appear in the tool list
   
   ### 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]

Reply via email to