Skip to main content
Glama

js

Evaluate JavaScript in the active page and return the last expression's result, with await supported for async workflows.

Instructions

Evaluate JS in the page; returns the last expression (await allowed).

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "code": "<code>"
    },
    "name": "js"
  }
}

Input Schema

NameRequiredDescriptionDefault
tabNo
codeYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

C2.8/5.0
Behavior2/5

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

No annotations are supplied, so the description carries the full burden. It does disclose two useful traits — the last expression is returned and await is permitted — which tells the agent it can write promise-returning snippets. But for a tool that executes arbitrary code in a live page, it says nothing about side effects, execution context (main world vs isolated), timeouts, error propagation, or whether mutations persist.

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?

A single front-loaded sentence with zero padding; the return contract is parenthetically attached to the action rather than buried. Every clause carries information.

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?

For a high-power arbitrary-code-execution tool with no annotations, no output schema, and zero schema parameter descriptions, the definition is too thin. It should at minimum explain the 'tab' target, the default when omitted, and what happens on thrown errors — none of which are covered by any structured field.

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 and only partially does: 'code' is clarified as JavaScript whose last expression is returned and where await works. The 'tab' parameter is never mentioned anywhere, so the agent has no idea whether it takes a tab id or an index, or what the default target is.

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?

Names a specific verb + resource: evaluate JavaScript in the page, and states the return contract (last expression, await allowed). That distinguishes it from the sibling set (act, nav, read, shot) which operate on the page rather than on arbitrary code. It stops short of 5 because it never says which page/frame context is targeted, which is exactly what the ambiguous 'tab' parameter governs.

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

Usage Guidelines2/5

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

There is no guidance on when to reach for this tool versus act, nav, read, or shot, and no exclusions or preconditions. The agent must infer that this is the escape hatch for things the structured page tools cannot do. Implied usage only, and only weakly.

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

Deploy Server

Other Tools