Skip to main content
Glama

search_log

Destructive

Search a log file for lines matching a regular expression, with optional time filters and surrounding context. Find specific events or errors efficiently without reading the entire file.

Instructions

Search a log file for lines matching a regular expression. Returns matching lines with optional surrounding context.

When to use

Use when you need to find specific events, errors, or patterns in a log file without reading the whole file. More efficient than read_log for targeted searches. Combine with since/until to scope the search to a time window.

Parameters

path

Absolute path to the log file. Obtain valid paths from list_logs.

pattern

Regular expression to search for. Uses Go regexp syntax. The pattern is not echoed back in the response.

since

Restrict the search to lines after this point in time. Accepts RFC3339 timestamps or relative durations (1h, 30m).

until

Restrict the search to lines before this point in time. Same format as since.

max_results

Maximum number of matching lines to return. Default: 200.

context_lines

Number of surrounding lines to include before and after each match. Default: 0 (match lines only).

Response

  • path — file path that was searched

  • pattern_redacted — always "<redacted>" (the search pattern is not echoed back for security reasons)

  • matches — array of match objects, each with:

    • line — the matching log line

    • line_number — 1-based line number in the file

    • context_before / context_after — surrounding lines (only present if context_lines > 0)

  • count — total number of matches returned

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesAbsolute path to the log file. Obtain valid paths from `list_logs`.
sinceNoRestrict the search to lines after this point in time. Accepts RFC3339 timestamps or relative durations (`1h`, `30m`).
untilNoRestrict the search to lines before this point in time. Same format as `since`.
patternYesRegular expression to search for. Uses Go regexp syntax. The pattern is not echoed back in the response.
max_resultsNoMaximum number of matching lines to return. Default: 200.
context_linesNoNumber of surrounding lines to include before and after each match. Default: 0 (match lines only).
Behavior4/5

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

Description adds behavioral details beyond annotations: pattern redaction, response structure with context lines, and default values. However, annotations indicate destructiveHint=true while description implies read-only operation, creating a subtle contradiction not addressed.

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 clear sections (overview, when to use, parameters, response). Each sentence is informative, no fluff, and front-loaded with the core purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite no output schema, the description details the response structure. It covers parameters and usage well but fails to explain the destructiveHint=true annotation anomaly, leaving a minor completeness gap.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, but description adds value with context like 'Obtain valid paths from list_logs' for path and 'Uses Go regexp syntax' for pattern. This surpasses the baseline of 3.

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 searches log files for regex patterns, specifying verb, resource, and result. It distinguishes from sibling 'read_log' by targeting specific patterns versus full file reading.

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?

A dedicated 'When to use' section explains the tool is for targeted searches without reading the whole file, explicitly comparing it to 'read_log'. It suggests combining with temporal parameters but lacks explicit when-not-to-use guidance.

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/kascada/logmcp'

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