Skip to main content
Glama

search_log_keyword

Search log files by keyword or regex to locate events and return matching lines with surrounding context for diagnosis.

Instructions

在日志中按关键词或正则表达式搜索,返回命中行及其上下文。

Args: file_path: 日志文件绝对路径。 keyword: 关键词;regex 为 True 时视为正则表达式。 regex: 是否按正则匹配,默认 False(普通子串匹配)。 context: 每个命中前后展示的上下文行数,默认 2。 max_results: 最多返回的命中组数,默认 50。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
regexNo
contextNo
keywordYes
file_pathYes
max_resultsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.1.1

TDQS

B3.1/5.0
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It implies a read-only search and describes the hit-plus-context output, but says nothing about permissions, behavior on missing/unreadable files, regex flavor, or how large files are handled.

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 summary sentence is front-loaded and the per-argument notes are terse; nothing is repeated verbatim from the schema in a wasteful way. Slightly list-heavy but appropriate for a five-parameter tool.

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

Completeness3/5

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

With an output schema present, return values need not be explained, and the parameters are covered. However, with zero annotations and eight siblings, the definition lacks the usage context and safety profile an agent would need to route and invoke it confidently.

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 description coverage is 0%, so the description must compensate, and it largely does: it documents all five parameters, clarifying that file_path is an absolute path, that keyword is interpreted as a regex when regex=True, and the meaning and defaults of context and max_results. It loses a point only for not specifying regex syntax details.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The first sentence gives a specific verb and resource ('在日志中按关键词或正则表达式搜索') plus the return shape ('返回命中行及其上下文'), which is concrete enough to distinguish it from read_log_tail or filter_log_by_level. It stops short of explicitly naming which sibling to prefer, so it is clear but not sibling-differentiated.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no statement of when to use this over filter_log_by_level, analyze_error_text, or the read_log_head/tail pair, and no prerequisites (file must exist, encoding, size limits) are given. Usage is only implied by the verb 'search'.

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