Skip to main content
Glama

get_node_pods

Retrieve all pods running on a specific Kubernetes node to monitor workloads, troubleshoot issues, and manage cluster resources effectively.

Instructions

Get all pods running on a specific node.

Args: context_name: The Kubernetes context name node_name: The name of the node to get pods for

Returns: JSON string containing the pods running on the node

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
context_nameYes
node_nameYes

Implementation Reference

  • The handler function that retrieves all pods running on the specified node using the Kubernetes CoreV1Api. It lists pods across all namespaces with field_selector spec.nodeName matching the node_name, formats pod info, and returns JSON.
    def get_node_pods(context_name: str, node_name: str):
        """
        Get all pods running on a specific node.
    
        Args:
            context_name: The Kubernetes context name
            node_name: The name of the node to get pods for
    
        Returns:
            JSON string containing the pods running on the node
        """
        core_v1: CoreV1Api = get_api_clients(context_name)["core"]
    
        # Get all pods in all namespaces
        pods = core_v1.list_pod_for_all_namespaces(field_selector=f"spec.nodeName={node_name}")
    
        pod_list = [
            {
                "name": pod.metadata.name,
                "namespace": pod.metadata.namespace,
                "status": pod.status.phase,
                "containers": [c.name for c in pod.spec.containers]
            } for pod in pods.items
        ]
    
        result = {
            "node": node_name,
            "pods": pod_list,
            "pod_count": len(pod_list)
        }
    
        return json.dumps(result)
  • tools/node.py:445-446 (registration)
    The @mcp.tool() decorator registers the get_node_pods function as an MCP tool. The @use_current_context decorator provides the current Kubernetes context.
    @mcp.tool()
    @use_current_context
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It states it 'gets' pods (read operation) and returns JSON, but doesn't disclose behavioral traits like whether it requires specific permissions, rate limits, error conditions, or if it's a live query vs. cached data. The description is minimal and lacks operational context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized with three clear sections (purpose, Args, Returns) in 4 sentences. It's front-loaded with the core purpose first. Minor room for improvement in flow, but no wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 2 parameters with 0% schema coverage and no output schema, the description covers basics (purpose, params, return format) but is incomplete. It lacks details on return structure (e.g., pod fields), error handling, and operational context (Kubernetes-specific nuances). For a read tool with no annotations, it's minimally adequate.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It explicitly documents both parameters ('context_name' and 'node_name') with brief explanations in the Args section, adding meaning beyond the schema's bare titles. However, it doesn't provide format examples or constraints (e.g., valid node names).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Get all pods running on a specific node' which is a specific verb ('Get') and resource ('pods') with scope ('on a specific node'). It distinguishes from siblings like 'pod_list' (all pods) and 'pod_detail' (single pod), but doesn't explicitly contrast them.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage when you need pods for a specific node, but doesn't provide explicit guidance on when to use this vs. alternatives like 'pod_list' (which might filter by node) or 'get_node_details' (which might include pod info). No exclusions or prerequisites are mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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