Skip to main content
Glama

serviceaccount_list

List all ServiceAccounts in a specified Kubernetes namespace. Retrieve essential details for each ServiceAccount to manage and monitor cluster resources efficiently. Works within the k8s-pilot MCP server, supporting multi-cluster operations.

Instructions

List all ServiceAccounts in a given namespace.

Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace

Returns: List of ServiceAccount basic information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
context_nameYes
namespaceYes

Implementation Reference

  • The handler function that implements the logic for listing ServiceAccounts in a specified namespace using Kubernetes API.
    @mcp.tool() @use_current_context def serviceaccount_list(context_name: str, namespace: str): """ List all ServiceAccounts in a given namespace. Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace Returns: List of ServiceAccount basic information """ core_v1: CoreV1Api = get_api_clients(context_name)["core"] serviceaccounts = core_v1.list_namespaced_service_account(namespace) result = [{"name": sa.metadata.name} for sa in serviceaccounts.items] return result
  • server/server.py:23-23 (registration)
    The import statement that loads the serviceaccount.py module, triggering the registration of the serviceaccount_list tool via its @mcp.tool() decorator.
    import tools.serviceaccount # noqa: F401

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bourbonkk/k8s-pilot'

If you have feedback or need assistance with the MCP directory API, please join our Discord server