role_list
List Kubernetes Roles in a specified namespace to manage access permissions and view role configurations within your cluster.
Instructions
List all Roles in a given namespace.
Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace
Returns: List of Role basic information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| context_name | Yes | ||
| namespace | Yes |
Implementation Reference
- tools/role.py:8-24 (handler)The handler function for the 'role_list' tool. It lists all Kubernetes Roles in the specified namespace within the given context using the RBAC API. The @mcp.tool() decorator registers it as an MCP tool.@mcp.tool() @use_current_context def role_list(context_name: str, namespace: str): """ List all Roles in a given namespace. Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace Returns: List of Role basic information """ rbac_v1: RbacAuthorizationV1Api = get_api_clients(context_name)["rbac"] roles = rbac_v1.list_namespaced_role(namespace) result = [{"name": role.metadata.name} for role in roles.items] return result
- tools/role.py:8-8 (registration)The @mcp.tool() decorator registers the role_list function as an MCP tool.@mcp.tool()