mock_electron_api
Mock Electron main-process APIs like dialog, shell, and app with custom return values or JS implementations to test app behavior under controlled conditions.
Instructions
Mock an Electron main-process API (e.g. dialog.showOpenDialog, shell.openExternal, app.getPath) with a custom return value or implementation. Requires inspectMain.
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": {
"module": "<module>",
"method": "<method>"
},
"name": "mock_electron_api"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| method | Yes | Method name to mock (e.g. 'showOpenDialog', 'openExternal', 'showMessageBox') | |
| module | Yes | Electron module name (e.g. 'dialog', 'shell', 'app', 'clipboard', 'autoUpdater') | |
| returns | No | Value or Promise result to return when invoked | |
| targetId | No | ||
| processId | No | Process ID. If omitted, uses the single running app. | |
| implementation | No | Optional JS function body to execute as mock |