list-services
List all Kubernetes services within a specified namespace to monitor and manage service discovery and network connectivity in your cluster.
Instructions
List Kubernetes services in a namespace
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| namespace | No | The namespace to list services from (optional, defaults to current context namespace) |
Implementation Reference
- server.js:1413-1421 (handler)The handler logic for the 'list-services' tool, which executes 'kubectl get svc -o wide' in the given namespace to list services.case "list-services": { const { namespace } = args || {}; const nsArg = namespace ? `-n ${namespace}` : ""; const cmd = `kubectl get svc ${nsArg} -o wide`; const { stdout } = await execAsync(cmd); return { content: [{ type: "text", text: stdout || "No services found" }] }; }
- server.js:35-46 (schema)The schema definition for the 'list-services' tool, including input schema for optional namespace parameter.name: "list-services", description: "List Kubernetes services in a namespace", inputSchema: { type: "object", properties: { namespace: { type: "string", description: "The namespace to list services from (optional, defaults to current context namespace)" } } } },
- server.js:1392-1394 (registration)Registration of all tools via the ListToolsRequestHandler, which returns the tools array containing 'list-services'.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });