Skip to main content
Glama

create_or_update_role

Define or modify user roles with specific permissions, enabling fine-grained access control for secure and tailored user management on the MCP Server for Coroot.

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

Implementation Reference

  • The primary MCP tool handler function for 'create_or_update_role', registered via @mcp.tool() decorator. It receives parameters and 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)
  • Helper implementation function that constructs the role_data dictionary from parameters, handles errors, and invokes the CorootClient 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 class method that performs the HTTP POST request to the Coroot API endpoint '/api/roles' to create or update the role and parses the JSON response.
    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