Skip to main content
Glama
XJPeng12

bmahs-mcp-gateway-node

by XJPeng12

bmahs-mcp-gateway-node

BMAHS(比马斯) 是一个开放的局域网硬件协议:每台设备上电即用自然语言「自我介绍」——我是谁、能做什么、安全边界在哪——让大模型智能体像接入 USB 设备一样,即插即用地发现、识别、按权限独占并安全地操作它们。

BMAHS(比马斯)设备协议 ↔ MCP 网关的 Node.js / TypeScript 实现:把局域网内按 bmahs/1.0 协议发布的硬件设备(解析侧兼容旧版 1–1.2 字段名)动态映射为 Model Context Protocol 工具,让大模型客户端可以直接发现、占用与操作这些设备。

与 Python 版(bmahs-mcp-gateway)功能全量对齐,两者可互换使用,也可与对方的参考设备跨语言互通(npm run smoke:py)。

特性

  • 零配置发现:UDP 组播(239.255.42.42:5354 / [ff02::4242]:5354,多网卡全 join + 自愈)+ Bonjour/mDNS 双通道;BMAHS_STATIC_DEVICES 静态设备表适配容器/跨网段。

  • 动态工具映射:设备 operations 自动映射为 MCP 工具(<设备id>__<动作>),含 JSON Schema、any_of 约束与自然语言说明,无需为每类设备写适配。

  • 协议级占用安全:控制前自动 occupy(有限租约)、token 按会话保管并自动携带、进程退出统一 release、token 递归遮蔽绝不回显。

  • 两种接入模式:stdio(单客户端)与 Streamable HTTP(多客户端共享,Bearer Token 常量时间鉴权,占用方可追溯到 -sN 会话)。

  • 实验性抓屏:声明了 ui 能力的设备可 bmahs_screenshot 抓帧(§4.9 二进制流解析)。

Related MCP server: WEATHGARDS

安装

npm install -g bmahs-mcp-gateway-node       # 全局安装,得到命令 bmahs-mcp-node(与 pip 版的 bmahs-mcp 不冲突)
npx -y bmahs-mcp-gateway-node@latest serve  # 免安装直接运行

验证:bmahs-mcp-node --version 输出 bmahs-mcp-node 0.1.1。要求 Node.js ≥ 20。国内网络安装慢可临时走镜像 --registry=https://registry.npmmirror.com(同步可能有几分钟延迟)。

从源码构建开发:

npm install
npm run build        # tsc → dist/
node dist/bin.js --version

快速开始

# 扫描局域网内的 BMAHS 设备(全局安装后把 node dist/bin.js 换成 bmahs-mcp-node)
node dist/bin.js discover

# 联调:对设备执行一个动作(控制类动作自动 occupy → 执行 → release)
node dist/bin.js ctl 客厅灯 on
node dist/bin.js ctl 客厅灯 brightness --arg level=80
node dist/bin.js ctl 客厅灯 scene --arg name=cinema --ttl 600        # 指定占用租约 600 秒
node dist/bin.js ctl 客厅灯 on --no-release                          # 动作后保持占用(打印 token)
node dist/bin.js ctl 客厅灯 release --arg token=<占有时返回的 token>  # 手动释放保持的占用

# 启动 MCP 网关(stdio,默认子命令)
node dist/bin.js serve

# 以 Streamable HTTP 共享模式启动(多客户端同时连接)
node dist/bin.js http --host 0.0.0.0 --port 9530 --token 换成你的令牌

在 MCP 客户端中配置 stdio 接入:

{
  "mcpServers": {
    "bmahs-node": {
      "command": "node",
      "args": ["/绝对路径/bmahs-mcp-gateway-node/dist/bin.js", "serve"]
    }
  }
}

HTTP 模式端点为 http://<host>:9530/mcp;设置了 --token 后客户端须携带 Authorization: Bearer <token>

重启客户端后,模型可见两类工具:7 个固定工具——bmahs_devices(列设备)、bmahs_refresh(重扫描)、bmahs_describe(读自述)、bmahs_occupy / bmahs_release(占用/释放)、bmahs_call(泛化调用)、bmahs_screenshot(ui 设备抓屏);以及每台设备的动态工具——<设备id>__<动作>(如 demo-light-001__brightness),参数说明来自设备自述。典型流程:bmahs_devices 选型 → 直接调动态工具(网关自动 occupy 并携带 token,默认 120 秒租约)→ 用完 bmahs_release;token 由网关代管并遮蔽,不进模型上下文。

常见问题

  • 扫不到设备? 确认设备已上电且同网段、Windows 防火墙放行 UDP 5354 入站;多网卡机器用 BMAHS_MCAST_IF_V4 指定网卡;跨网段/容器用 BMAHS_STATIC_DEVICES=tcp://IP:端口 静态表兜底。

  • 报「正被 xxx 占用」(occupied)? 设备独占中:bmahs_devicesholder/until,等租约到期或请占用方 bmahs_release;协议无强夺机制(防止两个模型打架)。

  • HTTP 模式 401? 请求头须带 Authorization: Bearer <--token 设置的值>

  • stdio 模式没有输出? 正常:stdout 是 MCP 协议通道,日志全走 stderr(BMAHS_LOG_LEVEL=debug 调高)。

环境变量

与 Python 版同名同义:

变量

默认

说明

BMAHS_AGENT_ID

bmahs-mcp-<主机名>-<6位hex>

网关在协议中的智能体 id

BMAHS_STATIC_DEVICES

静态设备表,逗号/分号分隔 tcp://host:port

BMAHS_BONJOUR_BROWSE

1

0 关闭 mDNS 浏览通道

BMAHS_AUTO_OCCUPY / BMAHS_AUTO_OCCUPY_TTL / BMAHS_MAX_LEASE

1 / 120 / 3600

自动占用策略与租约上限

BMAHS_CALL_TIMEOUT / BMAHS_QUERY_INTERVAL / BMAHS_EXPIRE_SEC

30 / 300 / 1800

调用超时、query 周期与设备过期时限

BMAHS_TOOL_ALLOW / BMAHS_TOOL_DENY

动态工具黑白名单(fnmatch 通配符,deny 优先)

BMAHS_CAPTURE_DIR

<系统临时目录>/bmahs_captures

bmahs_screenshot 帧落盘目录

BMAHS_MCAST_IF_V4

自动枚举

手动指定组播网卡(逗号分隔本机 IPv4)

BMAHS_HTTP_HOST / BMAHS_HTTP_PORT / BMAHS_HTTP_PATH / BMAHS_HTTP_TOKEN

0.0.0.0 / 9530 / /mcp / 无

HTTP 模式默认参数

BMAHS_LOG_LEVEL

info

日志级别(一律走 stderr)

开发与测试

npm test          # vitest 单元/集成测试(假设备,不需要真实硬件)
npm run smoke     # 端到端 17 项契约(假设备 + stdio 网关 + MCP 客户端)
npm run smoke:py  # 跨语言联调(拉起 ../examples/demo_light.py,需要上层 .venv)

测试拓扑:fake-device.ts 是只实现控制层与 UI 流的测试假设备(不绑组播、状态可注入),与 Python 版 tests/fake_device.py 行为对齐。

协议

完整协议文档见 Python 主仓库的 docs/BMAHS.md:UDP 组播一报文一 JSON(≤1400 字节)负责发现,TCP 一行 JSON + \n 负责控制,连上先读 hello;网关在协议中承担「智能体」角色(§4.8)。

License

MIT

Available Tools

7 tools
bmahs_callA

对 BMAHS 设备执行任意其操作清单内(operations)的动作,参数按该动作的 args 传。适合调用尚未生成独立工具的动作,或临时查看新设备。

ParametersJSON Schema
NameRequiredDescriptionDefault
argsNo动作参数(按该设备 operations 中该动作 args 的字段名与类型)
actionYes动作名,必须在设备 operations 清单中
deviceYes设备 id 或显示名

TDQS

A3.7/5.0
Behavior2/5

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

No annotations are present, so the description carries the full safety burden. It discloses that any operation can be invoked, but does not warn about possible side effects, mutation, device-state requirements, or the need to call bmahs_describe/bmahs_occupy before executing. For a generic arbitrary-action tool this is a significant transparency gap.

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?

Two concise sentences: the first front-loads the core behavior, the second clarifies the intended use cases. No filler or redundant restatement of the tool name.

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?

The description provides the essential call pattern and use cases for a generic dispatcher, but it does not explain how to discover the operations list, what the response looks like, or whether actions can mutate device state. With no output schema and no annotations, these are meaningful gaps.

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%, so the baseline is 3. The tool description adds the useful idea that args must match the selected action's definition, but the schema property descriptions already state this; the description adds little beyond that.

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?

The description states a specific action: execute any operation in the device's operations list, and explicitly positions it as the fallback for operations that do not have a dedicated tool. This clearly distinguishes it from specialized siblings like bmahs_screenshot or bmahs_describe.

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?

