Skip to main content
Glama

执行任意 Keil 命令窗口命令

keil_command
Idempotent

Send raw Keil commands directly to the debugger and get command output/error details, enabling actions not covered by dedicated tools.

Instructions

把一条命令原样送进 Keil 命令窗口执行(走 UVSOCK 的 EXEC_CMD),并把命令窗口输出/报错一并带回来。本工具是「万能兜底」:当某个专用工具不覆盖你要的操作时,用官方命令直接做,不必等封装。 常用命令BS <符号|地址> 下断点、BK <编号> 删断点、BL 列断点、BK * 全清、G 运行、G, main 运行到 main、T 单步(进)、P 单步(过)、O 单步(出)、EVAL <表达式> 求值、WS <变量> 加观察、RESET 复位、_RDWORD(0x地址) 读 32 位内存、printf("fmt", x) 打印到命令窗口、LOG >>文件 / LOG OFF 把命令窗口输出落盘。 三条真机实测的坑(务必看)

  1. 单步的官方缩写是 T/P/O;写 Step/Tstep/Pstep 会回 *** error 34: undefined identifier(无窗口焦点时单步会退化成指令级,不进源码级)。

  2. 命令报错不会反映在 UVSOCK 的 status 上(Keil 恒回 status=0)——本工具已解析命令窗口的 *** error N: message 并自动给出错误码含义,判断成败请看返回里的 ok / errors,不要只看 status。

  3. 一次只能一条命令(含换行/回车会被拒),多步请用 batch 或 batch_debug_script。 返回:ok / status / console(命令窗口新增行)/ errors(含 code+meaning+fix)/ reply。高风险BK *RESETG 等会改变目标运行状态。 【参数】必填: command;可选: settle_ms, explain_errors 【调用示例】{"command": ""} 【风险】中——会改变目标状态或占用共享资源(调试态/串口/Keil 实例),必要时可回退。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandYes
settle_msNo
explain_errorsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.8

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already say readOnlyHint=false and destructiveHint=false, and the description goes well beyond them: it discloses that UVSOCK status is unreliable, that errors must be read from ok/errors fields, that newlines/repeated commands are rejected, and that commands like BK *, RESET, and G change target state. There is no direct contradiction with annotations, though idempotentHint=true is optimistic for arbitrary commands like G.

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?

Long but information-dense: core behavior is front-loaded, followed by a compact command cheat-sheet, three real-device pitfalls, return shape, risk note, and parameters. Each section earns its place and the formatting makes scanning easy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given a low parameter count, no enums, and an existing output schema, the description covers invocation, return values, error semantics, risk, and alternatives. Nothing an agent needs to decide whether to call it and how to interpret the result is missing.

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?

With 0% schema description coverage, the description needed to compensate. It richly documents the command parameter with examples and valid syntax, but settle_ms and explain_errors are only listed as optional, with semantics left to inference from their names and defaults. This is acceptable for optional tuning parameters but not fully explicit.

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?

Description states exact mechanism: send one raw command verbatim to Keil command window via UVSOCK EXEC_CMD and return output/errors. It also frames itself as a catch-all fallback when dedicated tools do not cover the operation, which clearly distinguishes it from specialized siblings.

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?

Explicitly says to use this tool when dedicated tools do not cover the operation, warns that only one command at a time is accepted, and routes multi-step workflows to batch or batch_debug_script. It also lists high-risk commands, advising caution.

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