Skip to main content
Glama
serial-hub-mcp

serial-hub-mcp

by yhuan416

发送串口数据

write

Sends data to a serial port without reading a response, supporting UTF-8, hex, and Base64 encodings plus optional newline control for command lines.

Instructions

向串口发送数据(只发不收)。data 为字符串,encoding 决定解码方式:utf8(默认,直接按文本)、hex(如 "AF 01")、base64。成功后返回写入字节数。如需"发完等回包"请用 transact。newline 未写时用 open 时的默认。发一行命令建议 newline=crlf,避免把字面换行当命令。

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": "write"
  }
}

Input Schema

NameRequiredDescriptionDefault
dataYes字符串或 {hex}/{base64}/{text} 对象,encoding 决定解码方式
newlineNo发送时自动追加的换行(none 不加)
encodingNodata 的编码方式,默认 utf8
connection_idYes连接 ID(由 open 返回)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/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 well: it declares the write-only nature, states that success returns the number of bytes written, and explains that an omitted newline falls back to the default set at `open` time. It does not cover failure behavior or timeouts, which leaves a modest gap for a mutation tool.

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?

Front-loaded with purpose and the key write-only constraint, then alternatives, then parameter hints. Slightly repetitive in re-explaining the encoding modes already enumerated in the schema, but no sentence is wasted.

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?

No output schema exists, and the description compensates by stating the return value (bytes written). All four parameters are covered and the sibling alternative is named, leaving only error/edge-case behavior unaddressed.

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 coverage is 100%, so the baseline is 3, but the description adds real meaning: it explains what `encoding` actually does to `data`, gives a concrete hex example ("AF 01"), and clarifies the interaction between omitted `newline` and the `open` default — semantics the schema does not spell out.

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 and resource — "向串口发送数据(只发不收)" — and immediately scopes it as write-only, which separates it from read/receive. It also names the sibling `transact` as the tool for the reply-waiting case, so an agent can pick correctly 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?

Gives an explicit routing rule: use this tool to send only, use `transact` if you need to wait for a response after sending. It adds a concrete recommendation (newline=crlf for line-oriented commands) with the reason — avoiding literal newlines being treated as part of the command.

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