Skip to main content
Glama

serviceaccount_list

List all ServiceAccounts in a specified Kubernetes namespace to manage access controls and permissions across clusters.

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 main handler function for the 'serviceaccount_list' tool. It lists ServiceAccounts in the specified namespace using the Kubernetes CoreV1Api. Decorated with @mcp.tool() for automatic registration and @use_current_context for context management.
    @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 in load_modules() that triggers the execution of the module, thereby registering the tool via its @mcp.tool() decorator.
    import tools.serviceaccount # noqa: F401
  • server/server.py:3-3 (registration)
    Definition of the mcp instance (FastMCP) used for tool registration via decorators.
    mcp = FastMCP("k8s-pilot")

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