Skip to main content
Glama

search_modal_logs

Find errors, tracebacks, or request IDs in logs by searching for a pattern and returning matching lines with surrounding context.

Instructions

Search an app's or container's logs for a pattern and return matches WITH surrounding
context — useful for finding where something went wrong (errors, tracebacks, a request
ID, etc.). Logs are fetched once and grepped locally, so unlike the `search` argument
on the log tools you get the lines around each hit, not just the matching line.

Args:
    identifier: App name/ID (e.g. "my-app", "ap-123456") or container ID ("ta-123456").
    pattern: Text (or regex, if `regex=True`) to search for, e.g. "Traceback", "Error",
        "timeout", or a request/job ID.
    target: What `identifier` refers to: "app" (default) or "container".
    regex: If True, treat `pattern` as a Python regular expression instead of literal text.
    case_sensitive: If True, match case-sensitively. Defaults to case-insensitive.
    context_lines: Number of lines to include before and after each match. Defaults to 3.
    max_matches: Cap on the number of match blocks returned. Defaults to 50.
    since: Only search logs newer than this — ISO 8601 or relative like "2h", "1d".
    tail: Only search the last N log entries. If neither `since` nor `tail` is given,
        the last 1000 entries are searched.
    timeout_seconds: Max seconds to spend fetching logs before searching. Defaults to 30.
    env: Optional Modal environment (apps only).

Returns:
    A dictionary with `match_count` (total hits), `matches` (a list of context blocks,
    each a string with line numbers; matched lines are prefixed with ">"), and
    `returned` (how many blocks are included after `max_matches`).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
identifierYes
patternYes
targetNoapp
regexNo
case_sensitiveNo
context_linesNo
max_matchesNo
sinceNo
tailNo
timeout_secondsNo
envNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

No annotations provided, but the description fully discloses behavior: logs are fetched once and grepped locally, defaults for parameters (e.g., last 1000 entries if no since/tail), timeout, output structure with match_count, matches, and returned. No contradictions.

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?

Well-structured with a concise introductory paragraph, bulleted 'Args:' section, and 'Returns:' section. Every sentence adds value; no redundancy. Front-loaded with purpose and key differentiator.

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 complexity (11 parameters, 2 required) and lack of annotations, the description is exceptionally complete. Covers all parameters, behavioral nuances, and return format, and distinguishes from related tools. No gaps.

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%, but the description includes a detailed 'Args:' section explaining every parameter, their types, allowed values (e.g., identifier can be app name/ID or container ID), examples, and defaults. Adds significant meaning beyond the schema.

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?

Clearly states the tool searches logs for a pattern and returns matches with surrounding context. Distinguishes from sibling log tools by contrasting with their 'search' argument, which only returns matching lines.

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?

Explicitly tells when to use (finding errors, tracebacks, request IDs) and contrasts with alternatives (the 'search' argument on other log tools). Provides examples of useful patterns and explains the local grep behavior.

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/george-bobby/mcp-modal'

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