Run Script
photopea_run_scriptExecute custom JavaScript in Photopea to automate advanced image editing tasks beyond standard tools. Access full Photopea DOM for direct manipulation of documents, layers, and more.
Instructions
Execute arbitrary Photopea/ExtendScript JavaScript in the Photopea environment. Use this for advanced operations not covered by other tools. Has full access to the Photopea DOM (app, activeDocument, layers). Use with caution — scripts can modify or delete any document data.
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": {
"script": "<script>"
},
"name": "photopea_run_script"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| script | Yes | Photopea JavaScript code to execute. Must call app.echoToOE(result) to return data. Has access to the full Photopea scripting API (app, activeDocument, etc.). |