Skip to main content
Glama

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
NameRequiredDescriptionDefault
context_nameYes

Implementation Reference

  • 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)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bourbonkk/k8s-pilot'

If you have feedback or need assistance with the MCP directory API, please join our Discord server