service_list
Retrieve a list of all Kubernetes Services in a specified namespace to monitor network endpoints and manage cluster connectivity.
Instructions
List all Services in a given namespace.
Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace
Returns: List of Service basic information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| context_name | Yes | ||
| namespace | Yes |
Implementation Reference
- tools/service.py:10-24 (handler)The handler function that lists Kubernetes Services in the specified namespace using CoreV1Api. Returns a list of service names, types, and cluster IPs.def service_list(context_name: str, namespace: str): """ List all Services in a given namespace. Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace Returns: List of Service basic information """ core_v1: CoreV1Api = get_api_clients(context_name)["core"] services = core_v1.list_namespaced_service(namespace) result = [{"name": svc.metadata.name, "type": svc.spec.type, "cluster_ip": svc.spec.cluster_ip} for svc in services.items] return result
- tools/service.py:8-8 (registration)Registers the service_list tool using the @mcp.tool() decorator.@mcp.tool()