create_or_update_role
Define custom roles with specific permissions for fine-grained access control in Coroot's observability platform. Manage user access by creating or updating role configurations.
Instructions
Create or update a user role (admin only).
Defines custom roles with specific permissions for fine-grained access control.
Args: name: Role name permissions: List of permission strings description: Optional role description
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| permissions | Yes | ||
| description | No |
Implementation Reference
- src/mcp_coroot/server.py:2175-2191 (handler)MCP tool handler function decorated with @mcp.tool(). This is the main entry point for the 'create_or_update_role' tool, which delegates to the implementation helper.@mcp.tool() async def create_or_update_role( name: str, permissions: list[str], description: str | None = None ) -> dict[str, Any]: """ Create or update a user role (admin only). Defines custom roles with specific permissions for fine-grained access control. Args: name: Role name permissions: List of permission strings description: Optional role description """ return await create_or_update_role_impl(name, permissions, description)
- src/mcp_coroot/server.py:2154-2173 (helper)Internal helper implementation that constructs the role_data dictionary and calls the CorootClient's create_or_update_role method.async def create_or_update_role_impl( name: str, permissions: list[str], description: str | None = None ) -> dict[str, Any]: """Implementation for create_or_update_role tool.""" try: client = get_client() role_data = {"name": name, "permissions": permissions} if description: role_data["description"] = description result = await client.create_or_update_role(role_data) return { "success": True, "message": "Role created/updated successfully", "role": result, } except ValueError as e: return {"success": False, "error": str(e)} except Exception as e: return {"success": False, "error": f"Unexpected error: {str(e)}"}
- src/mcp_coroot/client.py:1616-1627 (helper)CorootClient method that performs the actual HTTP POST request to the Coroot API endpoint /api/roles to create or update the role.async def create_or_update_role(self, role_data: dict[str, Any]) -> dict[str, Any]: """Create or update a role. Args: role_data: Role configuration Returns: Dict containing created/updated role """ response = await self._request("POST", "/api/roles", json=role_data) data: dict[str, Any] = response.json() return data