web_wait_for
Waits (polls, not a fixed sleep) until a JavaScript condition is truthy on the page, or times out. Use for SPA pages that hydrate after load, e.g. condition "document.querySelector('input[name=password]')". Returns met:true/false.
This record as markdown: /tools/com-local-mcp-local-mcp/web-wait-for.md
What web_wait_for does on Local
AI agents invoke web_wait_for to trigger actions in Local. What it does depends on the arguments the agent supplies, and its effects often reach beyond the immediate call: builds kicked off, notifications sent, workflows started.
| Parameter | Type | Required | Description |
|---|---|---|---|
session | string | — | Session name (default 'default'). |
condition | string | Yes | JS expression evaluated on the page; waits until it's truthy. e.g. document.querySelector('.feed') |
timeout_seconds | integer | — | Max seconds to wait (default 15). |
Parameters from the server's own tool schema.
Why web_wait_for is rated High
This tool allows arbitrary JavaScript evaluation against DOM state, which is an Execute action—it runs code whose effects depend on the condition argument. Combined with sibling tools like chrome_evaluate_js and chrome_fill_form, this enables automation workflows that can interact with any web application.
From the tool's definition Tool executes JavaScript evaluation on a page via polling 'until a JavaScript condition is truthy'. The tool runs arbitrary JavaScript conditions specified in arguments (e.g., 'document.querySelector(...)'), which constitutes code execution in a browser…
Attacks that exploit this kind of access
The rule that runs web_wait_for safely
PolicyLayer is an MCP gateway: it sits between your AI agents and Local, and checks every tool call against a rule you set before the call runs. Nothing changes on the server itself. For web_wait_for, this is the rule to start with:
web_wait_for stays usable, but rate-capped: a runaway agent can't fire it dozens of times a minute. Everything else on the server is denied unless you say otherwise.
The button opens the PolicyLayer dashboard: create your workspace, connect Local, apply this rule, and every web_wait_for call is checked against it from then on.
Questions about web_wait_for
Waits (polls, not a fixed sleep) until a JavaScript condition is truthy on the page, or times out. Use for SPA pages that hydrate after load, e.g. condition "document.querySelector('input[name=password]')". Returns met:true/false. It is categorised as a Execute tool in the Local MCP Server, which means it can trigger actions or run processes. Use rate limits and argument validation.
web_wait_for accepts 3 parameters: session, condition, timeout_seconds. Required: condition. The full parameter table on this page comes from the server's own tool schema.
Register the Local MCP server in PolicyLayer and add a rule for web_wait_for: allow, deny, rate-limit, or require approval. Point your MCP client at the PolicyLayer proxy URL and the rule is enforced on every call, before it reaches Local. Nothing to install.
web_wait_for is a Execute tool with high risk. Execute tools should be rate-limited and have argument validation enabled.
Yes. Add a rate_limit block to the web_wait_for rule in your PolicyLayer policy. For example, setting max: 10 and window: 60 limits the tool to 10 calls per minute. Rate limits are tracked per agent session and reset automatically.
Set action: deny in the PolicyLayer policy for web_wait_for. The AI agent will receive a policy violation error and cannot call the tool. You can also include a reason field to explain why the tool is blocked.
web_wait_for is provided by the Local MCP server (local-mcp). PolicyLayer sits as a proxy in front of this server to enforce policies before tool calls reach the server.
More on Local, and thousands of servers like it.
Across the catalogue