Skip to main content
Glama

k8s_get_deployments

Retrieve Kubernetes deployment details including replica status, strategy, and age for infrastructure management and monitoring.

Instructions

List deployments with replica status, strategy, and age

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
namespaceNoKubernetes namespace (default: 'default')
label_selectorNoLabel selector to filter

Implementation Reference

  • The `getDeployments` function, which fetches and formats Kubernetes deployments from a given namespace.
    export async function getDeployments(args: Record<string, unknown>): Promise<string> {
      const api = getAppsV1Api();
      const namespace = (args.namespace as string) || "default";
      const labelSelector = args.label_selector as string | undefined;
    
      const response = await api.listNamespacedDeployment(
        namespace,
        undefined,
        undefined,
        undefined,
        undefined,
        labelSelector
      );
    
      const deployments = response.body.items;
      if (deployments.length === 0) {
        return `No deployments found in namespace '${namespace}'.`;
      }
    
      const headers = ["NAME", "READY", "UP-TO-DATE", "AVAILABLE", "AGE", "STRATEGY"];
      const rows = deployments.map((dep) => {
        const ready = dep.status?.readyReplicas || 0;
        const desired = dep.spec?.replicas || 0;
        const upToDate = dep.status?.updatedReplicas || 0;
        const available = dep.status?.availableReplicas || 0;
        const age = dep.metadata?.creationTimestamp
          ? formatAge(dep.metadata.creationTimestamp)
          : "?";
        const strategy = dep.spec?.strategy?.type || "RollingUpdate";
    
        return [
          dep.metadata?.name || "unknown",
          `${ready}/${desired}`,
          String(upToDate),
          String(available),
          age,
          strategy,
        ];
      });
    
      return `Deployments in namespace '${namespace}':\n\n${formatTable(headers, rows)}`;
    }
  • The registration point in the switch statement for the `k8s_get_deployments` tool.
    case "k8s_get_deployments": return getDeployments(a);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions what information is listed ('replica status, strategy, and age'), which adds some context beyond the basic 'list' action. However, it lacks details on permissions needed, rate limits, pagination, error handling, or whether it's a read-only operation (though 'get' in the name implies safety). For a tool with zero annotation coverage, this is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core action ('List deployments') and specifies key details ('replica status, strategy, and age'). There is zero waste or redundancy, making it highly concise and well-structured for quick understanding.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (listing deployments with status details), no annotations, no output schema, and 100% schema coverage, the description is minimally adequate. It covers the purpose and output content but lacks behavioral context, usage guidelines, and details on return values. For a read operation with no output schema, it should ideally describe the response format or structure to be more complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with both parameters ('namespace' and 'label_selector') well-documented in the schema. The description does not add any parameter-specific information beyond what the schema provides, such as examples or formatting details. According to the rules, with high schema coverage (>80%), the baseline score is 3 when no param info is in the description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('List') and resource ('deployments'), and specifies what information is included ('replica status, strategy, and age'). It distinguishes itself from sibling tools like 'k8s_get_pods' and 'k8s_get_services' by focusing on deployments. However, it doesn't explicitly differentiate from 'k8s_rollout_status' which also relates to deployments, preventing a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'k8s_get_pods' for pod listings or 'k8s_rollout_status' for deployment status details, nor does it specify prerequisites such as required permissions or cluster context. Usage is implied by the action 'List deployments,' but no explicit context or exclusions are provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/batu-sonmez/infraclaude'

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