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
| Name | Required | Description | Default |
|---|---|---|---|
| context_name | Yes | ||
| namespace | Yes | ||
| name | Yes |
Implementation Reference
- tools/role.py:52-71 (handler)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] }