list_nodes
Retrieve all Kubernetes cluster nodes with basic information by specifying the context name to manage resources across multiple clusters.
Instructions
List all nodes in the Kubernetes cluster.
Args: context_name: The Kubernetes context name
Returns: JSON string containing basic information about all nodes
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| context_name | Yes |
Implementation Reference
- tools/node.py:11-26 (handler)The list_nodes tool, decorated with @mcp.tool(), implements the core logic to list all Kubernetes nodes in the specified context, returning their names as JSON.@mcp.tool() @use_current_context def list_nodes(context_name: str): """ List all nodes in the Kubernetes cluster. Args: context_name: The Kubernetes context name Returns: JSON string containing basic information about all nodes """ core_v1: CoreV1Api = get_api_clients(context_name)["core"] nodes = core_v1.list_node() result = [{"name": node.metadata.name} for node in nodes.items] return json.dumps(result)