Skip to main content
Glama

get-contexts

List all available kubectl contexts to manage Kubernetes clusters through natural language commands.

Instructions

List all kubectl contexts

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'get-contexts' tool that runs the kubectl command to list all contexts and returns the stdout as text content.
    case "get-contexts": {
      const cmd = `kubectl config get-contexts`;
      const { stdout } = await execAsync(cmd);
      return {
        content: [{ type: "text", text: stdout || "No contexts found" }]
      };
    }
  • The tool definition including name, description, and input schema (empty object, no parameters required). This is part of the tools array returned by ListTools.
      name: "get-contexts",
      description: "List all kubectl contexts",
      inputSchema: {
        type: "object",
        properties: {}
      }
    },
  • server.js:1392-1394 (registration)
    The request handler for listing tools, which returns the full tools array containing the 'get-contexts' tool definition.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return { tools };
    });
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 the action ('List') but does not describe output format, pagination, error handling, or any constraints like rate limits or permissions required. This leaves significant gaps for a tool that interacts with kubectl contexts.

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 that directly states the tool's purpose without any unnecessary words. It is front-loaded and wastes no space, making it highly concise and well-structured.

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 lack of annotations and output schema, the description is incomplete. It does not explain what the output looks like (e.g., list format, context details), behavioral aspects, or how it fits with sibling tools. For a tool in a complex kubectl environment, more context is needed to ensure proper usage.

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 input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description does not add parameter details, which is appropriate, but it could have mentioned if any implicit parameters exist (e.g., output format). Baseline is 4 for zero parameters, as the schema fully covers the lack of inputs.

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 the verb ('List') and resource ('all kubectl contexts'), making the purpose specific and understandable. However, it does not explicitly differentiate from sibling tools like 'current-context' or 'use-context', which are related but serve different purposes, so it misses full sibling differentiation.

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, such as 'current-context' for the active context or 'use-context' for switching contexts. There is no mention of prerequisites, exclusions, or specific scenarios for usage.

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/thekaranpargaie/kube-mcp'

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