Skip to main content
Glama

clusterrole_list

List all ClusterRoles in a Kubernetes cluster to manage role-based access control permissions across namespaces.

Instructions

List all ClusterRoles in the cluster.

Args: context_name: The Kubernetes context name

Returns: List of ClusterRole basic information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
context_nameYes

Implementation Reference

  • The handler function for the 'clusterrole_list' tool. It lists all ClusterRoles in the Kubernetes cluster using the RBAC API, decorated with @mcp.tool() for registration and execution.
    @mcp.tool()
    @use_current_context
    def clusterrole_list(context_name: str):
        """
        List all ClusterRoles in the cluster.
    
        Args:
            context_name: The Kubernetes context name
    
        Returns:
            List of ClusterRole basic information
        """
        rbac_v1: RbacAuthorizationV1Api = get_api_clients(context_name)["rbac"]
        clusterroles = rbac_v1.list_cluster_role()
        result = [{"name": clusterrole.metadata.name} for clusterrole in clusterroles.items]
        return result

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/bourbonkk/k8s-pilot'

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