读取串口数据
readRetrieve 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
| Name | Required | Description | Default |
|---|---|---|---|
| match | No | 匹配串:缓冲中出现即返回(含匹配到的那段) | |
| wait_ms | No | 若无数据则等待的毫秒数,默认 0 立即返回 | |
| min_bytes | No | 等待的最少字节数,默认 1 | |
| connection_id | Yes | 连接 ID(由 open 返回) | |
| match_encoding | No | match 的编码,默认 utf8 |