Skip to main content
Glama

role_get

Retrieve detailed information about a specific Kubernetes Role, including its permissions and configuration, to manage access controls in your cluster.

Instructions

Get details of a specific Role.

Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The Role name

Returns: Detailed information about the Role

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
context_nameYes
namespaceYes
nameYes

Implementation Reference

  • The main handler function for the 'role_get' tool. It retrieves details of a specific Kubernetes Role using the RBAC API. Decorated with @mcp.tool() for registration and @use_current_context for context management. Includes input parameters via type hints and docstring describing schema.
    @mcp.tool()
    @use_current_context
    def role_get(context_name: str, namespace: str, name: str):
        """
        Get details of a specific Role.
    
        Args:
            context_name: The Kubernetes context name
            namespace: The Kubernetes namespace
            name: The Role name
    
        Returns:
            Detailed information about the Role
        """
        rbac_v1: RbacAuthorizationV1Api = get_api_clients(context_name)["rbac"]
        role = rbac_v1.read_namespaced_role(name=name, namespace=namespace)
        return {
            "name": role.metadata.name,
            "rules": [{"api_groups": rule.api_groups, "resources": rule.resources, "verbs": rule.verbs} for rule in role.rules]
        }

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