role_get
Retrieve detailed information about a specific Kubernetes Role by specifying the context, namespace, and Role name for effective cluster management.
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 | ||
| name | Yes | ||
| namespace | Yes |
Implementation Reference
- tools/role.py:52-71 (handler)The implementation of the 'role_get' MCP tool. This function is decorated with @mcp.tool() for registration and retrieves detailed information about a specific Kubernetes Role in a namespace using the RBAC API.@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] }