打开串口
openEstablishes a serial port connection by path, saved profile, device IDs (sn/vid/pid), or remote ESP32 bridge endpoint and returns a connection_id for subsequent read, write, and transaction calls.
Instructions
打开一个串口连接。定位端口三选一:port(路径)/ profile(命名参数)/ sn|vid|pid(按设备标识自动找)。transport=remote 时改用 endpoint(ESP32 无线串口桥,如 tcp://esp32s3-01:7000),不使用 port/sn/vid/pid。baud_rate 默认 115200;data_bits 默认 8;stop_bits 默认 1;parity 默认 none;flow_control 默认 none。newline 设置发送默认追加的换行(write/transact 未显式指定时的默认)。成功后返回 connection_id,后续 read/write/transact 用它。
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "open"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sn | No | 按序列号定位(list_ports.serialNumber) | |
| pid | No | 按产品 ID 定位(如 55d3、1001) | |
| vid | No | 按厂商 ID 定位(如 1a86、303a) | |
| port | No | 串口路径,如 /dev/ttyUSB0、/dev/ttyACM0、COM3 | |
| parity | No | 校验,默认 none | |
| newline | No | 发送时自动追加的换行(none 不加) | |
| profile | No | 已保存的 profile 名(profile_list 查看;显式参数覆盖 profile) | |
| endpoint | No | 远端地址(transport=remote 时必填),如 tcp://esp32s3-01:7000 | |
| baud_rate | No | 波特率,默认 115200 | |
| data_bits | No | 数据位,默认 8 | |
| stop_bits | No | 停止位,默认 1(Node serialport 仅支持 1/2) | |
| transport | No | 链路类型:serial=本机串口(默认);remote=ESP32 无线串口桥(契约已定,当前未实现) | |
| flow_control | No | 流控,默认 none | |
| rx_buffer_size | No | 内部 RX 缓冲上限字节数,默认 4194304 (4 MiB) |