Skip to main content
Glama

probe_log

Read-onlyIdempotent

Reads the tail of a game log and filters lines by regex to verify game or mod results without consuming the file; supports repeated polling and auto UTF-8/GBK detection.

Instructions

读游戏日志尾部并按正则过滤(编码自动 utf-8/gbk)。只读、不消费,可反复轮询。

同类 Bot 项目普遍没有这条「用日志确认结果」的通道。

为什么单独做这件事:调研的 7 个游戏自动化 Bot 项目里, 没有一个用游戏日志判断结果 —— 它们靠视觉、注册表或 CDP。 而「通过日志确认结果」恰恰是最可靠的验收通道之一 (Mod 自己的输出、游戏自己的报错都在日志里),所以这里补上。

做法刻意保守: · 只读尾部 tail_bytes(默认 256 KB)—— 日志动辄几百 MB, 绝不整个读进来; · 给了 pattern 就只返回匹配行,并额外给 matched_count, 便于断言「没有出现 ERROR」这类否定式判据; · 编码自动探测(utf-8 → utf-8-sig → gbk)—— 中文游戏常见 GBK。

⚠️ 它是只读的,不消费日志(不像 drain_events 那样取走即没)。 同一次读取可以反复做,所以适合轮询等待某个日志行出现。

Args: path: 日志文件路径。 pattern: 正则;只返回匹配行。留空返回尾部所有行。 max_lines: 最多返回多少行(默认 200,取最后 N 行)。 tail_bytes: 从文件末尾读多少字节(默认 262144)。

Returns: {ok, path, size, encoding, total_lines_in_tail, returned, lines: [{line_no, text}], matched_count?, has_more?, truncated_head}

Input Schema

NameRequiredDescriptionDefault
pathYes
patternNo
max_linesNo
tail_bytesNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already declare readOnly/idempotent/non-destructive, but the description goes further: it discloses that only the tail is read and never the whole (possibly hundreds of MB) file, how encoding detection falls back utf-8 → utf-8-sig → gbk, and that reads do not consume the log. These are real behavioral traits beyond the annotation set.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The operational content is front-loaded and correct, but a large block of the text is research justification ('of 7 surveyed bot projects, none used logs…') that does not help an agent decide or invoke. That padding dilutes an otherwise tight definition.

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?

With no output schema, the description supplies the full return shape including encoding, total_lines_in_tail, matched_count, has_more and truncated_head, plus defaults for every parameter. An agent has everything needed to call and interpret results, even though structured fields are sparse.

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 must carry all parameter meaning — and it does: path, pattern (regex, empty = all tail lines), max_lines (default 200, returns the *last* N), tail_bytes (default 262144 bytes). The 'last N lines' and 'tail bytes' semantics are precisely the non-obvious parts the schema omits.

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?

States a specific verb+resource and scope: reads the *tail* of a game log and filters by regex, with automatic encoding detection. It also explicitly distinguishes itself from the sibling `drain_events` (non-consuming vs. consuming), so an agent can pick between them without opening either schema.

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 gives the use case — repeated polling until a log line appears — and names the alternative (`drain_events`) plus the condition that separates them (consume-once vs. re-readable). It also states the negative-assertion use case (`matched_count` for 'no ERROR appeared'), which is a concrete when-to-use signal.

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