replicaset_list
Display all ReplicaSets within a specified Kubernetes namespace using the provided context name. Simplify cluster resource management with clear insights into ReplicaSet details.
Instructions
List all ReplicaSets in a given namespace.
Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace
Returns: List of ReplicaSet basic information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| context_name | Yes | ||
| namespace | Yes |
Implementation Reference
- tools/replicaset.py:8-24 (handler)The main handler function for the 'replicaset_list' tool. It lists ReplicaSets in the specified namespace using the Kubernetes AppsV1Api. Includes decorators for MCP tool registration and current context usage.@mcp.tool() @use_current_context def replicaset_list(context_name: str, namespace: str): """ List all ReplicaSets in a given namespace. Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace Returns: List of ReplicaSet basic information """ apps_v1: AppsV1Api = get_api_clients(context_name)["apps"] replicasets = apps_v1.list_namespaced_replica_set(namespace) result = [{"name": rs.metadata.name, "replicas": rs.status.replicas} for rs in replicasets.items] return result
- tools/replicaset.py:8-8 (registration)MCP tool registration decorator for replicaset_list.@mcp.tool()