Skip to main content
Glama

browser_js

Evaluate JavaScript expressions in the current tab or an iframe to automate interactions and extract data from web pages.

Instructions

Evaluate a JavaScript expression in the current tab (or an iframe target_id).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
target_idNo
expressionYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.5/5.0
Behavior2/5

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

No annotations are provided, so the description bears the full burden of disclosing behavior. It says the expression is evaluated but does not mention that JavaScript can mutate the page, whether a result is returned, how asynchronous expressions are handled, or what errors may surface. For an arbitrary-JS-execution tool this is a meaningful gap.

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 a single compact sentence with no filler. It front-loads the core operation and handles the iframe variant in a parenthetical, with every word earning its place.

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

Completeness2/5

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

With no annotationsaint, no output schema, and incomplete parameter semantics, the description is too sparse for an eval tool. It omits the return behavior, constraints on expressions, and the exact meaning of `target_id`. An agent could call it safely only by guessing at these important details.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It adds that `target_id` refers to an iframe, but it does not clarify whether `target_id` is an id, a selector, or a frame reference, nor does it explain how `expression` results are returned or formatted. The addition is marginal beyond the schema's own property titles.

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 states a specific verb ('Evaluate') and a clear resource ('a JavaScript expression in the current tab'), with an explicit iframe variant via `target_id`. This distinguishes the tool from browser-level sibling tools such as browser_goto or browser_cdp.

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 clearly scopes the tool to the current tab and identifies the iframe condition via `target_id`. It does not explicitly name alternatives or when not to use it, but the intended context is clear enough for an agent to select it over siblings.

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