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")
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It states it's a list operation but doesn't disclose behavioral traits like whether it requires specific permissions, how it handles errors, if results are paginated, or what format 'basic information' includes. For a read operation with zero annotation coverage, this leaves significant gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is efficiently structured with a clear purpose statement followed by Args and Returns sections. Every sentence adds value, and there's no redundant information. It could be slightly more front-loaded by integrating parameter hints into the main description, but overall it's well-organized and concise.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (list operation with 2 required parameters), no annotations, and no output schema, the description is minimally adequate. It covers the purpose and parameters but lacks details on behavior, output format beyond 'basic information', error handling, or usage context. For a tool in a Kubernetes environment with many siblings, it should provide more guidance.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the schema provides no parameter descriptions. The description adds basic semantics by explaining 'context_name' as 'The Kubernetes context name' and 'namespace' as 'The Kubernetes namespace', which clarifies what these parameters represent. However, it doesn't provide format examples, constraints, or how they interact, leaving room for improvement.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('List all') and resource ('ServiceAccounts') with scope ('in a given namespace'), making the purpose unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'serviceaccount_get' or 'serviceaccount_delete', which would require more specific comparison.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With sibling tools like 'serviceaccount_get' (for individual ServiceAccounts) and 'serviceaccount_list' (for all in namespace), there's no indication of when to choose one over the other, nor any prerequisites or exclusions mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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