Skip to main content
Glama
aj47

Electron Native MCP Server

by aj47

electron_execute

Execute JavaScript in Electron app renderer processes to automate UI interactions, manipulate DOM elements, and retrieve data through Chrome DevTools Protocol integration.

Instructions

Execute JavaScript in an Electron app's renderer process via CDP.

Returns the last expression's value. Use state object to persist data between calls.

Key patterns:

  • Click: document.querySelector('#btn').click(); 'done'

  • Fill input: el.value='text'; el.dispatchEvent(new Event('input',{bubbles:true}))

  • Read DOM: Array.from(document.querySelectorAll('a')).map(a=>({text:a.textContent,href:a.href}))

Best practices:

  • Use multiple calls: find element → interact → verify result

  • Always return a value to confirm what happened

  • Check page state after actions (don't assume)

Error "No Electron targets found" = app needs --inspect flag or CDP_PORT env var mismatch.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesJavaScript code to execute in the Electron renderer process
Behavior4/5

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

With no annotations provided, the description carries full burden and does an excellent job explaining key behaviors: it returns the last expression's value, allows state persistence between calls, provides error handling guidance for 'No Electron targets found', and includes best practices for reliable execution. The only minor gap is not explicitly stating whether this is a read-only or mutating operation.

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 perfectly structured and front-loaded with the core purpose, followed by key patterns and best practices sections. Every sentence earns its place by providing essential information without redundancy. The bullet-point format makes it highly scannable and efficient.

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 complexity of executing JavaScript in Electron via CDP with no annotations and no output schema, the description provides excellent context about return values, state persistence, error handling, and best practices. The only minor gap is not explicitly documenting the exact format of return values, though it mentions 'Returns the last expression's value' which provides reasonable guidance.

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?

The schema description coverage is 100%, so the baseline is 3. The description doesn't add significant parameter semantics beyond what the schema already provides ('JavaScript code to execute in the Electron renderer process'), though it does provide context about the execution environment and examples that indirectly relate to the 'code' parameter.

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 specific action ('Execute JavaScript in an Electron app's renderer process via CDP') and distinguishes it from the sibling tool 'electron_reset' by focusing on code execution rather than resetting state. It uses precise technical terminology that defines the exact operation.

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 provides clear context about when to use this tool (for JavaScript execution in Electron renderer processes) and includes best practices like using multiple calls and returning values. However, it doesn't explicitly state when NOT to use it or directly compare it to the sibling 'electron_reset' tool, which would be needed for a perfect score.

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/aj47/electron-native-mcp'

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