flipper_run_js
Run JavaScript on a Flipper Zero device and retrieve output. Supports inline code, local files, or existing scripts on the device.
Instructions
Run JavaScript on the device and return its output. Give inline source, a host local_path, or an existing device_path. Scripts use the mJS engine (firmware 1.0+) and reach modules for GPIO, UART, notifications, BadUSB, GUI and storage -- plus subghz, blebeacon, i2c, spi and usbdisk on Momentum. Use print() for output; it is sent to the CLI when run this way. Call flipper_js_probe to see which modules exist.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "flipper_run_js"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| keep | No | Leave the script on the device | |
| name | No | Name to store inline source under | |
| port | No | Serial port (e.g. COM7, /dev/ttyACM0). Omit when one Flipper is attached. | |
| source | No | Inline JavaScript | |
| timeout | No | ||
| local_path | No | Host path to a .js file | |
| device_path | No | Script already on the device |