statefulset_list
List all StatefulSets in a specified Kubernetes namespace to manage and monitor stateful applications across clusters using the k8s-pilot server.
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:10-24 (handler)The handler function for the 'statefulset_list' tool. It lists StatefulSets in the specified namespace using the Kubernetes AppsV1Api, returning a list of names and replicas.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
- tools/statefulset.py:8-9 (registration)The @mcp.tool() decorator registers the statefulset_list function as an MCP tool.@mcp.tool() @use_current_context