Set variable
set_variableCreate or update a variable by name on any sprite or the Stage in Scratch .sb3 projects.
Instructions
Create or update a variable on a target by name.
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": {
"target": "<target>",
"name": "<name>",
"value": "<value>"
},
"name": "set_variable"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| value | Yes | ||
| target | Yes | Sprite name, or "Stage". |