Skip to main content
Glama

配置 MQTT 连接

mqtt_configure

Add or update a named MQTT connection configuration by passing host and optional credentials, then reference it by name in mqtt_connect or mqtt_send for reusable broker connections.

Instructions

新增或更新一个命名 MQTT 连接配置。连接参数在此时传入并保存到本地;后续用 mqtt_connect 或 mqtt_send 按名称引用。host 为必填,其余使用默认值。

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": {
      "name": "<name>",
      "host": "<host>"
    },
    "name": "mqtt_configure"
  }
}

Input Schema

NameRequiredDescriptionDefault
caNoCA 证书 PEM 内容
keyNo客户端私钥 PEM 内容
certNo客户端证书 PEM 内容
hostYesBroker 地址,如 127.0.0.1 或 example.com
nameYes连接名称,唯一标识,例如 factory-broker
pathNoWebSocket 路径(ws/wss)
portNo端口,默认按协议推断
cleanNo清除会话,默认 true
queryNoWebSocket 查询串,不含 ?
clientIdNo客户端 ID,留空自动生成
passwordNo密码
protocolNo协议,默认 mqtt
usernameNo用户名
keepaliveNo心跳秒数,默认 60
descriptionNo备注说明
autoSubscribeNo连接后自动订阅,如 {"a/+/b": 0}
connectTimeoutNo连接超时毫秒,默认 10000
protocolVersionNoMQTT 版本,默认 5
reconnectPeriodNo重连间隔毫秒,默认 3000,0 表示禁用
rejectUnauthorizedNo是否校验证书,默认 true

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.6/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, and it does disclose two important traits: the operation persists state to local storage, and it is an upsert (an existing entry with the same name is updated). It says nothing about whether credentials/passwords are stored in plaintext, whether the connection is validated at save time, or whether changes affect currently active connections — significant gaps for a write 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?

Three short sentences, front-loaded with the upsert action, then persistence semantics, then the required-field note. Minimal waste; the closing 'host 为必填' sentence partly duplicates the schema's required list, keeping it from a 5.

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?

For a 20-parameter mutation tool with no annotations and no output schema, the description covers purpose, persistence and required fields but omits return behavior (does it echo the saved config or just confirm success?) and any note on the large TLS/WebSocket parameter group. Adequate, but thin relative to the tool's surface area.

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 description coverage is 100% across all 20 parameters, so the schema already documents host format, protocol enum, TLS fields, timeouts and defaults. The description only restates that host is required and other fields fall back to defaults, which the schema already encodes via the required array and per-field default notes. Baseline 3 applies.

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 pair and resource: upsert ('新增或更新') of a named MQTT connection configuration. It also distinguishes itself from mqtt_connect/mqtt_send by framing itself as the step that persists parameters that those tools later reference by name, so an agent can separate configuration from connection/publishing. It stops just short of 5 because it never explicitly says it does not itself open a connection.

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?

Gives a clear workflow: supply parameters here, they are saved locally, and later tools reference the connection by name. This tells the agent when in the sequence to call it. It offers no exclusion guidance (e.g., how to prefer editing an existing entry vs. re-configuring, or what happens if the name already exists beyond the implied overwrite).

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