service_get
Retrieve detailed information about a specific Kubernetes Service, including configuration and status, to monitor and manage cluster networking resources.
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 | ||
| namespace | Yes | ||
| name | Yes |
Implementation Reference
- tools/service.py:58-80 (handler)The main handler function for the 'service_get' tool, decorated with @mcp.tool() for registration and @use_current_context. It retrieves detailed information about a specific Kubernetes Service using the Kubernetes API.@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 }
- server/server.py:22-22 (registration)Import of the service tools module in the load_modules function, which triggers the execution of decorators and registers the 'service_get' tool.import tools.service # noqa: F401