Skip to main content
Glama

Fetch Pod Container Logs

get_pod_logs
Read-onlyIdempotent

Fetch recent stdout/stderr logs from a Kubernetes pod or specific container to inspect startup errors, stack traces, and sidecar output.

Instructions

Fetch the most recent stdout/stderr log lines from a pod or one specific container inside it.

Returns cluster_id, namespace, pod_name, container, tail_lines, and raw logs text. Omit container for single-container pods (or default container) and adjust tail_lines between 10 and 5000 (default 200).

Use when reading application stack traces, startup logs, or sidecar container output. Prefer get_pod_details when you also need probe definitions, OOM/exit codes, and 12-Step lifecycle status, or get_events for Kubernetes scheduling and kubelet events.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "cluster_id": "<cluster_id>",
      "namespace": "<namespace>",
      "pod_name": "<pod_name>"
    },
    "name": "get_pod_logs"
  }
}

Input Schema

NameRequiredDescriptionDefault
pod_nameYesExact Kubernetes pod name inside `namespace` (1-253 chars, e.g. 'api-7c9f8b-x9k2p'). Obtain pod names from `get_namespace_resources` or `get_workloads_catalog`.
containerNoOptional container name (1-63 chars) inside a multi-container or sidecar pod. Omit or pass null to fetch logs from the pod's default/primary container.
namespaceYesTarget Kubernetes namespace name (1-63 chars, e.g. 'default', 'prod'). Use `get_namespaces` to discover available namespaces on the cluster.
cluster_idYesUnique KubeOrbit cluster identifier returned by `list_teams_and_clusters` (1-63 URL-safe chars, e.g. 'gke-prod-us', 'eks-staging').
tail_linesNoNumber of trailing log lines to return from the end of the container log stream (10-5000, default 200).

Output Schema

NameRequiredDescriptionDefault
logsNoRaw newline-delimited container stdout/stderr log output.
pod_nameNoPod name.
containerNoContainer queried, or null when using the default container.
namespaceNoPod namespace.
cluster_idNoCluster identifier queried.
tail_linesNoMaximum trailing line count requested.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed18 schema fields changedv0.1.1
    • addedInput schema / properties / cluster_id / description
      Added value: +"Unique KubeOrbit cluster identifier returned by `list_teams_and_clusters` (1-63 URL-safe chars, e.g. 'gke-prod-us', 'eks-staging')."
    • addedInput schema / properties / cluster_id / maxLength
      Added value: +63
    • addedInput schema / properties / cluster_id / minLength
      Added value: +1
    • addedInput schema / properties / cluster_id / pattern
      Added value: +"^[a-zA-Z0-9][a-zA-Z0-9._-]{0,62}$"
    • changedInput schema / properties / container / anyOf
      Previous value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "maxLength": 63,
      +    "minLength": 1,
      +    "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._-]{0,62}$",
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • addedInput schema / properties / container / description
      Added value: +"Optional container name (1-63 chars) inside a multi-container or sidecar pod. Omit or pass null to fetch logs from the pod's default/primary container."
    • addedInput schema / properties / namespace / description
      Added value: +"Target Kubernetes namespace name (1-63 chars, e.g. 'default', 'prod'). Use `get_namespaces` to discover available namespaces on the cluster."
    • addedInput schema / properties / namespace / maxLength
      Added value: +63
    • addedInput schema / properties / namespace / minLength
      Added value: +1
    • addedInput schema / properties / namespace / pattern
      Added value: +"^[a-zA-Z0-9][a-zA-Z0-9._-]{0,62}$"
    • addedInput schema / properties / pod_name / description
      Added value: +"Exact Kubernetes pod name inside `namespace` (1-253 chars, e.g. 'api-7c9f8b-x9k2p'). Obtain pod names from `get_namespace_resources` or `get_workloads_catalog`."
    • addedInput schema / properties / pod_name / maxLength
      Added value: +253
    • addedInput schema / properties / pod_name / minLength
      Added value: +1
    • addedInput schema / properties / pod_name / pattern
      Added value: +"^[a-zA-Z0-9][a-zA-Z0-9._-]{0,252}$"
    • addedInput schema / properties / tail_lines / description
      Added value: +"Number of trailing log lines to return from the end of the container log stream (10-5000, default 200)."
    • addedInput schema / properties / tail_lines / maximum
      Added value: +5000
    • addedInput schema / properties / tail_lines / minimum
      Added value: +10
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": true,
      +  "properties": {
      +    "cluster_id": {
      +      "default": "",
      +      "description": "Cluster identifier queried.",
      +      "title": "Cluster Id",
      +      "type": "string"
      +    },
      +    "container": {
      +      "anyOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "default": null,
      +      "description": "Container queried, or null when using the default container.",
      +      "title": "Container"
      +    },
      +    "logs": {
      +      "default": "",
      +      "description": "Raw newline-delimited container stdout/stderr log output.",
      +      "title": "Logs",
      +      "type": "string"
      +    },
      +    "namespace": {
      +      "default": "",
      +      "description": "Pod namespace.",
      +      "title": "Namespace",
      +      "type": "string"
      +    },
      +    "pod_name": {
      +      "default": "",
      +      "description": "Pod name.",
      +      "title": "Pod Name",
      +      "type": "string"
      +    },
      +    "tail_lines": {
      +      "default": 200,
      +      "description": "Maximum trailing line count requested.",
      +      "title": "Tail Lines",
      +      "type": "integer"
      +    }
      +  },
      +  "title": "PodLogsOutput",
      +  "type": "object"
      +}
  2. First observedv0.1.0

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, destructiveHint=false and openWorldHint=false, so safety is covered. The description adds useful behavior: omitting container falls back to the default/primary container, and tail_lines is bounded 10-5000 with a default of 200. It stops short of disclosing truncation limits, whether previous/crashed-container logs are reachable, or rate limiting, so it is good but not rich.

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?

Three short paragraphs, front-loaded with the action and its scope, then parameter guidance, then alternatives. The enumeration of return fields duplicates the output schema and is the only sentence that does not fully earn its place.

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

Completeness4/5

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

With an output schema present, the description need not explain return values, and it covers container selection, tail sizing and sibling routing adequately. A remaining gap is whether logs can be fetched for a previously crashed/restarted container instance, which is a common reason to reach for this tool.

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 every parameter including cluster_id, namespace, pod_name, container and tail_lines is already documented with patterns and bounds. The description mostly restates the container-omission rule and the 10-5000 range already present in the schema, adding little new meaning.

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

Purpose5/5

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

The first sentence names a specific verb and resource ('fetch ... stdout/stderr log lines') and scopes it to a pod or one container inside it. An agent can distinguish it from get_pod_details or get_events without opening the schema.

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

Usage Guidelines5/5

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

The third paragraph gives explicit use cases (stack traces, startup logs, sidecar output) and names two alternatives with the exact conditions that select them: get_pod_details for probe definitions, OOM/exit codes and lifecycle status, get_events for scheduling and kubelet events.

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