Skip to main content
Glama
webdriverio

WebDriverIO MCP Server

Official

switch_frame

Idempotent

Switch WebDriver focus to an iframe using a CSS or XPath selector. Omit the selector to return to the top-level frame. All subsequent actions apply within the selected frame.

Instructions

Switches WebDriver frame context into an iframe by CSS/XPath selector, or back to top-level if selector is omitted. Changes persist — all subsequent click_element, set_value, get_elements calls operate within the switched frame until you switch back. Waits up to 5s for the iframe. Browser-only.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorNoCSS/XPath selector for the iframe element. Omit to switch back to the top-level frame.
Behavior4/5

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

The description adds value beyond annotations by stating that changes persist, there is a 5-second wait, and the operation is browser-specific. Annotations already provide idempotentHint and destructiveHint, so the description complements well.

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 three sentences, front-loaded with the main action, and contains no unnecessary information. Every sentence serves a purpose.

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 single parameter and no output schema, the description covers all key aspects: behavior, persistence, timeout, and browser scope. It is complete for a simple frame-switching tool.

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?

Schema coverage is 100%, with the parameter description already covering CSS/XPath selector and omission behavior. The tool description reinforces this and adds behavioral context (persistence, timeout), but does not provide new semantic details beyond 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?

The description clearly states it switches WebDriver frame context into an iframe by CSS/XPath selector, or back to top-level if selector omitted. It distinguishes from sibling tools like switch_context and switch_tab by specifying 'frame context' and 'browser-only'.

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?

The description says 'Browser-only' and explains that changes persist for subsequent commands until switching back. It implies when to use (interact with iframe content) but does not explicitly state when not to use or provide alternatives. The guidance is clear but not exhaustive.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/webdriverio/mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server