evaluate_expression
Execute arbitrary GDScript expressions at runtime and receive the result, enabling real-time debugging and state inspection.
Instructions
Execute an arbitrary GDScript expression at runtime and return the result. The expression runs in the context of the current scene (e.g., "get_tree().current_scene.name", "Vector2(1,2).length()"). Useful for debugging, querying state, and one-off calculations. The project must be running via run_interactive.
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": {
"expression": "<expression>"
},
"name": "evaluate_expression"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| expression | Yes | The GDScript expression to evaluate (e.g., "get_tree().current_scene.name", "$Player.position", "2 + 2"). |