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.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"js": "<js>"
},
"name": "eval_main"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| js | Yes | Function body. Use `return` to yield a value. `electron` and `arg` are available as locals. | |
| arg | No | Arbitrary JSON-serializable value exposed as `arg` inside the body. Objects, arrays, primitives, and null all work. |