list-pods
Retrieve a list of all pods running in a specified Kubernetes namespace to monitor application status and resource availability.
Instructions
List Kubernetes pods in a namespace
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| namespace | No | The namespace to list pods from (optional, defaults to current context namespace) |
Implementation Reference
- server.js:1403-1411 (handler)Handler function that executes the list-pods tool by running kubectl get pods command with optional namespace and returns the stdout output.case "list-pods": { const { namespace } = args || {}; const nsArg = namespace ? `-n ${namespace}` : ""; const cmd = `kubectl get pods ${nsArg} -o wide`; const { stdout } = await execAsync(cmd); return { content: [{ type: "text", text: stdout || "No pods found" }] }; }
- server.js:21-33 (schema)Tool schema definition including name, description, and inputSchema for the list-pods tool.{ name: "list-pods", description: "List Kubernetes pods in a namespace", inputSchema: { type: "object", properties: { namespace: { type: "string", description: "The namespace to list pods from (optional, defaults to current context namespace)" } } } },
- server.js:1392-1394 (registration)Registration of the tool list handler which returns the tools array containing the list-pods tool definition.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });