Skip to main content
Glama

container_logs

Read-only

Retrieve container logs as a snapshot or live tail with configurable line limits and timeouts.

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.

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)

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?

The description adds significant behavioral detail beyond the annotations (readOnlyHint, destructiveHint). It explains mode-dependent parameter behavior, the follow mode termination conditions, and a limitation for SSH daemons. This fully informs the agent of the tool's behavior.

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-organized: a concise opening sentence, followed by detailed behavior explanations, a caveat, and a clear parameter list. Every sentence adds value without redundancy, making it efficient for a tool with 10 parameters.

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 the tool's complexity (two modes, 10 parameters) and the existence of an output schema, the description covers all necessary aspects: usage modes, parameter constraints, edge cases, and return value. It leaves no gaps for the agent to infer.

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?

With 0% schema description coverage, the description fully compensates by explaining each parameter's purpose, defaults, and mode restrictions (e.g., until only in snapshot, limit_lines/timeout only in follow). This provides complete semantic understanding for all 10 parameters.

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 the tool gets container logs, distinguishing between snapshot and follow modes. It is a specific verb ('get') on a defined resource ('logs of a container'), which differentiates it from siblings like compose_logs or container_inspect.

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 provides detailed usage guidelines for both snapshot and follow modes, including conditions for termination (limit_lines, timeout, container exit) and a caveat for SSH daemons. Although it does not explicitly name alternative tools, the context of sibling tools (e.g., compose_logs) and the tool's specific name make the usage context clear.

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