Skip to main content
Glama

evaluate

Destructive

Run JavaScript in a Chrome tab to inspect or manipulate page elements, await promises, and return JSON results or page errors.

Instructions

Run JavaScript in the page. script is an expression or a function source; a function is called with the target element (or no argument). Promises are awaited. The result is JSON (truncated); DOM elements are rendered as snapshot lines with refs. Page exceptions are returned as errors.

Input Schema

NameRequiredDescriptionDefault
tabNoTab id such as "t3"; default is the active tab
scriptYes
targetNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.9/5.0
Behavior4/5

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

Adds real behavior beyond the annotations: promises are awaited, results are JSON and truncated, DOM elements come back as snapshot lines with refs, and page exceptions surface as errors. It does not warn that arbitrary script can mutate page state (which is left to destructiveHint), but the output and error semantics are well disclosed.

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?

Five short sentences, front-loaded with the action, each adding a distinct fact (script form, promise handling, result shape, error behavior). No 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?

With no output schema, the description supplies the return-value contract and the error contract, which is the main gap it needed to fill. Minor omission: what happens to 'target' when a plain expression rather than a function is passed, and whether execution is scoped to one tab or frame beyond the 'tab' param.

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?

With only 33% schema coverage, the description carries most of the load and does so: 'script' is explained as an expression or function source, and the otherwise undocumented 'target' is given meaning as the element passed to that function. The 'tab' parameter is covered only by the schema, which is fine since the schema documents it.

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?

States a specific verb and resource: 'Run JavaScript in the page.' Nothing in the sibling list overlaps with arbitrary code execution, so the tool is practically distinguishable from hover/click/snapshot. It never names an alternative, though, so there is no explicit sibling differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is only implied: you gather that this is the code-execution escape hatch for scripting or extraction. The description never says when to prefer it over snapshot, read, find, or wait, nor any precondition such as needing a loaded page.

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