serviceaccount_get
Retrieve detailed information about a specific ServiceAccount in Kubernetes by specifying the context, namespace, and name. Simplify cluster resource management with this tool on the k8s-pilot MCP server.
Instructions
Get details of a specific ServiceAccount.
Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The ServiceAccount name
Returns: Detailed information about the ServiceAccount
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| context_name | Yes | ||
| name | Yes | ||
| namespace | Yes |
Implementation Reference
- tools/serviceaccount.py:51-71 (handler)The serviceaccount_get tool handler function, which retrieves details of a specific Kubernetes ServiceAccount using the CoreV1Api. Registered via @mcp.tool() decorator.@mcp.tool() @use_current_context def serviceaccount_get(context_name: str, namespace: str, name: str): """ Get details of a specific ServiceAccount. Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The ServiceAccount name Returns: Detailed information about the ServiceAccount """ core_v1: CoreV1Api = get_api_clients(context_name)["core"] serviceaccount = core_v1.read_namespaced_service_account(name=name, namespace=namespace) return { "name": serviceaccount.metadata.name, "labels": serviceaccount.metadata.labels, "secrets": serviceaccount.secrets }