It gives concrete when-to-use guidance: for actions without a standalone tool or for temporarily inspecting a new device. The '尚未生成独立工具' condition implies preference for dedicated tools when available, though it does not name specific alternatives.

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

bmahs_describeA
Read-only

读取某台 BMAHS 设备的完整操作清单(operations)、安全边界(security)与自然语言自述。

ParametersJSON Schema
NameRequiredDescriptionDefault
deviceYes设备 id 或显示名

TDQS

A3.6/5.0
Behavior3/5

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

The readOnlyHint annotation already signals a safe read operation, and the description is consistent with that by saying '读取'. The description adds useful context about what the tool returns (operations, security, self-description), but it does not disclose additional behavioral details such as error conditions or whether missing devices produce failures.

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 a single, compact sentence with no filler. It front-loads the action and resource before listing the returned content, making it immediately scannable and information-dense.

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?

For a simple one-parameter read-only introspection tool, the description adequately conveys what the tool returns. There is no output schema, so the description's enumeration of operations, security, and self-description partially compensates, though it could mention what 'security' means or how failures are surfaced.

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?

The schema already documents the single parameter 'device' as '设备 id 或显示名' with 100% coverage, so the description needs to add little. The description's reference to '某台 BMAHS 设备' aligns with the schema but adds no new semantic detail about formats or constraints.

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?

The description uses a specific verb ('读取', read) with a specific resource ('某台 BMAHS 设备') and clearly enumerates the returned content: operations, security boundaries, and natural-language self-description. This distinguishes it from action-oriented siblings like bmahs_call and bmahs_occupy.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives no explicit guidance on when to use this tool versus its siblings. It does not name alternatives or state conditions such as 'use before calling bmahs_call' or 'use to inspect device capabilities', leaving the agent to infer usage from the word 'describe'.

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

bmahs_devicesA
Read-only

列出当前发现的全部 BMAHS 设备(id、显示名、自然语言自述、类型、状态、占用方与连接地址)。选设备、查占用状态时先用这个工具。

ParametersJSON Schema
NameRequiredDescriptionDefault
typeNo按品类过滤(可选),如 light、display

TDQS

A4/5.0
Behavior3/5

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

The annotations already include readOnlyHint: true, so the agent knows this is a safe read operation. The description adds value by listing the fields returned (id, display name, natural language description, type, status, occupant, connection address), which is useful context. However, it does not disclose any behavioral caveats such as pagination, performance, or data freshness, which would be relevant for a list tool. With annotations covering the safety profile, a 3 is appropriate.

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 two concise sentences with no fluff. It front-loads the primary action and return fields, then gives a clear usage directive. Every sentence earns its place, and the structure is efficient and scannable.

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?

For a simple list tool with no output schema, the description adequately covers what the tool does, what it returns, and when to use it. It includes the key fields and the usage context. It does not address edge cases like empty results or the need to refresh the discovery list, but given the presence of a bmahs_refresh sibling, the 'currently discovered' phrasing implies current state. Overall, it is complete enough for an agent to invoke correctly.

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?

The schema description coverage is 100%, meaning the 'type' parameter is fully documented in the schema with its purpose (filter by category) and examples (light, display). The tool description does not add any additional meaning about the parameter; it does not even mention filtering. Since the schema already provides complete parameter semantics, the baseline of 3 is maintained.

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?

The description clearly states the tool's purpose: '列出当前发现的全部 BMAHS 设备' (list all discovered BMAHS devices) and enumerates the returned fields (id, display name, description, type, status, occupant, address). It differentiates from siblings by positioning itself as the 'first' tool for device selection and occupancy checks, distinguishing it from more specific operations like occupy, release, or describe.

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?

It provides explicit usage guidance: '选设备、查占用状态时先用这个工具' (use this tool first when selecting a device or checking occupancy status). This tells the agent when to start, but it does not explicitly name alternative tools or state when not to use it. The guidance is clear and action-oriented, though it lacks the explicit sibling differentiation seen in the highest example.

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

bmahs_occupyA

独占占用一台 BMAHS 设备(返回的 token 由网关保存并自动携带)。租约由网关强制为有限时长:不带 ttl 默认 120 秒(2 分钟),请求值超过上限(默认 3600 秒)会被截断,不支持无限期占用。租约到期设备自动收回占用权;任务结束也可调用 bmahs_release 提前释放。

