Skip to main content
Glama

statefulset_update

Update Kubernetes StatefulSets by modifying container images and replica counts for application deployment management.

Instructions

Update an existing StatefulSet in the specified namespace.

Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The StatefulSet name image: The new container image to update replicas: The new number of replicas

Returns: Status of the update operation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
context_nameYes
namespaceYes
nameYes
imageYes
replicasYes

Implementation Reference

  • The handler function for the 'statefulset_update' tool. It reads the existing StatefulSet, updates the container image and replicas count, then replaces it using the Kubernetes AppsV1Api. Registered via @mcp.tool() decorator.
    @mcp.tool()
    @use_current_context
    @check_readonly_permission
    def statefulset_update(context_name: str, namespace: str, name: str, image: str, replicas: int):
        """
        Update an existing StatefulSet in the specified namespace.
    
        Args:
            context_name: The Kubernetes context name
            namespace: The Kubernetes namespace
            name: The StatefulSet name
            image: The new container image to update
            replicas: The new number of replicas
    
        Returns:
            Status of the update operation
        """
        apps_v1: AppsV1Api = get_api_clients(context_name)["apps"]
        statefulset = apps_v1.read_namespaced_stateful_set(name=name, namespace=namespace)
        statefulset.spec.template.spec.containers[0].image = image
        statefulset.spec.replicas = replicas
        updated_statefulset = apps_v1.replace_namespaced_stateful_set(name=name, namespace=namespace, body=statefulset)
        return {"name": updated_statefulset.metadata.name, "status": "Updated"}
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states this is an update operation but doesn't describe what happens during the update (e.g., rolling restart, pod recreation), permission requirements, potential downtime, or error conditions. The return value description ('Status of the update operation') is vague and unhelpful for understanding outcomes.

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) and uses minimal sentences. The purpose statement is front-loaded. However, the 'Returns' section adds little value with its vague phrasing, and the description could be more efficient by integrating parameter explanations into the flow rather than a separate list.

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?

For a mutation tool with 5 parameters, 0% schema coverage, no annotations, and no output schema, the description is insufficient. It lacks critical behavioral context about how the update works, what permissions are needed, potential side effects, and what the return status actually contains. The parameter semantics are good, but overall completeness is poor for this complex operation.

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 clear semantic meaning for all 5 parameters beyond their titles, explaining what each represents in Kubernetes context (e.g., 'Kubernetes context name', 'new container image to update'). This adds significant value over the bare schema, though it doesn't cover format details like image tag syntax.

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 ('Update') and resource ('existing StatefulSet') with location context ('in the specified namespace'). It distinguishes from sibling tools like statefulset_create and statefulset_delete by specifying it updates existing resources. However, it doesn't explicitly differentiate from other update tools like deployment_update or configmap_update beyond the resource type.

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., the StatefulSet must exist), compare with similar update tools for other resource types, or indicate when statefulset_create might be more appropriate. The agent must infer usage from the tool name alone.

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