Skip to main content
Glama

读取并关闭阻塞 Keil 的模态对话框

dismiss_dialog
Idempotent

Reads Keil uVision modal dialog content and dismisses it by clicking the matching button, auto-selecting or falling back to WM_CLOSE. Unblocks stuck debug commands when a dialog is blocking.

Instructions

把 Keil「有个模态框在挡路」补成「框里写什么、点哪个按钮」:枚举 UV4 的模态对话框(类名 #32770),读出正文(Static 控件)与全部按钮文字(Button 控件)并按按钮点击关闭。button 传按钮文字(如「确定」「重试」,支持部分匹配);不传则按 确定/OK/是/关闭/重试 的语义顺序自动挑,没有可点按钮时退化为 WM_CLOSE。title 可按标题筛(多个框时),index 取第几个(默认 0)。返回 {ok, dismissed, clicked, method, dialog{title,message,buttons}, remaining}。用法:命令不返回且 keil_health 报 modal_blocked_suspected=true 时调它——先看 dialog.message 知道 Keil 报了什么,再决定点哪个按钮,解除阻塞后重试原命令。注意:① 关框只解除阻塞,不等于问题已修(如正文说输出文件写不进去,要先解决占用/权限);② 指定 button 却匹配不到时不会擅自改点别的按钮,而是返回 button_not_found 并列出可用按钮。 【参数】必填: 无;可选: button, title, index 【调用示例】{} 【风险】中——会改变目标状态或占用共享资源(调试态/串口/Keil 实例),必要时可回退。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
indexNo
titleNo
buttonNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.8

TDQS

A5/5.0
Behavior5/5

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

Even with annotations covering idempotency and non-destructiveness, the description adds meaningful behavioral detail: it extracts dialog text, auto-selects buttons by semantic order, falls back to WM_CLOSE, and returns button_not_found rather than silently clicking a different button. It also warns that dismissing the dialog does not fix the underlying problem, which is important context.

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 dense but efficiently structured: the core behavior is front-loaded, parameters are explained inline, the return shape is included, and the warnings are compact. No sentence is redundant with the schema or annotations.

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?

For a tool with three optional parameters and an output schema, the description covers the triggering condition, parameter semantics, return fields, fallback behavior, and operational caveats. An agent has everything needed to invoke it correctly in the blocking-dialog scenario.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, but the description fully compensates: button supports partial matching and auto-selection, title filters when multiple dialogs exist, and index selects which dialog to target. Every parameter is explained with behavior beyond its bare name and default value.

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: enumerate UV4 modal dialogs, read their Static text and Button labels, and click a button to dismiss the blocking dialog. It clearly differentiates the tool from siblings like keil_command or restart_keil by targeting the modal-blocking scenario specifically.

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 is explicit about when to use it: when a command does not return and keil_health reports modal_blocked_suspected=true. It also prescribes a workflow—read dialog.message first, choose a button, dismiss, then retry the original command—and explains the fallback behavior when no button matches.

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