Skip to main content
Glama
iamvinitk
by iamvinitk

Evaluate JS in a renderer

evaluate

Run JavaScript expressions in an Electron renderer's main world to inspect DOM, read state, and automate tasks beyond basic click/type actions.

Instructions

Run expression in the target renderer's main JS world via CDP Runtime.evaluate and return the result by value. Equivalent to typing the expression in the renderer's DevTools console. Use this for DOM inspection (document.title), state reads (localStorage.getItem('theme')), and any automation beyond what the click/type convenience tools cover.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesSession id.
targetNoTarget id from `list_windows`. Default: first page.
expressionYesJavaScript expression to evaluate. Wrap statements in an IIFE: `(() => { ... })()`.
awaitPromiseNoAwait the promise result (default true).
returnByValueNoReturn the value by JSON-serialising it (default true).
Behavior4/5

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

Without annotations, the description carries the full burden. It reveals the CDP mechanism, equivalence to the DevTools console, the need for IIFE for statements, and the return-by-value behavior. It does not cover potential side effects or error scenarios, but provides adequate behavioral context for typical use.

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?

The description is extremely concise with two sentences. The first sentence defines the action and mechanism, the second provides usage examples and scope. No redundant information, and it is front-loaded with the core purpose.

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?

Given the tool's complexity and absence of an output schema, the description explains the return behavior (by value) and gives practical examples. It does not detail the result structure or error handling, but for an advanced tool, the provided context is sufficient for most use cases.

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?

With 100% schema coverage, the baseline is 3. The description adds value beyond the schema by providing example expressions (document.title, localStorage.getItem) and the IIFE note for statements, which enhances understanding of the expression parameter. This pushes the score to 4.

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?

The description clearly states the tool runs a JavaScript expression in the target renderer's main JS world via CDP Runtime.evaluate and returns the result by value. It provides specific examples (DOM inspection, state reads) and distinguishes it from sibling convenience tools like click/type, making the purpose unambiguous.

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

Usage Guidelines4/5

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

The description gives clear use cases (DOM inspection, state reads, automation beyond click/type). While it does not explicitly list when not to use or name alternative sibling tools, the context and examples effectively guide the agent on appropriate usage.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/iamvinitk/electron-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server