Skip to main content

Playgrounds Logs Follow

[MODE:SIDEEFFECTS] Tier: brownfield. Read-only API but emits progress events.

Streams docker logs -f output line-by-line as MCP progress notifications, returning a final aggregate when bounded by duration/max_lines. Wraps c.Playgrounds.LogsStream which long-polls Rails (/api/playgrounds/:id/logs/:service?follow=true).

When to use

  • "Wait until I see 'listening on :8080'."
  • Watching a slow boot to confirm a service settled.
  • Tailing a worker after triggering a job.

When NOT to use

  • One-shot snapshot — use fibe_playgrounds_logs.
  • Need cross-service context — use fibe_playgrounds_debug with logs_tail.

Inputs

FieldTypeRequiredNotes
playground_idnumberyesNumeric ID only (no name resolution here)
servicestringyesCompose service name
tailnumbernoInitial lines from history (default 50)
durationstringnoGo duration; default 30s, max constrained by transport timeout
max_linesnumbernoStop after N new lines (default 500)

Output (final)

{
"playground_id": 42,
"service": "web",
"lines": [
{ "text": "...", "source": "stdout|stderr" },
...
],
"count": 257
}

While streaming, each line is also delivered as an MCP notifications/progress event tagged with the request's progressToken (when the client provided one). Hosts that surface progress (Claude Desktop, etc.) display lines in real time.

Bounds

The stream stops when:

  • duration elapses, OR
  • max_lines are observed, OR
  • The client cancels the call, OR
  • The server-side stream closes (container exits, network drops).

Whichever comes first.

Gotchas

  • Only playground_id (numeric) is accepted; named identifiers are not supported.
  • duration strings: "30s", "5m". Bare integers are interpreted as seconds.
  • Some MCP clients drop progress notifications between request and final result — even then you still get the aggregated lines array at the end.
  • If the underlying Marquee SSH connection drops, the stream just stops; reconnect and re-call to resume.
  • This is the right primitive for "verify the service is up" but fibe_playgrounds_wait(status:"running") is usually simpler when the signal is the Playground status flip.
  • fibe_playgrounds_logs — bounded snapshot.
  • fibe_playgrounds_wait — wait for status transitions instead.
  • fibe_playgrounds_debug — get service names before following.