Skip to main content
Glama

Evaluate JavaScript in Page

gpm_browser_evaluate

Execute JavaScript in the current browser page and return the result as JSON, optionally targeting a specific GPM profile connected via CDP.

Instructions

Chạy đoạn mã JavaScript trong ngữ cảnh trang hiện tại và trả về giá trị JSON.

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

Input Schema

NameRequiredDescriptionDefault
expressionYesBiểu thức JS hoặc hàm dạng "() => document.title" hoặc "document.querySelectorAll('a').length"
profile_idNoID của profile GPM đang kết nối CDP (có thể bỏ trống nếu chỉ có 1 profile đang kết nối)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

C2.9/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 behavioral burden, and it discloses almost nothing. It does not say whether the expression is awaited or may return a Promise, whether page state may be mutated, what happens on syntax errors or exceptions, or which page/frame is targeted. For an arbitrary-code-execution tool this is a substantial gap.

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?

A single short sentence that front-loads the action and the return type, with no filler. It is efficient, though the brevity contributes to the behavioral gaps noted elsewhere.

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?

Given an arbitrary-evaluation tool with no annotations and no output schema, the definition should explain return-value serialization, async handling, and error behavior. None of that is present, leaving an agent likely to misuse it on promise-returning expressions or non-serializable results.

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

Parameters3/5

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

Schema description coverage is 100%, with the expression parameter documented by example and profile_id explained as optional when only one profile is connected. The description adds no meaning beyond the schema, so baseline 3 applies.

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 and resource: run JavaScript code in the current page context and return a JSON value. That reads clearly as an arbitrary-evaluation escape hatch distinct from action siblings like click, type, or press. It stops short of explicitly differentiating itself from those siblings, so it does not reach 5.

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 raw evaluation versus the purpose-built siblings (snapshot, click, wait), nor any exclusion such as 'do not use for simple clicks'. The agent must infer the use case entirely from the tool name.

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