Skip to main content
Glama

pod_create

Create a new pod in Kubernetes by specifying namespace, container image, and optional configurations like labels, commands, and environment variables.

Instructions

Create a new pod in the specified namespace.

Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The name for the new pod image: The container image to use labels: Optional dictionary of pod labels command: Optional command to run in the container args: Optional arguments for the command env_vars: Optional environment variables for the container

Returns: Information about the created pod

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
context_nameYes
namespaceYes
nameYes
imageYes
labelsNo
commandNo
argsNo
env_varsNo

Implementation Reference

  • Implementation of the pod_create MCP tool handler. This function creates a new Kubernetes Pod using the CoreV1Api client. It is registered via the @mcp.tool() decorator and includes permission checks and context usage decorators.
    @mcp.tool()
    @use_current_context
    @check_readonly_permission
    def pod_create(context_name: str, namespace: str, name: str, image: str,
                   labels: Optional[Dict[str, str]] = None,
                   command: Optional[List[str]] = None,
                   args: Optional[List[str]] = None,
                   env_vars: Optional[Dict[str, str]] = None):
        """
        Create a new pod in the specified namespace.
    
        Args:
            context_name: The Kubernetes context name
            namespace: The Kubernetes namespace
            name: The name for the new pod
            image: The container image to use
            labels: Optional dictionary of pod labels
            command: Optional command to run in the container
            args: Optional arguments for the command
            env_vars: Optional environment variables for the container
    
        Returns:
            Information about the created pod
        """
        from kubernetes.client import V1Pod, V1ObjectMeta, V1PodSpec, V1Container, V1EnvVar
    
        core_v1: CoreV1Api = get_api_clients(context_name)["core"]
    
        # Prepare environment variables if provided
        container_env = None
        if env_vars:
            container_env = [V1EnvVar(name=k, value=v) for k, v in env_vars.items()]
    
        # Create container
        container = V1Container(
            name=name,
            image=image,
            command=command,
            args=args,
            env=container_env
        )
    
        # Create pod spec
        pod_spec = V1PodSpec(containers=[container])
    
        # Create pod metadata
        pod_metadata = V1ObjectMeta(name=name, namespace=namespace, labels=labels)
    
        # Create pod
        pod = V1Pod(
            api_version="v1",
            kind="Pod",
            metadata=pod_metadata,
            spec=pod_spec
        )
    
        # Create the pod in Kubernetes
        created_pod = core_v1.create_namespaced_pod(namespace=namespace, body=pod)
    
        result = {
            "name": created_pod.metadata.name,
            "namespace": created_pod.metadata.namespace,
            "status": "Created",
        }
        return result
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool creates a pod but lacks critical details: it doesn't mention authentication requirements, potential side effects (e.g., resource consumption), error handling, or what 'Information about the created pod' entails. For a mutation tool with zero annotation coverage, this is a significant gap.

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 parameter details and return information. It's appropriately sized for an 8-parameter tool, though the 'Args' and 'Returns' sections could be slightly more concise by integrating them into flowing text.

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 complexity (8 parameters, no annotations, no output schema), the description is partially complete. It covers parameters well but lacks behavioral context (e.g., permissions, errors) and output details. For a creation tool in a Kubernetes environment, more guidance on usage and implications would improve completeness.

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

Parameters5/5

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

The description adds substantial meaning beyond the input schema, which has 0% description coverage. It lists all 8 parameters with brief explanations (e.g., 'The container image to use', 'Optional dictionary of pod labels'), clarifying their roles in pod creation. This fully compensates for the schema's lack of descriptions.

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

Purpose5/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 new pod') and specifies the resource ('in the specified namespace'), making the purpose explicit. It distinguishes from siblings like pod_delete, pod_update, pod_list, etc., by focusing on creation rather than other 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 proper permissions or context setup), compare to similar tools (e.g., deployment_create for higher-level abstractions), or specify scenarios where pod creation is appropriate over other methods.

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