Skip to main content
Glama
aj47
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
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