Skip to main content
Glama
serial-hub-mcp

serial-hub-mcp

by yhuan416

检索串口日志

log_query

Query serial port log entries by connection, direction, sequence or time range, substring, or regex, searching both in-memory and on-disk history and returning matching lines with counts.

Instructions

检索串口日志条目。日志按行切分(\n / \r\n),每条含全局 seq 索引、epoch 时间戳 ts、方向 dir(rx/tx)、内容 line/hex/bytes。支持按连接、方向、索引范围(seq_from/seq_to)、时间范围(time_from/time_to)、内容子串(contains)、正则(regex)过滤。存储:内存保留最近 N 条,最旧溢出到磁盘(每连接分片 JSONL,超保留上限自动淘汰最旧分片);检索时内存+磁盘都查。返回 entries(含 count/truncated)与 earliest_seq/retention(earliest_seq 之后的历史才完整,淘汰过的更早部分不可回溯)。

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "log_query"
  }
}

Input Schema

NameRequiredDescriptionDefault
dirNo方向过滤
limitNo返回条数上限,默认 100
orderNo排序,默认 asc(旧→新)
regexNo正则匹配(作用于 line)
seq_toNo索引上界(含)
time_toNo时间上界(epoch ms,含)
containsNo内容子串匹配(区分大小写,作用于 line)
seq_fromNo索引下界(含)
time_fromNo时间下界(epoch ms,含)
connection_idNo连接 ID;省略则全查

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.7/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does so well: it explains the two-tier storage (recent N in memory, oldest spilled to per-connection JSONL shards), automatic eviction of oldest shards, and that queries span both tiers. It also warns that history before earliest_seq is incomplete and evicted data is unrecoverable, which is a meaningful behavioral caveat. It omits cost/latency expectations for regex scans over spilled shards, which keeps it from a 5.

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 description is front-loaded: purpose first, then record structure, then filter list, then storage/retention semantics. It is dense but every clause carries information an agent needs; the middle filter enumeration mildly duplicates the schema.

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?

There is no output schema, and the description compensates by describing the return payload (entries with count/truncated) plus earliest_seq/retention, which is exactly the information needed to interpret partial results. For a 10-parameter, zero-required read tool with no annotations, this is nearly complete; only pagination/ordering interaction and expected cost are unstated.

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

Parameters3/5

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

Schema description coverage is 100%, so all ten parameters are already documented individually, including the contains case-sensitivity and that regex applies to line. The description adds mostly grouping and framing (connection, direction, seq range, time range, substring, regex) rather than new meaning, so the baseline of 3 applies.

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 ('检索串口日志条目' – search serial-port log entries), and the following sentences describe the log record shape (seq, ts, dir, line/hex/bytes) and the supported filters. It never names or contrasts with sibling tools such as log_stats and log_clear, so an agent must infer the split from names alone.

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

Usage Guidelines3/5

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

Usage is implied by the enumerated filter capabilities and by the note that both in-memory and on-disk shards are searched, which tells the agent this is the lookup tool. There is no explicit 'use this instead of X' or 'do not use for aggregates/clearing' guidance, so routing between log_query, log_stats and log_clear is left to inference.

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