Skip to main content
Glama

service_update

Modify Kubernetes Service metadata like labels to reflect changes in cluster organization or routing requirements.

Instructions

Update an existing Service's metadata (e.g., labels).

Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The Service name labels: New labels to apply to the Service

Returns: Status of the update operation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
context_nameYes
namespaceYes
nameYes
labelsYes

Implementation Reference

  • Handler function for the MCP tool 'service_update', which patches labels on an existing Kubernetes Service. Registered using the @mcp.tool() decorator.
    @mcp.tool()
    @use_current_context
    @check_readonly_permission
    def service_update(context_name: str, namespace: str, name: str, labels: dict):
        """
        Update an existing Service's metadata (e.g., labels).
    
        Args:
            context_name: The Kubernetes context name
            namespace: The Kubernetes namespace
            name: The Service name
            labels: New labels to apply to the Service
    
        Returns:
            Status of the update operation
        """
        core_v1: CoreV1Api = get_api_clients(context_name)["core"]
        service = core_v1.read_namespaced_service(name=name, namespace=namespace)
        service.metadata.labels = labels
        updated_service = core_v1.patch_namespaced_service(name=name, namespace=namespace, body={"metadata": {"labels": labels}})
        return {"name": updated_service.metadata.name, "status": "Updated", "labels": updated_service.metadata.labels}

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