Skip to main content
Glama
serial-hub-mcp

serial-hub-mcp

by yhuan416

读取串口数据

read

Retrieve serial port data immediately or wait for new bytes, a minimum byte count, or a matching pattern; returns text, hex, or raw bytes with timeout status.

Instructions

读取串口已到达的数据。默认立即返回所有未读字节(cat 语义)。wait_ms>0 时等待新数据;min_bytes 指定等待的最少字节数。match + match_encoding 指定匹配串:一旦缓冲里出现匹配即返回(含匹配部分)。返回 text/hex/bytes 及 matched/timed_out。

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "connection_id": "<connection_id>"
    },
    "name": "read"
  }
}

Input Schema

NameRequiredDescriptionDefault
matchNo匹配串:缓冲中出现即返回(含匹配到的那段)
wait_msNo若无数据则等待的毫秒数,默认 0 立即返回
min_bytesNo等待的最少字节数,默认 1
connection_idYes连接 ID(由 open 返回)
match_encodingNomatch 的编码,默认 utf8

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4/5.0
Behavior4/5

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

No annotations are provided, so the description must carry the full burden of explaining behavior, and it discloses a lot: the data is read immediately by default, it may wait for data, it returns as soon as a match appears, and it can return text, hex, and bytes along with matched and timed_out fields. This satisfies the central read-only behavior. One meaningful gap remains: the description never explicitly states whether this consumes unread bytes or leaves them in the buffer, even though 'cat semantics' implies consumption.

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?

The description is a single dense paragraph with no filler, and the default behavior is front-loaded before the conditional modes. Every clause carries information: default return, wait conditions, minimum bytes, match semantics, and return fields. The return-field mention is especially valuable because there is no output 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?

With only 1 required parameter, out of 5 total, no output schema, and no annotations, this description covers the modes, the key defaults, and the response shape, including matched and timed_out. The main missing pieces are whether reads consume the buffered bytes and how errors are surfaced (such as a closed or invalid connection_id). Those gaps are worth noting, though the rest of the description is sufficiently complete for an agent to call the tool correctly.

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%; every parameter already has its own description, including defaults for wait_ms, min_bytes, and match_encoding. The description restates those defaults and the match behavior but adds no new syntax, format, or interaction detail beyond what the schema documents. This is the expected baseline when the schema does the heavy lifting.

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 description opens with a specific verb and resource: read serial data that has already arrived, with 'cat semantics' as a default. This is unambiguous as to what the tool does. However, it does not distinguish the tool from apparent siblings such as 'receive' or 'transact', so an agent must rely on the name alone to choose between them.

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?

The description gives clear guidance on how the tool behaves in each mode: calling it with no arguments returns all unread bytes immediately, setting wait_ms>0 waits for new data, setting min_bytes changes the wait threshold, and using match returns as soon as the matching pattern appears. Exclusions do exist implicitly: 'cat semantics' versus waiting versus pattern matching. However, the description does not say when to prefer this tool over the sibling 'receive' or 'transact'.

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