Skip to main content
Glama

k8s_logs

Fetch logs from a Kubernetes pod to debug container issues. Specify pod name, optional namespace, container, and tail lines for targeted log retrieval.

Instructions

Fetch logs from a pod.

Read-only: runs kubectl logs only — never mutates the cluster, idempotent. Requires read access to pod logs; raises on kubectl failure (e.g. pod NotFound, container not yet started, Forbidden). Output is truncated to ~50 KB.

Args: pod: Pod name (required). namespace: Target namespace. container: Container name in multi-container pods. tail: Lines from the tail (default 100, hard max 1000). since: Look-back window like "5m", "1h"; only logs newer than this. previous: If True, fetch the previous container instance's logs (post-crash). context: kubeconfig context.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
podYesPod name (required, exact match, ^[a-zA-Z0-9._-]{1,253}$).
tailNoNumber of lines from the end of the log. Default 100; clamped to 1..1000 (values above 1000 are capped).
sinceNoOnly logs newer than this relative window. Format ^\d+[smhd]$ (e.g. "5m", "1h", "2d"). Omit for no time bound.
contextNokubeconfig context name; omit to use the current context.
previousNoIf true, fetch the PREVIOUS (crashed/restarted) container instance's logs — use to debug a CrashLoopBackOff. Default false.
containerNoContainer name — required only for multi-container pods; omit for single-container pods.
namespaceNoTarget namespace; omit to use the default namespace.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

With no annotations, the description fully covers behavior: idempotent, non-mutating, output truncated to ~50 KB, and raises errors on kubectl failures. This is comprehensive.

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 front-loaded with purpose and safety, but the bulleted Args list is somewhat redundant with the schema. It could be trimmed, but it's not excessively long.

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

Completeness5/5

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

Given 7 parameters, no annotations, but an output schema exists, the description covers errors, truncation, idempotency, and usage constraints. It is complete for the tool's complexity.

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 description adds minimal new meaning. The Args section mostly restates schema info. Some nuance like 'hard max 1000' is present but also in schema.

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 description clearly states 'Fetch logs from a pod' and emphasizes it is read-only and idempotent, distinguishing it from sibling tools like k8s_describe or k8s_get. The verb and resource are specific.

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

Usage Guidelines4/5

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

The description implicitly indicates when to use (for pod logs) and provides error conditions (pod NotFound, Forbidden). It lacks explicit when-not or alternatives, but the context is clear given sibling tools have distinct purposes.

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/kaka-milan-22/kops'

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