Skip to main content
Glama

container_logs

Read-only

Retrieve container logs as a one-shot snapshot or bounded live tail, with configurable lines, timeouts, and size caps to prevent blocking or memory exhaustion.

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 ValueError 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: id_or_name - The container id or name stdout - Include stdout stderr - Include stderr timestamps - Include timestamps tail - Number of lines from the end (default 200), 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 (default 200) timeout_seconds - Follow mode: max wall-clock seconds before returning what was collected (default 30) returns: str - Decoded log output (up to limit_lines lines in follow mode). Raises ValueError 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
Behavior5/5

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

Annotations already declare this as a read-only, non-destructive operation. The description adds substantial behavioral context beyond that: the 32 MiB cap and ValueError, follow-mode termination conditions (limit_lines, timeout_seconds, container exit), and the SSH stream caveat. It discloses failure modes and limits, which is exactly what an agent needs to trust the tool.

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 well-structured: a clear one-sentence overview, then focused paragraphs on behavior, limits, and caveats, followed by a clean parameter list. Every sentence delivers actionable information without redundancy. It is dense but not verbose, and front-loads the core purpose.

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 tool with 10 parameters and two modes, the description covers all critical aspects: mode differences, limits, edge cases (SSH daemon, context size), and return type. It also notes the output schema exists, so the agent knows additional return details are available. No gaps are apparent for an agent to safely invoke this tool.

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 coverage is 0%, so the description is the sole source of parameter meaning. It explains each parameter's role and interaction (e.g., 'limit_lines/timeout_seconds apply only in follow mode', 'until only in snapshot mode'). It also defines 'tail' values (integer or 'all') and defaults, effectively compensating for the lack of schema 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 two modes (snapshot vs. follow). It also contrasts with sibling tools like service_logs, making its scope clear. This goes beyond a generic statement and gives an agent precise understanding of what the tool does.

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 explicitly tells when to use alternative tools (service_logs) and provides practical guidance on parameter choices ('Prefer an integer tail... over tail="all"'). It also warns about the SSH caveat and recommends snapshot mode for hard time bounds, giving clear exclusions and context for decision-making.

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/L337-org/docker-mcp'

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