ParametersJSON Schema
NameRequiredDescriptionDefault
ttlNo租约秒数(默认 120=2 分钟;超过上限会被截断)
deviceYes设备 id 或显示名

TDQS

A4.6/5.0
Behavior5/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure, and it delivers: token persistence, gateway-managed lease enforcement, default TTL, upper-limit truncation, prohibition of indefinite leases, automatic reclamation on expiry, and manual release via bmahs_release. This is strong behavioral transparency.

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?

Three dense sentences, each earning its place. The main purpose is front-loaded, followed by lease constraints and the release alternative. No filler or redundant restatement of the schema is present.

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?

The description is nearly complete for a lease-acquisition tool: it covers default behavior, limits, automatic expiry, token handling, and release. It does not specify what happens if the device is already occupied or whether occupancy is blocked or queued, a small but relevant gap for an exclusive-occupancy tool. No output schema exists, but the token handling is disclosed.

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 meaningful semantics beyond the schema: it clarifies that omitting ttl defaults to 120 seconds, that values beyond the default server cap of 3600 seconds are truncated, and that infinite leases are unsupported. This goes beyond the schema's field-level text.

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?

The description opens with a precise action and resource: '独占占用一台 BMAHS 设备' (exclusively occupy one BMAHS device). It clearly identifies the tool's core purpose and distinguishes it from the release sibling by explicitly naming bmahs_release as the early-release counterpart.

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?

The description gives clear operational context: leases are finite, default to 120 seconds, get truncated at the upper limit, and auto-expire. It also routes the agent to bmahs_release when the task ends. It does not explicitly state when not to use this tool versus bmahs_call or bmahs_screenshot, so it stops short of a 5.

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

bmahs_refreshA
Read-only

重新扫描 BMAHS 设备:发送组播 query 并刷新各设备的自述(hello)。当设备列表为空、新设备刚上电、或怀疑列表过期时调用。

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.6/5.0
Behavior4/5

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

Annotations declare readOnlyHint=true, which the description does not contradict—refreshing is a read-like operation that updates a cached view. The description adds context beyond the annotation by specifying the mechanism (multicast query) and the effect (refresh self-descriptions), giving the agent a better mental model of what happens. It does not detail potential side effects like network traffic or latency, but given the read-only hint, this is acceptable.

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 two sentences with no fluff. The first sentence states the action and mechanism; the second lists the usage triggers. The most important information (what it does) is front-loaded, and every clause earns its place. It is compact yet comprehensive for a zero-parameter tool.

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?

Given the tool's simplicity (no parameters, no output schema, read-only annotation), the description covers the essential aspects: what it does, how it works, and when to call it. It does not describe the return value or post-refresh behavior, but since no output schema exists, this is not a critical gap. It is complete enough for an agent to invoke correctly.

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?

The tool has zero parameters, so the input schema is trivial (coverage 100%). The description does not need to explain parameter semantics, and the absence of parameters makes this dimension a non-issue. The baseline of 4 applies because there is nothing to document; the description correctly stays focused on the operation itself.

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?

The description clearly states the action ('重新扫描' / rescan) and the resource (BMAHS devices), and explains it sends a multicast query to refresh each device's self-description. This distinguishes it from sibling tools like bmahs_devices (likely listing devices) and bmahs_describe (describing a device), as it focuses on refreshing the device list rather than retrieving or modifying specific entries.

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?

The description provides explicit conditions for when to invoke the tool: when the device list is empty, a new device has just powered on, or the list is suspected to be stale. These clear triggers guide an agent to choose this tool over siblings, which have different purposes (e.g., bmahs_occupy/release for device control, bmahs_call/screenshot for device interaction).

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

bmahs_releaseA

释放对某台 BMAHS 设备的占用。任务结束、失败或取消后必须调用,否则其它智能体会一直收到「被占用」。

ParametersJSON Schema
NameRequiredDescriptionDefault
deviceYes设备 id 或显示名

TDQS

A4.2/5.0
Behavior4/5

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

With no annotations provided, the description carries the full behavioral burden. It discloses the state mutation (releasing occupancy) and the system-level consequence of skipping the call: "否则其它智能体会一直收到「被占用」" (otherwise other agents will keep receiving 'occupied'). This reveals the locking semantics of the occupancy model. It does not cover idempotency or error behavior on double-release, but the critical behavioral traits are present.

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?

Two dense sentences with zero filler. The first states the operation, the second gives the mandatory call-condition and the failure consequence. Every clause earns its place, and the core purpose is front-loaded in the first sentence.

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?

