Skip to main content
Glama

replicaset_create

Create a Kubernetes ReplicaSet to maintain a specified number of pod replicas for application availability and scaling.

Instructions

Create a ReplicaSet in the specified namespace.

Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The ReplicaSet name image: The container image to use replicas: Number of replicas labels: Labels to apply to the ReplicaSet

Returns: Status of the creation operation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
context_nameYes
namespaceYes
nameYes
imageYes
replicasYes
labelsYes

Implementation Reference

  • The handler function for the 'replicaset_create' tool. It creates a Kubernetes ReplicaSet with the given parameters using the Kubernetes AppsV1Api client. Includes decorators for MCP tool registration, context usage, and permission checks.
    @mcp.tool()
    @use_current_context
    @check_readonly_permission
    def replicaset_create(context_name: str, namespace: str, name: str, image: str, replicas: int, labels: dict):
        """
        Create a ReplicaSet in the specified namespace.
    
        Args:
            context_name: The Kubernetes context name
            namespace: The Kubernetes namespace
            name: The ReplicaSet name
            image: The container image to use
            replicas: Number of replicas
            labels: Labels to apply to the ReplicaSet
    
        Returns:
            Status of the creation operation
        """
        apps_v1: AppsV1Api = get_api_clients(context_name)["apps"]
        replicaset = V1ReplicaSet(
            metadata=V1ObjectMeta(name=name, labels=labels),
            spec={
                "replicas": replicas,
                "selector": V1LabelSelector(match_labels=labels),
                "template": V1PodTemplateSpec(
                    metadata=V1ObjectMeta(labels=labels),
                    spec=V1PodSpec(containers=[V1Container(name=name, image=image)])
                )
            }
        )
        created_replicaset = apps_v1.create_namespaced_replica_set(namespace=namespace, body=replicaset)
        return {"name": created_replicaset.metadata.name, "status": "Created"}
  • server/server.py:7-27 (registration)
    The load_modules function imports the tools.replicaset module (line 19), which executes the @mcp.tool decorators to register the 'replicaset_create' tool with the MCP server.
    def load_modules():
        import resources.contexts  # noqa: F401
        import tools.cluster  # noqa: F401
        import tools.configmap  # noqa: F401
        import tools.daemonset  # noqa: F401
        import tools.deployment  # noqa: F401
        import tools.ingress  # noqa: F401
        import tools.namespace  # noqa: F401
        import tools.node  # noqa: F401
        import tools.pod  # noqa: F401
        import tools.pv  # noqa: F401
        import tools.pvc  # noqa: F401
        import tools.replicaset  # noqa: F401
        import tools.role  # noqa: F401
        import tools.secret  # noqa: F401
        import tools.service  # noqa: F401
        import tools.serviceaccount  # noqa: F401
        import tools.statefulset  # noqa: F401
    
    
    load_modules()
Behavior2/5

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

With no annotations provided, the description carries full burden. It states 'Create a ReplicaSet' which implies a write/mutation operation, but doesn't disclose behavioral traits like required permissions, whether it's idempotent, what happens on failure, or typical response formats. The 'Returns: Status of the creation operation' is vague about what that status includes.

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 clear sections (purpose, Args, Returns). Each sentence earns its place, though the 'Returns' statement could be more informative. It's appropriately sized for a 6-parameter creation tool without unnecessary verbosity.

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?

For a mutation tool with 6 parameters, 0% schema coverage, no annotations, and no output schema, the description does an adequate job explaining parameters but lacks crucial context. It doesn't cover error conditions, authentication requirements, or what the return 'Status' actually contains. Given the complexity, it should provide more operational guidance.

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

Parameters4/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 provides a clear Args section explaining each of the 6 parameters with meaningful context (e.g., 'The Kubernetes context name', 'Labels to apply to the ReplicaSet'). This adds substantial value beyond the bare schema, though some details like label format expectations could be more specific.

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 verb 'Create' and resource 'ReplicaSet' with specific location 'in the specified namespace.' It distinguishes from siblings like replicaset_delete, replicaset_get, replicaset_list, and replicaset_update 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., existing namespace, cluster access), compare to similar tools like deployment_create, or specify scenarios where a ReplicaSet is preferred over other workload controllers.

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