Skip to main content
Glama
serial-hub-mcp

serial-hub-mcp

by yhuan416

收发交互(写+读)

transact

Sends data over a serial port and waits for the response in a single step, matching an end marker with a timeout — ideal for AT, Modbus, or GRBL request-response interactions.

Instructions

写入数据后等待回包,在一步内完成,是 AT/Modbus/GRBL 等请求响应式交互的推荐入口。写后只关心"写之后到达"的字节(忽略此前已缓冲的噪声)。timeout_ms 限时等待;match + match_encoding 指定响应结束标志。返回 text/hex/bytes 及 matched/timed_out。交互终端推荐 newline=crlf + match=提示符,避免把字面换行当命令。

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>",
      "data": "<data>"
    },
    "name": "transact"
  }
}

Input Schema

NameRequiredDescriptionDefault
dataYes字符串或 {hex}/{base64}/{text} 对象,encoding 决定解码方式
matchNo响应结束匹配串,如 "\n"、"OK"
newlineNo发送时自动追加的换行(none 不加)
encodingNodata 的编码方式,默认 utf8
timeout_msNo等待回包的最大毫秒数,默认 5000
connection_idYes连接 ID(由 open 返回)
match_encodingNomatch 的编码,默认 utf8

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.1/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 it does substantial work: it discloses that only bytes arriving after the write are considered (prior buffered noise is ignored), that timeout_ms bounds the wait, and that the return is text/hex/bytes plus matched/timed_out. It does not say what the tool does when it times out at the tool level (error vs. partial result), which is the remaining gap for a blocking I/O call.

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 purpose and scope come first, followed by constraints and then a practical tip. Dense but each clause contributes; the parenthetical about ignoring buffered noise is well-placed.

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?

For a 7-parameter, no-annotation, no-output-schema tool, the description is strong: it lists the return shape, the buffering semantics, and the terminator mechanics. Only the timeout-failure behavior and any error modes are left 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 coverage is 100%, so the baseline is 3. The description still adds value by explaining how match and match_encoding define the response terminator and by showing the newline=crlf + match=prompt combination as a concrete usage pattern, but it doesn't clarify encoding-vs-data interplay beyond what the schema already states.

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 gives a specific verb and two actions: write data, then wait for a response, all in one step, and it positions the tool as the recommended entry point for request/response protocols (AT/Modbus/GRBL). This distinguishes it from the sibling tools that only send or only read, such as write, send, read, and receive.

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?

It explicitly recommends this tool for request-response style interactions and adds an operational tip (newline=crlf + match=prompt for interactive terminals). It never states when to prefer the separate write/read siblings instead, so the exclusion is implied rather than stated.

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