Skip to main content
Glama

k8s.app_status

Check application status in Kubernetes by retrieving pod state information for specified namespace and app label.

Instructions

dada un nombre de aplicacion, busca el estado de los pods

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
namespaceYesnamespace del pod
appYesapplication label o pod name

Implementation Reference

  • src/index.ts:37-65 (registration)
    Registration of the 'k8s.app_status' tool, including description, input schema, and handler function that calls getPodInfo and returns JSON results.
    server.registerTool(
        "k8s.app_status",
        {
            description: "dada un nombre de aplicacion, busca el estado de los pods",
            inputSchema:z.object(
                {
                    namespace: z.string().describe("namespace del pod"),
                    app: z.string().describe("application label o pod name"),
                }
            ),
        },
    
        async (args) => {
            const results = await getPodInfo(
                args.namespace,
                args.app
            );
        return {
            content: [
              {
                type: "text", 
                text: JSON.stringify(results, null, 2),  
              },
            ],
          };
    
        }
    
    )
  • Main handler logic for k8s.app_status: executes kubectl to get pod list by app label/name/namespace and describe each pod, returns PodInfo.
    export async function getPodInfo(
      namespace: string,
      app: string
    ): Promise<PodInfo> {
      const result: PodInfo = {
        namespace,
        app,
        podsList: '',
        podDescriptions: {},
      };
    
      try {
        // 1. Obtener lista de pods
        // Si 'app' es "*", listar todos los pods
        // Si 'app' parece ser un nombre completo de pod, usar ese nombre
        // Si no, buscar por label app=<app>
        let getPodsCommand: string;
        
        if (app === '*' || app === 'all') {
          // Listar todos los pods del namespace
          getPodsCommand = `kubectl get pods -n ${namespace} -o wide`;
        } else if (app.includes('-')) {
          // Probablemente es un nombre de pod completo
          getPodsCommand = `kubectl get pods ${app} -n ${namespace} -o wide`;
        } else {
          // Buscar por label
          getPodsCommand = `kubectl get pods -n ${namespace} -l app=${app} -o wide`;
        }
    
        const { stdout: podsListOutput, stderr: getPodsError } = await execAsync(getPodsCommand);
        
        if (getPodsError && getPodsError.trim()) {
          console.warn('Warning getting pods:', getPodsError);
        }
    
        result.podsList = podsListOutput.trim();
    
        // 2. Parsear nombres de pods de la salida (omitir la línea de encabezado)
        const podLines = podsListOutput.trim().split('\n').slice(1);
        const podNames = podLines
          .map(line => line.trim().split(/\s+/)[0])
          .filter(name => name && name.length > 0);
    
        // 3. Describir cada pod
        for (const podName of podNames) {
          try {
            const describeCommand = `kubectl describe pod ${podName} -n ${namespace}`;
            const { stdout: describeOutput } = await execAsync(describeCommand);
            result.podDescriptions[podName] = describeOutput.trim();
          } catch (describeError: any) {
            result.podDescriptions[podName] = `Error describing pod: ${describeError.message}`;
          }
        }
    
      } catch (error: any) {
        result.error = `Error executing kubectl commands: ${error.message}`;
        console.error('Error in getPodInfo:', error);
      }
    
      return result;
    }
  • Input schema for k8s.app_status tool using Zod: requires namespace and app strings.
    inputSchema:z.object(
        {
            namespace: z.string().describe("namespace del pod"),
            app: z.string().describe("application label o pod name"),
        }
    ),
  • TypeScript interface defining the output structure of getPodInfo (PodInfo).
    export interface PodInfo {
      namespace: string;
      app: string;
      podsList: string;
      podDescriptions: { [podName: string]: string };
      error?: string;
  • Helper to promisify child_process.exec for async kubectl command execution.
    import { exec } from 'child_process';
    import { promisify } from 'util';
    
    const execAsync = promisify(exec);
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the tool searches for pod status but doesn't disclose behavioral traits like whether it's read-only, what format the status returns, error conditions, or any rate limits. This leaves significant gaps in understanding how the tool behaves.

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

Conciseness4/5

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

The description is a single, efficient sentence that directly states the tool's purpose. It's appropriately sized and front-loaded with no wasted words, though it could benefit from slightly more detail given the lack of annotations.

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

Completeness2/5

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

Given no annotations and no output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., status format, possible values) or address behavioral aspects like error handling. For a tool with 2 required parameters and no structured output documentation, this leaves the agent with insufficient context.

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?

Schema description coverage is 100%, so the schema already documents both parameters ('namespace' and 'app'). The description mentions 'nombre de aplicacion' (application name) which aligns with the 'app' parameter but doesn't add meaningful semantics beyond what the schema provides. Baseline 3 is appropriate when schema does the heavy lifting.

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: 'busca el estado de los pods' (searches for pod status) given an application name. It specifies both the action (search) and resource (pod status), though it doesn't explicitly differentiate from the sibling tool 'k8s.pod_logs' which likely retrieves logs rather than status.

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 the sibling tool 'k8s.pod_logs' or any other context for choosing between them, leaving the agent without explicit usage instructions.

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/nicolasmosquerar/k8s-mcp-assistant'

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