Run a script in Foundry
run_scriptExecutes JavaScript in the logged-in Foundry VTT client as an async function body and returns the JSON result, providing a fallback when other tools cannot complete the task.
Instructions
Runs JavaScript as the body of an async function in the logged-in Foundry client (game, canvas, ui, CONFIG are available) and returns what it returns, as JSON. A last resort for things the other tools can't do.
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": {
"code": "<code>"
},
"name": "run_script"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes |