serviceaccount_get
Retrieve detailed information about a specific Kubernetes ServiceAccount, including its configuration and permissions, by specifying context, namespace, and name.
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 | ||
| namespace | Yes | ||
| name | Yes |
Implementation Reference
- tools/serviceaccount.py:51-71 (handler)The handler function for the 'serviceaccount_get' tool. It retrieves detailed information about a specific Kubernetes ServiceAccount using the CoreV1Api client. The function is decorated with @mcp.tool() for registration and @use_current_context for context management.@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 }