Skip to main content
Glama

pod_detail

Retrieve detailed information about a specific Kubernetes pod, including its configuration, status, and resource usage within a cluster.

Instructions

Get details of a specific pod.

Args: context_name: The Kubernetes context name namespace: The Kubernetes namespace name: The pod name

Returns: Detailed information about the pod

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
context_nameYes
namespaceYes
nameYes

Implementation Reference

  • The primary handler function for the 'pod_detail' MCP tool. Decorated with @mcp.tool() for automatic registration. Retrieves a Kubernetes pod by name and namespace, parses its spec, status, metadata, volumes, containers, networking info, and conditions, then returns a comprehensive structured dictionary.
    @mcp.tool()
    @use_current_context
    def pod_detail(context_name: str, namespace: str, name: str):
        """
        Get details of a specific pod.
    
        Args:
            context_name: The Kubernetes context name
            namespace: The Kubernetes namespace
            name: The pod name
    
        Returns:
            Detailed information about the pod
        """
        core_v1: CoreV1Api = get_api_clients(context_name)["core"]
        pod = core_v1.read_namespaced_pod(name, namespace)
    
        containers = []
        for c in pod.spec.containers:
            container_info = {
                "name": c.name,
                "image": c.image,
                "ports": [{"container_port": p.container_port, "protocol": p.protocol} for p in (c.ports or [])],
                "resources": {
                    "requests": c.resources.requests if c.resources and hasattr(c.resources, "requests") else {},
                    "limits": c.resources.limits if c.resources and hasattr(c.resources, "limits") else {}
                },
                "environment": [{"name": env.name, "value": env.value if hasattr(env, "value") else "from secret"}
                                for env in (c.env or [])]
            }
            containers.append(container_info)
    
        volumes = []
        if pod.spec.volumes:
            for vol in pod.spec.volumes:
                volume_info = {"name": vol.name}
                # 볼륨 타입 확인 및 정보 추가
                if hasattr(vol, "config_map") and vol.config_map:
                    volume_info["type"] = "configMap"
                    volume_info["config_map_name"] = vol.config_map.name
                elif hasattr(vol, "secret") and vol.secret:
                    volume_info["type"] = "secret"
                    volume_info["secret_name"] = vol.secret.secret_name
                elif hasattr(vol, "persistent_volume_claim") and vol.persistent_volume_claim:
                    volume_info["type"] = "pvc"
                    volume_info["claim_name"] = vol.persistent_volume_claim.claim_name
                elif hasattr(vol, "host_path") and vol.host_path:
                    volume_info["type"] = "hostPath"
                    volume_info["path"] = vol.host_path.path
                elif hasattr(vol, "empty_dir") and vol.empty_dir:
                    volume_info["type"] = "emptyDir"
                else:
                    volume_info["type"] = "other"
                volumes.append(volume_info)
    
        conditions = []
        if pod.status.conditions:
            for condition in pod.status.conditions:
                conditions.append({
                    "type": condition.type,
                    "status": condition.status,
                    "last_transition_time": condition.last_transition_time,
                    "reason": condition.reason,
                    "message": condition.message
                })
    
        networking = {
            "pod_ip": pod.status.pod_ip,
            "host_ip": pod.status.host_ip,
            "node_name": pod.spec.node_name
        }
    
        metadata = {
            "creation_timestamp": pod.metadata.creation_timestamp,
            "labels": pod.metadata.labels or {},
            "annotations": pod.metadata.annotations or {},
            "owner_references": [{
                "kind": ref.kind,
                "name": ref.name,
                "uid": ref.uid
            } for ref in (pod.metadata.owner_references or [])]
        }
    
        status_info = {
            "phase": pod.status.phase,
            "start_time": pod.status.start_time,
            "container_statuses": []
        }
    
        if pod.status.container_statuses:
            for cs in pod.status.container_statuses:
                container_status = {
                    "name": cs.name,
                    "ready": cs.ready,
                    "restart_count": cs.restart_count,
                    "image": cs.image,
                    "image_id": cs.image_id,
                    "container_id": cs.container_id
                }
    
                if cs.state:
                    state_info = {}
                    if hasattr(cs.state, "running") and cs.state.running:
                        state_info["current"] = "running"
                        state_info["started_at"] = cs.state.running.started_at
                    elif hasattr(cs.state, "waiting") and cs.state.waiting:
                        state_info["current"] = "waiting"
                        state_info["reason"] = cs.state.waiting.reason
                        state_info["message"] = cs.state.waiting.message
                    elif hasattr(cs.state, "terminated") and cs.state.terminated:
                        state_info["current"] = "terminated"
                        state_info["exit_code"] = cs.state.terminated.exit_code
                        state_info["reason"] = cs.state.terminated.reason
                        state_info["message"] = cs.state.terminated.message
                        state_info["started_at"] = cs.state.terminated.started_at
                        state_info["finished_at"] = cs.state.terminated.finished_at
    
                    container_status["state"] = state_info
    
                status_info["container_statuses"].append(container_status)
    
        result = {
            "name": pod.metadata.name,
            "namespace": pod.metadata.namespace,
            "status": status_info,
            "spec": {
                "containers": containers,
                "volumes": volumes,
                "restart_policy": pod.spec.restart_policy,
                "service_account": pod.spec.service_account,
                "dns_policy": pod.spec.dns_policy,
                "node_selector": pod.spec.node_selector or {},
                "tolerations": [{
                    "key": t.key,
                    "operator": t.operator,
                    "effect": t.effect,
                    "toleration_seconds": t.toleration_seconds
                } for t in (pod.spec.tolerations or [])]
            },
            "metadata": metadata,
            "networking": networking,
            "conditions": conditions
        }
    
        return result
  • tools/pod.py:29-29 (registration)
    The @mcp.tool() decorator registers the pod_detail function as an MCP tool.
    @mcp.tool()
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states this is a 'Get' operation which implies read-only behavior, but doesn't explicitly confirm this is non-destructive. It doesn't mention authentication requirements, rate limits, error conditions, or what format the 'detailed information' returns. For a Kubernetes tool with zero annotation coverage, this leaves significant behavioral questions unanswered.

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 efficiently structured with a clear purpose statement followed by Args and Returns sections. Every sentence earns its place - the first states what the tool does, the Args section lists parameters, and Returns indicates output type. No wasted words or redundant information.

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?

For a Kubernetes tool with 3 parameters, no annotations, and no output schema, the description is incomplete. It doesn't explain Kubernetes concepts (context, namespace), doesn't specify what 'detailed information' includes, and provides no error handling or permission guidance. Given the complexity of Kubernetes operations and lack of structured metadata, the description should do more to help an agent use this tool correctly.

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 0%, so the schema provides no parameter descriptions. The description adds basic semantics by listing the three parameters with brief labels (context_name, namespace, name), which helps understand what each parameter represents. However, it doesn't provide format requirements, examples, or explain Kubernetes-specific concepts like what a 'context' is. The description compensates partially but not fully for the schema gap.

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 'Get details of a specific pod' which is a specific verb+resource combination. It distinguishes itself from siblings like pod_list (lists multiple pods) and pod_logs (gets logs rather than general details). However, it doesn't explicitly differentiate from other 'get' tools like pod_get (if that existed) or specify what 'details' encompass.

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 when to choose pod_detail over pod_list (for a single pod vs multiple), pod_logs (for logs vs general details), or other resource-specific get tools. There's no context about prerequisites or typical use cases.

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/bourbonkk/k8s-pilot'

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