Skip to main content
Glama

get_modal_logs

Read-onlyIdempotent

Retrieve raw stdout, stderr, and system logs from Modal apps or containers. Use app/container IDs, time ranges, sources, and tail limits to pinpoint issues.

Instructions

Fetch logs for an app or container (`modal app logs` / `modal container logs`).
To find where something went wrong, prefer search_modal_logs — it returns matches
with surrounding context instead of a raw tail.

Covers the stdout/stderr/system streams ONLY. Crash events shown on the Modal
dashboard (e.g. "... exited with ...") are not log lines and never appear here.

Args:
    identifier: App name/ID ("my-app", "ap-...") or container ID ("ta-...").
    target: "auto" (default — "ta-..." is a container), "app", or "container".
    timeout_seconds: Max seconds to collect. Default 30.
    env: Modal environment. Apps only — container logs take no environment.
    since / until: Time range, ISO 8601 or relative ("2h", "30m", "1d"). Max 35 days.
        `since` without `tail` fetches EVERY entry in the range — pass `until` too
        (or a `tail`) to bound the volume on a busy app.
    tail: Only the last N entries (max 20000).
    source: "stdout", "stderr", or "system".
    timestamps: Prefix each line with its wall-clock timestamp.
    follow: Live-stream until the app/container stops or the timeout hits.

Returns: {logs, truncated (still streaming at the timeout), output_capped (text
trimmed to fit context — narrow with tail/since/source)}.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
envNo
tailNo
sinceNo
untilNo
followNo
sourceNo
targetNoauto
identifierYes
timestampsNo
timeout_secondsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.2.2

TDQS

A5/5.0
Behavior5/5

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

Annotations already mark readOnly, idempotent, and non-destructive, and the description adds genuinely new behavior knowledge beyond those: only stdout/stderr/system streams are covered, dashboard crash events never appear, `since` without `tail` fetches every entry in range, and returns a `truncated`/`output_capped` flag. This is the kind of context agents need to avoid misreading results.

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 long, but for a 10-parameter tool with subtle behaviors, every sentence adds necessary information. It is front-loaded with purpose and direction, uses a clean Args list, and closes with the Returns shape. No filler or repeated schema details.

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 has 10 parameters and an output schema, this description provides crucial contextual constraints: volume pitfalls, stream coverage, crash-event exclusion, defaults, maximum bounds (35 days, tail 20000), and return flag meanings (truncated, output_capped). It is complete enough to invoke correctly without clicking outside docs.

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 entire burden for parameter semantics. It fully compensates by explaining identifier formats ('my-app', 'ap-...', 'ta-...'), the `target` auto resolution logic, `timeout_seconds` default, environment scope, ISO/relative and max 35 days for `since`/`until`, `tail` max, allowed sources, `follow` behavior, and `timestamps`. Every parameter in the schema is addressed meaningfully.

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 ('Fetch logs for an app or container') and maps it to the underlying CLI commands. It explicitly differentiates itself from the sibling search_modal_logs by contrasting raw logs with matches plus surrounding context, so an agent can tell them apart immediately.

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 states when not to use this tool: 'To find where something went wrong, prefer search_modal_logs... instead of a raw tail.' It also excludes crash events, which is a clear boundary for agent decision-making. This is explicit when/when-not guidance plus an alternative.

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