Skip to main content
Glama

等待目标进入指定状态(通用等待)

wait_state
Read-onlyIdempotent

Wait for a target state (stopped, running, expr) with timeout and polling, returning observed state and timeout kind to avoid manual polling loops.

Instructions

轮询等待目标进入某个状态,把「等待 + 超时 + 现场」三件事一次做完,省掉 AI 自己 sleep + get_status 的轮询循环(那种循环既慢又容易在超时后不知道现场是什么)。state 取值:stopped(已停下,含 halt 后)、running(执行中)、not_debugging(未进入调试)、expr(表达式成立,需配 expr 参数,如 expr="uwTick > 1000" 或 expr="state == 3",非 0 即视为成立)。timeout_s 默认 10;poll_ms 默认 200。返回 matched(是否等到)、elapsed_s、polls、observed(最终观测到的状态)、以及超时时的 timeout_kind(timeout=等到了时间还没到目标状态 / unreachable=调试通道本身连不上 / never_debugging=目标停在 not_debugging 但你等的是调试态)。不要用它替代 wait_breakpoint:断点命中要用 wait_breakpoint(它认断点 id 与命中计数,比轮询 PC 更可靠);本工具适合「等标志位/等变量变化/等目标自己停下来」这类含糊等待。 【参数】必填: 无;可选: state, timeout_s, poll_ms, expr 【调用示例】{}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
exprNo
stateNostopped
poll_msNo
timeout_sNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.8

TDQS

A4.9/5.0
Behavior5/5

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

With annotations present (readOnlyHint=true, idempotentHint=true, destructiveHint=false), the bar is lower, yet the description still adds substantial behavioral context: polling loop behavior, timeout semantics, the three distinct timeout kinds (timeout/unreachable/never_debugging), and the expr truthiness rule ('non-zero counts as valid'). This informs the agent about failure modes the annotations don't cover.

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?

The description is dense but front-loaded with the core purpose and never pads. Every sentence earns its place given the four-state semantics, timer defaults, return-value explanation, and sibling distinction. Only the trailing empty '【调用示例】{}' is mildly redundant; overall this is efficient, not bloated.

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 complex poll-with-timeout tool having 4 parameters, 4 states, expr syntax, and a sibling to disambiguate, the description covers everything an agent needs: what it does, valid states, expr format, defaults, return values with timeout_kind meanings, and when not to use it. The presence of an output schema covers return structure, and the description adds the semantic layer on top.

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 description coverage is 0% and no parameter has enums, so the description carries the full burden — and it delivers. It explains every state value's meaning, the expr format with working examples (expr="uwTick > 1000"), the non-zero truth rule, and restates defaults (timeout_s=10, poll_ms=200). The description fully compensates for the empty 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?

States a specific verb with a defined resource ('poll-wait for target to enter a state') and fully enumerates the valid states (stopped, running, not_debugging, expr) with inline semantics. It explicitly differentiates itself from sibling wait_breakpoint ('don't use it as a replacement'), so an agent can select it without inspecting either schema.

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?

Gives explicit when-to-use guidance ('wait for flag / variable change / target stopping') AND explicit when-not-to ('don't replace wait_breakpoint', which is called out by name with the reason: breakpoint id + hit count is more reliable than polling PC). The alternative tool is named and the discriminating condition is stated directly.

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