Skip to main content
Glama

swarm_task_logs

Read-only

Retrieve a bounded snapshot of logs from a specific Docker Swarm task to diagnose failures without following the stream, even on multi-node clusters.

Instructions

Get a bounded snapshot of one swarm task's logs (never follows).

The per-replica counterpart to service_logs, which interleaves every task in the service: use this to read the replica that actually failed, found with swarm_task_list or service_ps. container_logs is no substitute on a multi-node swarm - the task's container lives on whichever node the scheduler placed it on, and this server talks to one daemon.

As with service_logs, follow is not exposed (the stream is joined into one string before returning, so following would never finish) and collection is capped at max_bytes. The Engine offers no until bound here, unlike container_logs, so narrow with since or an integer tail.

docker-py has no task collection and no APIClient.task_logs, so this drives its private request helpers against the published GET /tasks/{id}/logs, raising CapabilityError if those internals move. Drop the reach-in if docker-py grows a public method.

Args: id_or_name: The task id, an unambiguous id prefix, or its full <service>.<slot>.<taskid> name; see swarm_task_inspect for how the daemon resolves these and which name forms do not work since: Show logs since this Unix timestamp tail: Number of lines from the end, or the literal "all" for everything max_bytes: Abort with ToolInputError if the buffered logs exceed this many bytes (default 32 MiB)

Returns: str: Decoded log output

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tailNo
sinceNo
stderrNo
stdoutNo
detailsNo
max_bytesNo
id_or_nameYes
timestampsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv2.2.6

TDQS

A4.6/5.0
Behavior5/5

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

Beyond the annotations (readOnlyHint=true, destructiveHint=false), the description discloses key behavioral traits: it never follows, the stream is joined into one string, collection is capped at max_bytes, it raises CapabilityError if internals move, and ToolInputError if max_bytes is exceeded. This is rich, useful transparency well beyond the structured annotations.

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 thorough but not bloated: it front-loads the core action and uses clear paragraphs for usage context, limitations, and parameter details. Each section earns its place. It could be tightened, but the structure is logical and the length is justified given the tool's complexity.

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?

With an output schema present (returns str), the description sufficiently covers what the agent needs: error conditions, id resolution, and parameter semantics. It references sibling tools for further context. For a tool with 8 parameters, it is complete enough to invoke correctly.

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 0%, so the description must compensate. It explains id_or_name (with resolution via swarm_task_inspect), since, tail, and max_bytes, but omits stderr, stdout, details, and timestamps. While those booleans are somewhat self-explanatory, the description does not fully cover all 8 parameters. It adds value for the key ones but leaves some gaps.

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+resource: 'Get a bounded snapshot of one swarm task's logs (never follows).' It clearly distinguishes itself from service_logs (per-replica vs interleaved) and container_logs (multi-node limitation), so an agent knows exactly what this tool does and how it differs from siblings.

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?

It gives explicit when-to-use guidance: 'use this to read the replica that actually failed, found with swarm_task_list or service_ps.' It also tells when not to use alternatives: 'container_logs is no substitute on a multi-node swarm' and contrasts with service_logs. This provides clear routing.

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