Skip to main content
Glama

device_batch

Run commands or push configurations across multiple eNSP devices concurrently, with one device failure not affecting the rest. Supports shared command batches or per-device configs and reports per-device results.

Instructions

对多台设备并发执行命令或下发配置,单台失败不影响其他设备。

两种模式,commands 和 configs 必须且只能给一个:

  • commands:同一组命令打到所有选中设备,适合批量查询(display ...) 或统一配置片段。

  • configs:每台设备一份配置,写成 {"Core1": "sysname Core1\n...", "Core2": ...}, 键必须是拓扑里的设备名。

devices 省略表示拓扑里所有带 console 的设备;也可以给设备名、设备类别 (AR / LSW / FW / WLAN / CLIENT)或 "all" 混合使用,例如 ["FW1", "FW2", "LSW"]。

concurrency 是同时连几台,默认 4,范围 1–16。eNSP 的 console 端口本身能 承受并发,但一次开太多会拖慢设备启动较慢的那些,建议 4–8。

save 省略时按模式决定:commands 模式不保存(查询命令不需要), configs 模式保存。返回每台设备的 ok、执行条数、错误数和失败命令, 默认不回传全部回显;要看完整 results 就设 include_results=true。

所有命令同样会自动留痕,这次调用的命令在报告里归为同一个 batch。

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": {
      "topo_path": "<topo_path>"
    },
    "name": "device_batch"
  }
}

Input Schema

NameRequiredDescriptionDefault
hostNo127.0.0.1
saveNo
configsNo
devicesNo
commandsNo
passwordNo
usernameNo
topo_pathYes
concurrencyNo
new_passwordNo
stop_on_errorNo
include_resultsNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.3.0

TDQS

A3.6/5.0
Behavior3/5

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

No annotations exist, so the description carries the full burden, and it does disclose a lot: per-device failure isolation, save-by-mode defaults, a warning that eNSP console ports tolerate concurrency but too many connections slow booting devices, that results are NOT returned in full by default, and that commands are logged as one batch. However, stop_on_error (default true) is never explained and appears to interact with the 'one failure doesn't affect others' claim in ways the agent must guess, and no authentication requirements are mentioned despite username/password/new_password parameters.

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?

Front-loaded with purpose and the exclusive-mode rule, then bulleted per-parameter guidance that is dense and free of filler. The final line about command logging is the only marginally expendable 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 12-parameter, annotation-free mutation/execution tool this covers the decision-critical surface: mode exclusivity, device selection, defaults, and result truncation. The gaps are the undocumented stop_on_error flag and credential parameters, which matter materially for an agent driving a batched, potentially destructive operation without annotation safety hints.

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 0% across 12 parameters, so the description must compensate and it covers the important ones well (commands, configs key format, devices forms including categories and 'all', concurrency range 1-16 with default 4, save defaults, include_results). But five parameters are left entirely undefined by both schema and description: host, username, password, new_password, and stop_on_error.

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?

The opening sentence gives a specific verb pair and resource ('对多台设备并发执行命令或下发配置') plus the fault-isolation property ('单台失败不影响其他设备'), which immediately separates it from a single-device executor. It never names a sibling tool, so differentiation from device_exec / device_push_config is left implicit in the word '多台'.

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?

Strong internal routing: commands vs configs are declared mutually exclusive with exactly-one semantics, and each mode is illustrated with its use case (batch query with 'display ...' vs per-device config dictionary). Guidance on omitting devices, save defaults, and safe concurrency ranges is all present, but no alternative sibling tool is ever named, so the agent must infer when to prefer this over device_push_config or device_fetch_config.

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