list-serviceaccounts
Lists Kubernetes service accounts in a specified namespace to manage cluster access and permissions. Use this tool to view and audit service accounts for security and operational purposes.
Instructions
List Kubernetes service accounts in a namespace
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| namespace | No | The namespace to list service accounts from (optional, defaults to current context namespace) |
Implementation Reference
- server.js:1913-1921 (handler)Handler for list-serviceaccounts tool: runs 'kubectl get serviceaccounts [namespace] -o wide' and returns the output.case "list-serviceaccounts": { const { namespace } = args || {}; const nsArg = namespace ? `-n ${namespace}` : ""; const cmd = `kubectl get serviceaccounts ${nsArg} -o wide`; const { stdout } = await execAsync(cmd); return { content: [{ type: "text", text: stdout || "No service accounts found" }] }; }
- server.js:809-820 (schema)Input schema definition for the list-serviceaccounts tool, accepting optional namespace.name: "list-serviceaccounts", description: "List Kubernetes service accounts in a namespace", inputSchema: { type: "object", properties: { namespace: { type: "string", description: "The namespace to list service accounts from (optional, defaults to current context namespace)" } } } },
- server.js:1392-1394 (registration)Registration of all tools list, including list-serviceaccounts, via the ListToolsRequestHandler.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });