Skip to main content
Glama

Robot Actions — Remote Device Control

Session execute

session_execute
Destructive

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.7/5.0
Behavior4/5

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

Annotations already declare destructiveHint=true, openWorldHint=true, and readOnlyHint=false, so the mutation risk is covered structurally. The description adds genuinely non-obvious behavior: the script runs as a function body, must `return` to produce a value, and silently yields null otherwise — a real failure-mode disclosure. It stops short of discussing sandboxing, thrown exceptions, or execution limits, so a 4 rather than 5.

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?

Front-loads the verb and resource, then the critical return-value gotcha, then scope, then use cases, then alternatives. Dense but every clause carries information an agent needs; no filler or repetition of the name.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/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 carries the return-value contract itself (returned value vs. null) and explains args plumbing, addressing, environment scope, and sibling alternatives. Nothing an agent needs to call this correctly 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 the baseline is 3. The description adds meaning beyond the schema by clarifying that `script` is evaluated as a function body (not a bare expression) and that `args` become the script's arguments — semantics the schema's terse one-liners do not convey. sessionId gets no added context.

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 immediately distinguishes itself from sibling evaluators by naming web_evaluate, ios_safari_evaluate, and android_devtools_evaluate with their addressing keys. An agent can route correctly without opening any schema.

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 scopes usage to 'what the protocol has no verb for' and gives concrete triggering examples (reading computed style, clearing an input before session_send_keys, scrolling into view). It also states the constraint 'Browser sessions only' and names the three alternative tools with their environments, so when-not is covered.

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