Skip to main content
Glama

Robot Actions — Remote Device Control

session_execute

Run JavaScript in the page of a browser session and return its value. The script runs as a FUNCTION BODY, so it must return what you want back — a script with no return yields null, which is the usual reason this looks like it did nothing. args are passed through as the script's arguments. Browser sessions only. Addressed by sessionId. Use it for what the protocol has no verb for: reading a computed style, clearing an input before session_send_keys, scrolling an element into view. The equivalents elsewhere are web_evaluate (desktop grid page, by pageId) and ios_safari_evaluate / android_devtools_evaluate (real device browser, by udid).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
argsNoArguments to pass to the script
scriptYesJavaScript code to execute (e.g. "return document.title")
sessionIdYesSession ID

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.6/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does well: it explains the function-body execution model, the requirement to return a value, the null-result pitfall, and args passing. It does not cover async/Promise behavior or potential side effects of arbitrary JS, but the disclosed gotchas are valuable.

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?

Every sentence earns its place: main purpose first, then behavioral gotcha, then scope and sibling routing. No filler or redundancy despite the length.

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?

For a tool with no annotations and no output schema, this is unusually complete: it covers what it does, how scripts must be written, a common failure mode, scope restrictions, and alternatives. A brief note on serialization of return values would make it fully complete, but nothing critical is missing.

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?

Schema coverage is 100%, so baseline is 3. The description adds real meaning beyond the schema: script must be a function body containing return, and args are passed through to that function. This clarifies what would otherwise be ambiguous.

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?

States a specific verb and resource: 'Run JavaScript in the page of a browser session and return its value.' It also differentiates from sibling evaluate tools by naming equivalents and its intended niche, so an agent can distinguish it from web_evaluate and ios/android evaluate.

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

Usage Guidelines5/5

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

Explicitly says when to use it: 'Use it for what the protocol has no verb for', gives concrete examples, and names alternative tools across contexts. Also constrains scope with 'Browser sessions only.'

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources