Skip to main content
Glama

serviceaccount_create

Create a ServiceAccount in Kubernetes to manage cluster access permissions and authentication for applications or users.

Instructions

Create a ServiceAccount in the specified namespace.

Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The ServiceAccount name labels: Optional labels to apply to the ServiceAccount

Returns: Status of the creation operation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
context_nameYes
namespaceYes
nameYes
labelsNo

Implementation Reference

  • The handler function for the 'serviceaccount_create' tool. It is decorated with @mcp.tool() for registration, @use_current_context to set the current context, and @check_readonly_permission for access control. The function creates a Kubernetes ServiceAccount in the given namespace using the CoreV1Api client.
    @mcp.tool()
    @use_current_context
    @check_readonly_permission
    def serviceaccount_create(context_name: str, namespace: str, name: str, labels: dict = None):
        """
        Create a ServiceAccount in the specified namespace.
    
        Args:
            context_name: The Kubernetes context name
            namespace: The Kubernetes namespace
            name: The ServiceAccount name
            labels: Optional labels to apply to the ServiceAccount
    
        Returns:
            Status of the creation operation
        """
        core_v1: CoreV1Api = get_api_clients(context_name)["core"]
        serviceaccount = V1ServiceAccount(
            metadata=V1ObjectMeta(name=name, labels=labels)
        )
        created_serviceaccount = core_v1.create_namespaced_service_account(namespace=namespace, body=serviceaccount)
        return {"name": created_serviceaccount.metadata.name, "status": "Created"}
  • The @mcp.tool() decorator registers the serviceaccount_create function as an MCP tool.
    @mcp.tool()
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states 'Create a ServiceAccount' and 'Returns: Status of the creation operation,' which implies a mutation with a status response, but lacks details on permissions required, whether it's idempotent, error conditions, or side effects. This is inadequate for a mutation tool with zero annotation coverage.

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 well-structured with a clear purpose statement followed by Args and Returns sections. It's appropriately sized with no wasted sentences, though the parameter explanations are minimal. The front-loaded purpose statement helps, but some details could be more informative without sacrificing conciseness.

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

Completeness2/5

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

Given the complexity (a mutation tool with 4 parameters, nested objects in 'labels', no output schema, and no annotations), the description is incomplete. It lacks information on behavioral traits (e.g., auth needs, error handling), detailed parameter usage, and output specifics. For a creation operation in Kubernetes, this leaves significant gaps for an AI agent.

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 description must compensate. It lists all four parameters with brief explanations (e.g., 'The Kubernetes context name'), adding basic meaning beyond the schema's titles. However, it doesn't provide format details, examples, or constraints (e.g., label structure), leaving gaps in understanding. This partially compensates but isn't comprehensive.

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 ('Create a ServiceAccount') and specifies the target resource ('in the specified namespace'), which is a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'serviceaccount_delete' or 'serviceaccount_get', though the verb 'Create' inherently distinguishes it from deletion and retrieval operations.

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. It doesn't mention prerequisites (e.g., needing appropriate permissions), when not to use it (e.g., if a ServiceAccount already exists), or refer to sibling tools like 'serviceaccount_list' for checking existing accounts. Usage is implied by the name and purpose but not explicitly stated.

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