Skip to main content
Glama

Robot Actions — Remote Device Control

Flow recording wrap in condition

flow_recording_wrap_in_condition

Make a RANGE of already-recorded steps conditional: they run at replay only when a check on screen passes.

Record the steps normally FIRST, then wrap them. That is the order conditionals are actually discovered — you do not know a promo banner is intermittent until you have already recorded dismissing it. The wrapped steps are MOVED into the branch, so a step never exists twice, and the remaining steps are renumbered.

The condition is evaluated against the element at (x,y), which must be on screen NOW so its locators can be recorded — the same binding every other element-bound action uses.

Use it for anything that appears only sometimes: a cookie banner, a first-run tutorial, an occasional interstitial, a rating prompt.

NOTE: at replay a condition that cannot be decided is treated as FALSE (the else branch runs). Set timeoutMs to the realistic worst-case render time of the thing you are checking for — too small a budget judges a slow element absent, runs the wrong branch, and the run still reports success.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xYesX of the element the CONDITION checks — not the element the wrapped steps act on.
yYesY of the element the condition checks.
checkYesWhat to check. exists/notExists test presence; textEquals/textContains compare an attribute. visualMatch is deliberately unavailable here — it is fail-safe by design, so as a branch selector it would silently always take the same branch.
branchNoWhich branch the wrapped steps become. Default 'then' — run them when the check passes.
expectedNoExpected value. Required for textEquals and textContains.
attributeNoAttribute to read for text checks. iOS: label, value, name. Android: text, content-desc, resource-id.
timeoutMsNoHow long to wait for the check to become true before deciding it is false. Default 5000.
recordingIdYesRecording ID from flow_recording_start
toStepIndexYesLast step to wrap (1-based, inclusive).
fromStepIndexYesFirst step to wrap (1-based). Step 1 is the appLaunch that seeds the start state and cannot be wrapped.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.6/5.0
Behavior5/5

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

Annotations cover the safety profile (readOnlyHint=false, destructiveHint=false), and the description adds substantial behavior beyond them: wrapped steps are MOVED into the branch and never duplicated, remaining steps are renumbered, the condition element must be on screen now for locator recording, and at replay an undecidable condition defaults to FALSE. The timeoutMs warning about silently taking the wrong branch while still reporting success is exactly the kind of non-obvious behavior an agent needs.

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 the core purpose and ordering rule, and each paragraph earns its place by covering a distinct concern (ordering, semantics, use cases, replay caveat). It is longer than strictly necessary, but the length is justified by the complexity of the operation.

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 mutation tool with 10 parameters, no output schema, and no idempotency guarantee, the description covers ordering, branch semantics, element binding, replay defaults, and the timeout failure mode. Nothing an agent needs to call it correctly is missing.

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 real meaning: it clarifies that (x,y) refers to the element the condition checks rather than the wrapped steps, explains why visualMatch is excluded from check, and gives concrete guidance for timeoutMs (worst-case render time). These go beyond the schema's field definitions.

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 (wrap) and resource (a range of already-recorded steps) and defines the effect precisely: the steps become conditional and run at replay only when a screen check passes. This is clearly distinguishable from siblings like flow_recording_insert_component or flow_recording_action without opening a schema.

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?

Gives strong when-to-use guidance ('Use it for anything that appears only sometimes: a cookie banner, a first-run tutorial, an occasional interstitial, a rating prompt') and a critical ordering prerequisite ('Record the steps normally FIRST, then wrap them'). It does not explicitly name an alternative sibling, so it falls just short of 5.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources