Skip to main content
Glama

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
NameRequiredDescriptionDefault
context_nameYes
namespaceYes

Implementation Reference

  • 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()

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bourbonkk/k8s-pilot'

If you have feedback or need assistance with the MCP directory API, please join our Discord server