Skip to main content
Glama

evaluate_js

Destructive

Execute JavaScript in a live PyWebView session for privileged debugging, inspecting page state, and testing bridge behavior; requires server --allow-js and may mutate the app.

Instructions

PRIVILEGED debug escape hatch; requires server --allow-js. May mutate bridge/app. Not acceptance evidence.

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": {
      "session_id": "<session_id>",
      "expression": "<expression>"
    },
    "name": "evaluate_js"
  }
}

Input Schema

NameRequiredDescriptionDefault
timeoutNo
expressionYes
session_idYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3.3/5.0
Behavior4/5

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

Annotations already declare destructiveHint=true and openWorldHint=true, so the bar is lower, yet the description adds real context: the server-side enablement flag and the fact that mutations can reach the bridge/app layer, not just the page. It stops short of describing error behavior or what happens on timeout.

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?

Three short clauses, privilege warning front-loaded, zero filler. The telegraphic fragments ("May mutate bridge/app") are terse to the point of slight ambiguity about the subject, but nothing is wasted.

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 an arbitrary-code-execution tool with no output schema, an agent still doesn't know the result shape, what scope the expression sees, or how failures surface. Annotations cover the safety profile, but the description leaves too much of the call/return contract unstated for a high-risk tool.

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 carries the burden for session_id, expression, and timeout — and it says nothing about any of them. It doesn't clarify whether expression runs in page or bridge context, nor how the 5s default/120s cap timeout behaves.

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?

"PRIVILEGED debug escape hatch" plus "May mutate bridge/app" identifies this as the arbitrary code-execution tool, and "Not acceptance evidence" separates it from verification siblings like assert_ui or snapshot. It never states plainly that it evaluates a JavaScript expression in a session or what it returns, leaning on the name for that.

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?

It gives one exclusion ("not acceptance evidence") and one prerequisite ("requires server --allow-js"), which are useful routing signals. It never says positively when this should be chosen over inspect/snapshot/interact, leaving the fallback-of-last-resort reading to inference from "escape hatch".

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