list_nodes
Retrieve basic information about all nodes in a Kubernetes cluster by specifying the context name. Returns JSON data for easy analysis and management.
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 handler: lists all Kubernetes nodes in the specified context and returns their names as JSON. Registered via @mcp.tool() decorator.@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)