deployment_list
List all Kubernetes deployments in a specified namespace to monitor application resources and manage cluster configurations.
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, decorated with @mcp.tool(). It lists deployments in the specified namespace using the Kubernetes AppsV1Api.@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
- server/server.py:7-27 (registration)The load_modules function imports the tools.deployment module (line 12), which triggers the registration of the @mcp.tool() decorated functions including deployment_list.def load_modules(): import resources.contexts # noqa: F401 import tools.cluster # noqa: F401 import tools.configmap # noqa: F401 import tools.daemonset # noqa: F401 import tools.deployment # noqa: F401 import tools.ingress # noqa: F401 import tools.namespace # noqa: F401 import tools.node # noqa: F401 import tools.pod # noqa: F401 import tools.pv # noqa: F401 import tools.pvc # noqa: F401 import tools.replicaset # noqa: F401 import tools.role # noqa: F401 import tools.secret # noqa: F401 import tools.service # noqa: F401 import tools.serviceaccount # noqa: F401 import tools.statefulset # noqa: F401 load_modules()