deployment_list
Retrieve a list of Kubernetes Deployments in a specified namespace using the k8s-pilot MCP server. Streamlines cluster management by providing basic deployment information for efficient context-based operations.
Instructions
List all Deployments in a given namespace.
Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace
Returns: List of Deployment basic information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| context_name | Yes | ||
| namespace | Yes |
Implementation Reference
- tools/deployment.py:8-24 (handler)The main handler function for the 'deployment_list' tool. It lists deployments in a Kubernetes namespace using the AppsV1Api. Decorated with @mcp.tool() for registration and @use_current_context for context management.@mcp.tool() @use_current_context def deployment_list(context_name: str, namespace: str): """ List all Deployments in a given namespace. Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace Returns: List of Deployment basic information """ apps_v1: AppsV1Api = get_api_clients(context_name)["apps"] deployments = apps_v1.list_namespaced_deployment(namespace) result = [{"name": dep.metadata.name} for dep in deployments.items] return result
- tools/deployment.py:8-8 (registration)Registers the deployment_list function as an MCP tool using the @mcp.tool() decorator.@mcp.tool()