Skip to main content
Glama

browser_select_frame

Execute JavaScript in a specific frame by index or return its text; locate the frame first with browser_list_frames.

Instructions

Execute JavaScript in a specific frame by frame index, through the Chrome debugger in that frame's own context - also a frame from another site. Use browser_list_frames first to find the right index. A returned promise is awaited; without code it returns the frame's text (first 5000 characters). The frame is identified by a one-time mark the extension puts in that frame's document, not by its address or position; if the mark is not found, nothing is run (error frame-not-reachable, and retry says whether calling again can help; a frame whose document is replaced while the call looks for it gives retry: true). The call answers within 29.5 s; if the time runs out before the code is sent, the answer is error call-timeout with sent:false (nothing ran).

Input Schema

NameRequiredDescriptionDefault
codeNoJavaScript EXPRESSION to evaluate in the frame (default: returns its text content)
frame_indexYesFrame index from browser_list_frames (0 = main frame)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.31.0
    • changedInput schema / properties / code / description
      Previous value: -"JavaScript to execute in the frame (default: returns text content)"New value: +"JavaScript EXPRESSION to evaluate in the frame (default: returns its text content)"
  2. First observedv1.0.0

TDQS

A4.2/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so thoroughly: promise awaiting, default text return capped at 5000 characters, mark-based frame identification rather than address/position, frame-not-reachable with a retry flag, and a 29.5 s deadline yielding call-timeout with sent:false meaning nothing ran.

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 core action and prerequisite are front-loaded in the first two sentences, and the remaining detail is genuinely useful error/timeout semantics. It is dense and clause-heavy, but little of it is filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a two-parameter tool with no annotations and no output schema, the description covers invocation prerequisites, default return value, failure modes, and timing limits. It stops short of describing how a non-promise expression's value is returned, which is the one remaining gap.

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: the frame is located via a one-time mark rather than its index at runtime, and omitting code yields the frame's text content, which clarifies the optional parameter's default behavior beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource: execute JavaScript in a named frame, in that frame's own debugger context, including cross-site frames. It is clear, but it never contrasts with the obvious sibling browser_execute_script, and the tool name ('select_frame') suggests frame targeting rather than code execution, which the description silently overrides.

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?

It gives an explicit prerequisite: call browser_list_frames first to obtain the index. It implies the context in which this tool applies (a specific frame rather than the page), but offers no exclusion rule such as 'use browser_execute_script for the main frame', leaving that routing to inference.

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