Skip to main content
Glama
jamesbrink

MCP Server for Coroot

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
NameRequiredDescriptionDefault
nameYes
permissionsYes
descriptionNo

Implementation Reference

  • 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)
  • 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)}"}
  • 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

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jamesbrink/mcp-coroot'

If you have feedback or need assistance with the MCP directory API, please join our Discord server