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 }; });

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