service_list
List all Services in a specified Kubernetes namespace using context_name and namespace inputs. Retrieve Service basic information for efficient cluster management.
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:8-24 (handler)The service_list tool handler function. Lists Kubernetes Services in the given namespace using CoreV1Api, decorated with @mcp.tool() for registration and @use_current_context for context management.@mcp.tool() @use_current_context 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
- server/server.py:22-22 (registration)Import of tools.service module in load_modules() function, which triggers registration of all service-related tools including service_list via their @mcp.tool() decorators.import tools.service # noqa: F401