service_get
Retrieve detailed information about a specific Kubernetes Service by providing the context name, namespace, and Service name using the k8s-pilot MCP server.
Instructions
Get details of a specific Service.
Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The Service name
Returns: Detailed information about the Service
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| context_name | Yes | ||
| name | Yes | ||
| namespace | Yes |
Implementation Reference
- tools/service.py:58-80 (handler)The handler function decorated with @mcp.tool() implements the 'service_get' tool. It fetches a specific Kubernetes Service from the given namespace using the CoreV1Api and returns its details including name, type, cluster IP, ports, and selector.@mcp.tool() @use_current_context def service_get(context_name: str, namespace: str, name: str): """ Get details of a specific Service. Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The Service name Returns: Detailed information about the Service """ core_v1: CoreV1Api = get_api_clients(context_name)["core"] service = core_v1.read_namespaced_service(name=name, namespace=namespace) return { "name": service.metadata.name, "type": service.spec.type, "cluster_ip": service.spec.cluster_ip, "ports": [{"port": port.port, "target_port": port.target_port} for port in service.spec.ports], "selector": service.spec.selector }
- tools/service.py:58-58 (registration)The @mcp.tool() decorator registers the service_get function as an MCP tool.@mcp.tool()