For a single-parameter, no-output-schema tool, the description is nearly complete: it covers what the tool does, when it must be called, and the consequence of not calling. Minor gaps are the lack of return-value information and double-release behavior, but an agent has what it needs to invoke the tool correctly at the right time.

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% — the schema already documents `device` as "设备 id 或显示名" (device id or display name). The description adds no parameter-level detail beyond referring to "某台 BMAHS 设备" (a certain BMAHS device), which does not exceed what the schema already provides. Baseline 3 applies since the schema does the heavy lifting.

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?

The description states a specific verb and resource: "释放对某台 BMAHS 设备的占用" (release the occupancy of a BMAHS device). It clearly identifies the inverse of the sibling bmahs_occupy without needing to open any schema, and is distinct from the listing, refresh, describe, call, and screenshot siblings.

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?

The description gives explicit call timing: "任务结束、失败或取消后必须调用" (must be called after the task ends, fails, or is cancelled), telling the agent exactly when to invoke it. It also explains the consequence of omission — other agents keep seeing the device as occupied — which reinforces the condition. It stops short of explicitly naming the alternative (bmahs_occupy), but the when-condition is unambiguous.

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

bmahs_screenshotA

(实验)对声明了 ui 能力的 BMAHS 设备抓取一帧当前画面:自动 ui.start → 二进制流取一帧 JPEG → ui.stop,返回图片与保存路径。

ParametersJSON Schema
NameRequiredDescriptionDefault
deviceYes设备 id 或显示名
max_widthNo期望画面最大宽度(像素),设备按自身能力缩放

TDQS

A4.2/5.0
Behavior4/5

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

No annotations are provided, so the description carries the behavioral burden. It discloses the full operational sequence: automatic ui.start, JPEG frame capture from binary stream, and ui.stop, plus the return value. This goes beyond the schema and gives the agent a realistic model of side effects, though it does not discuss failure modes or permissions.

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 entire tool behavior, precondition, workflow, and return value are packed into one efficient sentence with no filler. The purpose is front-loaded and the lifecycle detail is presented in a clear, compact sequence.

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?

For a simple 2-parameter tool with no output schema, the description covers the key return value (image and saved path), the precondition (UI capability), and the operational flow. It is slightly vague about the exact image representation (binary vs base64) but is otherwise sufficient for invoking the tool correctly.

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%, so the parameters are already documented in the input schema. The description does not add meaningful semantics beyond stating the screenshot purpose; max_width's scaling behavior is already described in the schema.

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?

The description uses a specific verb and resource: '对声明了 ui 能力的 BMAHS 设备抓取一帧当前画面' clearly states it captures a screenshot frame from UI-capable BMAHS devices. It also mentions the output (image and saved path), distinguishing it from siblings like bmahs_devices and bmahs_call.

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?

The description provides clear context by restricting use to devices that declare UI capability and by outlining the automated ui.start → capture → ui.stop flow. It does not explicitly name alternatives or exclusion cases, but the precondition plus the very distinct purpose makes intended usage clear.

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

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 7 tool updatesv0.1.0
    • First observedbmahs_call
    • First observedbmahs_describe
    • First observedbmahs_devices
    • First observedbmahs_occupy
    • First observedbmahs_refresh
    • First observedbmahs_release
    • First observedbmahs_screenshot

TDQS

A4.1/5.0

Scored across 7 tools

Disambiguation4/5

Each tool targets a distinct operation: listing, refreshing, describing, occupying, releasing, generic calling, and screenshotting. The only minor ambiguity is between bmahs_devices and bmahs_refresh (both concern device discovery), but their descriptions clearly separate current listing from force-rescanning.

Naming Consistency4/5

All tools share the uniform bmahs_ prefix and snake_case style, with simple verbs (refresh, describe, occupy, release, call). The slight inconsistency is that bmahs_devices uses a noun instead of a verb like list_devices, and bmahs_screenshot is a noun-verb hybrid, but the pattern remains predictable.

Tool Count5/5

Seven tools is a well-scoped size for a device gateway. Each tool covers a distinct phase of the device lifecycle: discovery, inspection, access control, and execution, without unnecessary redundancy or bloat.

Completeness5/5

The tool surface provides a full workflow: discover devices (devices/refresh), understand capabilities (describe), reserve access (occupy/release), execute actions (call), and capture UI (screenshot). The generic bmahs_call fills gaps for unmodeled actions, making the set effectively complete for the stated gateway purpose.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers