Skip to main content
Glama
abhijeetka
by abhijeetka

get_nodes

Retrieve all Kubernetes cluster nodes to monitor resource availability and manage workload distribution across the infrastructure.

Instructions

Get all nodes in the cluster

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function decorated with @mcp.tool() that implements the get_nodes tool by running 'kubectl get nodes -o json' to retrieve all nodes in the cluster.
    @mcp.tool()
    async def get_nodes() -> dict:
        """Get all nodes in the cluster"""
        try:
            cmd = ["kubectl", "get", "nodes", "-o", "json"]
            result = subprocess.run(cmd, capture_output=True, text=True, check=True)
            return json.loads(result.stdout)
        except subprocess.CalledProcessError as e:
            return {"error": f"Failed to get nodes: {str(e)}"}
  • Secondary handler function decorated with @mcp.tool() for get_nodes tool, incorrectly attempting to filter nodes by namespace (nodes are cluster-scoped).
    @mcp.tool()
    async def get_nodes(namespace: str = "default") -> dict:
        """Get the nodes of a specific namespace"""
        try:
            cmd = ["kubectl", "get", "nodes", "-n", namespace, "-o", "json"]
            result = subprocess.run(cmd, capture_output=True, text=True, check=True)
            return json.loads(result.stdout)
        except subprocess.CalledProcessError as e:
            return {"error": f"Failed to get nodes: {str(e)}"}
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states 'Get all nodes' but doesn't describe what 'get' entails—whether it returns a list, summary, or detailed view; if it's read-only or has side effects; or any limitations like rate limits or authentication needs. For a tool with zero annotation coverage, this leaves critical behavioral traits unspecified.

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

Conciseness5/5

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

The description is a single, efficient sentence: 'Get all nodes in the cluster.' It's front-loaded with the core purpose, has zero wasted words, and is appropriately sized for a simple tool. Every word earns its place by specifying the action, resource, and scope.

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

Completeness2/5

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

Given the tool's simplicity (0 parameters, no output schema, no annotations), the description is minimal but incomplete. It lacks context on behavioral traits (e.g., read-only nature, return format) and usage guidelines. While it states the purpose clearly, it doesn't provide enough information for an agent to confidently invoke it without guessing about its behavior or when to use it.

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?

The tool has 0 parameters, and schema description coverage is 100%, so there's no need for parameter details in the description. The description doesn't add parameter semantics, but that's acceptable here. A baseline of 4 is appropriate as the schema fully documents the lack of parameters, and the description doesn't need to compensate.

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 'Get all nodes in the cluster' clearly states the action (get) and resource (nodes) with scope (all, in the cluster). It distinguishes from siblings like get_pods, get_services, etc., which target different resource types. However, it doesn't explicitly differentiate from tools like get_current_context or get_namespaces that also retrieve cluster information but for different purposes.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., cluster access), exclusions (e.g., when not to use it), or compare to siblings like get_failing_pods for troubleshooting. The agent must infer usage from the tool name alone, which is insufficient for optimal selection.

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/abhijeetka/mcp-k8s-server'

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