Skip to main content
Glama

eval_main

Execute JavaScript code in the Electron main process to access system resources, invoke IPC handlers, and control application windows beyond renderer limitations.

Instructions

Evaluate JavaScript in the Electron main process. Pass a FUNCTION BODY — use return to yield a value. The body receives electron (the full Electron module) and arg (your JSON-serializable payload). Supports async/await. Use this to invoke IPC handlers, read paths, or drive windows the renderer cannot reach.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
jsYesFunction body. Use `return` to yield a value. `electron` and `arg` are available as locals.
argNoArbitrary JSON-serializable value exposed as `arg` inside the body. Objects, arrays, primitives, and null all work.
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key behaviors: the tool executes JavaScript in the main process, supports async/await, exposes 'electron' and 'arg' as locals, and requires a function body with a return statement. However, it lacks details on error handling, security implications, or performance impacts.

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 appropriately sized and front-loaded, with every sentence earning its place. It starts with the core purpose, details usage, and ends with practical examples, avoiding redundancy. The structure is efficient and easy to parse.

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

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of executing JavaScript in the main process, no annotations, and no output schema, the description is somewhat complete but has gaps. It covers purpose, usage, and parameters well, but lacks information on return values, error handling, or security considerations, which are critical for such a powerful tool.

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 description coverage is 100%, so the baseline is 3. The description adds meaningful context beyond the schema: it clarifies that 'js' is a 'FUNCTION BODY' (not just any string), emphasizes using 'return' to yield a value, and explains how 'electron' and 'arg' are used as locals. This enhances understanding but doesn't fully compensate for the lack of output schema details.

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's purpose with specific verbs ('Evaluate JavaScript in the Electron main process') and distinguishes it from sibling tools like 'eval_renderer' by specifying the execution context. It identifies the resource (Electron main process) and the action (evaluating JavaScript).

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?

The description provides explicit guidance on when to use this tool versus alternatives: 'Use this to invoke IPC handlers, read paths, or drive windows the renderer cannot reach.' It distinguishes from 'eval_renderer' by targeting the main process for tasks inaccessible to the renderer, offering clear context and exclusions.

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/mesomya/electron-driver'

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