Skip to main content
Glama

service_create

Create a Kubernetes Service to expose pods and manage network access within a cluster namespace.

Instructions

Create a Service in the specified namespace.

Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The Service name selector: A dictionary of labels to select the target pods ports: A list of ports (e.g., [{"port": 80, "target_port": 8080}]) service_type: The type of the Service (default is "ClusterIP")

Returns: Status of the creation operation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
context_nameYes
namespaceYes
nameYes
selectorYes
portsYes
service_typeNoClusterIP

Implementation Reference

  • The service_create tool handler, decorated with @mcp.tool() for registration, @use_current_context, and @check_readonly_permission. It creates a Kubernetes Service object using kubernetes.client.CoreV1Api and applies it to the specified namespace.
    @mcp.tool()
    @use_current_context
    @check_readonly_permission
    def service_create(context_name: str, namespace: str, name: str, selector: dict, ports: list, service_type: str = "ClusterIP"):
        """
        Create a Service in the specified namespace.
    
        Args:
            context_name: The Kubernetes context name
            namespace: The Kubernetes namespace
            name: The Service name
            selector: A dictionary of labels to select the target pods
            ports: A list of ports (e.g., [{"port": 80, "target_port": 8080}])
            service_type: The type of the Service (default is "ClusterIP")
    
        Returns:
            Status of the creation operation
        """
        core_v1: CoreV1Api = get_api_clients(context_name)["core"]
        service = V1Service(
            metadata=V1ObjectMeta(name=name),
            spec=V1ServiceSpec(
                selector=selector,
                ports=[V1ServicePort(port=port["port"], target_port=port["target_port"]) for port in ports],
                type=service_type
            )
        )
        created_service = core_v1.create_namespaced_service(namespace=namespace, body=service)
        return {"name": created_service.metadata.name, "status": "Created"}
  • tools/service.py:27-27 (registration)
    The @mcp.tool() decorator registers the service_create function as an MCP tool.
    @mcp.tool()
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. While 'Create' implies a write operation, it doesn't specify permissions required, whether the operation is idempotent, what happens on conflict, or any rate limits. The return statement 'Status of the creation operation' is vague about success/failure indicators.

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 serves a purpose, and the parameter explanations are efficient. The front-loaded purpose statement is clear, though the Args section could be slightly more concise.

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 6-parameter creation tool with no annotations and no output schema, the description covers parameters adequately but lacks important context. It doesn't explain Kubernetes-specific concepts, error conditions, or what the return 'Status' contains. Given the complexity (nested objects, no output schema), more behavioral context would be helpful.

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?

With 0% schema description coverage, the description compensates well by explaining all 6 parameters in the Args section. It clarifies what each parameter represents (e.g., 'selector: A dictionary of labels to select the target pods') and provides examples for complex parameters like ports. This adds significant value beyond the bare schema.

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 Service') and specifies the target resource ('in the specified namespace'). It distinguishes from sibling tools like service_get, service_list, service_update, and service_delete by focusing on creation. However, it doesn't explicitly differentiate from other creation tools like deployment_create or pod_create beyond mentioning 'Service'.

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. With many sibling tools including service_update, service_get, and other resource creation tools, there's no mention of prerequisites, when this is appropriate, or what alternatives exist for similar operations.

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