statefulset_list
Retrieve a list of StatefulSets within a specified Kubernetes namespace using context_name for cluster identification, enabling efficient resource monitoring and management across clusters.
Instructions
List all StatefulSets in a given namespace.
Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace
Returns: List of StatefulSet basic information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| context_name | Yes | ||
| namespace | Yes |
Implementation Reference
- tools/statefulset.py:8-24 (handler)The main handler function for the 'statefulset_list' tool. It lists StatefulSets in a namespace using Kubernetes API, decorated with @mcp.tool() for registration.@mcp.tool() @use_current_context def statefulset_list(context_name: str, namespace: str): """ List all StatefulSets in a given namespace. Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace Returns: List of StatefulSet basic information """ apps_v1: AppsV1Api = get_api_clients(context_name)["apps"] statefulsets = apps_v1.list_namespaced_stateful_set(namespace) result = [{"name": ss.metadata.name, "replicas": ss.status.replicas} for ss in statefulsets.items] return result