Skip to main content
Glama

serial_send

Send serial data to a device and wait for an expected response. Supports AT command newlines, regex matching, timeouts, and HEX mode for Modbus/RS485.

Instructions

向串口发送数据并等响应。newline=True 自动追加 \r\n(AT 指令必须!)。 expect:正则,如 "OK"——发 AT 后等到 OK/ERROR 立即返回,不傻等; wait_s:等待响应上限秒数(默认 0.5,AT 慢响应建议 3~5)。 hex_mode=True 时 data 按 HEX 解析(RS485/Modbus 用)。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataYes
expectNo
handleYes
wait_sNo
newlineNo
hex_modeNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.8/5.0
Behavior3/5

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

With no annotations, the description carries the full burden. It discloses meaningful behaviors: automatic \r\n appending, regex-based early return, timeout cap via wait_s, and hex parsing mode. It omits other important traits such as required serial-open state, timeout behavior beyond the cap, and error handling, so it is adequate but incomplete.

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 front-loaded with the core purpose, then uses one short sentence per key parameter. Every sentence earns its place and there is no filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 6 parameters, no annotations, and an output schema, the description covers the action and most parameter semantics but omits the handle's origin (likely serial_open) and does not route between this and sibling tools like at_sequence or rs485_send. Enough to invoke, but not fully self-contained.

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 description coverage is 0%, so the description must compensate. It explains expect (regex), wait_s (max seconds, default 0.5, AT suggestion 3–5), newline (auto-append \r\n), and hex_mode (HEX parsing for RS485/Modbus). The required handle parameter is not explained, which is a gap, but the non-obvious parameters are well covered.

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?

States a specific verb+resource ('向串口发送数据并等响应') and is distinct from generic siblings like serial_read. However, it does not explicitly differentiate itself from at_sequence or rs485_send, which also send serial data under certain conditions, leaving some sibling selection ambiguity.

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?

Provides clear contextual guidance for parameter usage: newline=True for AT commands, expect for early return on OK/ERROR, wait_s for slow AT responses, hex_mode for RS485/Modbus. No explicit when-not or alternative tool naming is given, but the operational contexts are sufficiently described.

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