Skip to main content
Glama

container_logs

Read-only

Retrieve container logs as a one-shot snapshot or bounded live tail, using line and time limits to prevent memory exhaustion and avoid blocking indefinitely.

Instructions

Get the logs of a container: a one-shot snapshot by default, or a bounded live tail with follow=True.

Follow mode returns when limit_lines lines are collected, timeout_seconds elapses, or the container exits, whichever comes first - so the agent can watch live output without blocking forever. limit_lines/timeout_seconds apply only in follow mode; until only in snapshot mode.

Snapshot mode is capped at 32 MiB and raises ToolInputError past it, so a noisy container can't exhaust the server's memory; service_logs caps the same way and lets the caller raise it. Prefer an integer tail, or since, over tail="all" on a long-running container: "all" is safe but will abort on the cap rather than returning a partial answer, and a large result can still exceed the agent's context.

Caveat for ssh:// daemons: docker-py can't cancel an SSH stream, so in follow mode the timeout_seconds watchdog can't interrupt a fully silent container - use the snapshot mode there if you need a hard time bound.

Args: tail: Number of lines from the end, or the literal "all" for everything since: Only return logs created after this unix timestamp until: Only return logs created before this unix timestamp (snapshot mode only) follow: Follow the live log stream instead of returning a snapshot limit_lines: Follow mode: max lines to collect before returning timeout_seconds: Follow mode: max wall-clock seconds before returning what was collected

Returns: str: Decoded log output (up to limit_lines lines in follow mode). Raises ToolInputError in snapshot mode if the logs exceed 32 MiB.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tailNo
sinceNo
untilNo
followNo
stderrNo
stdoutNo
id_or_nameYes
timestampsNo
limit_linesNo
timeout_secondsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv2.0.0
    • addedInput schema / properties / follow
      Added value: +{
      +  "default": false,
      +  "type": "boolean"
      +}
    • addedInput schema / properties / limit_lines
      Added value: +{
      +  "default": 200,
      +  "type": "integer"
      +}
    • changedInput schema / properties / tail / default
      Previous value: -"all"New value: +200
    • addedInput schema / properties / timeout_seconds
      Added value: +{
      +  "default": 30,
      +  "type": "number"
      +}
  2. First observedv1.9.0

TDQS

A5/5.0
Behavior5/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false, so the safety profile is covered. The description adds substantial behavioral context beyond annotations: the 32 MiB cap and ToolInputError, follow-mode termination conditions, the SSH daemon caveat about timeout not interrupting silent containers, and the fact that snapshot mode raises rather than returning partial results. This is rich, honest behavioral disclosure.

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 dense but every sentence earns its place. It front-loads the core purpose and mode distinction, then covers limits, alternatives, caveats, and parameters in a logical order. The parameter list is compact and aligned with the schema. No filler or repetition.

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?

For a 10-parameter tool with no schema descriptions, the description covers all parameters, return values, error behavior, mode-specific semantics, and a platform-specific caveat. The output schema exists and the description explains the return string. Nothing an agent needs to call this correctly is missing.

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

Parameters5/5

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

Schema description coverage is 0%, so the description carries the full burden for 10 parameters. It explains each parameter's meaning and mode-specific applicability: `tail` accepts integer or 'all', `since`/`until` are timestamps, `follow` switches modes, `limit_lines` and `timeout_seconds` only apply in follow mode, and `until` only in snapshot mode. It also clarifies return behavior and error conditions. This fully compensates for the schema's lack of descriptions.

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 opens with a specific verb and resource: 'Get the logs of a container', and immediately distinguishes the two modes (snapshot vs follow). It also names the sibling tool `service_logs` and `compose_logs` implicitly by contrast, making it clear this is for individual containers. The scope is precise and an agent can tell it apart from related log tools.

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 description gives explicit when-to-use guidance: snapshot mode for one-shot, follow mode for live tail, and warns against `tail="all"` on long-running containers. It also names `service_logs` as an alternative with a different cap behavior. This is strong routing guidance with exclusions and alternatives.

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

Deploy Server

Other Tools