role_list
List all Roles in a specified Kubernetes namespace using the k8s-pilot MCP server. Simplifies role management across multiple clusters by providing basic role information.
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 core handler function for the 'role_list' MCP tool. It lists all Kubernetes Roles in the specified namespace by calling the RBAC API.@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()