Execute RPN Code
msfs_execute_calculator_codeRun RPN calculator code in MSFS to read SimVars, manipulate L-vars, and trigger events. Specify read/execute mode to avoid misclassification of compound expressions.
Instructions
Execute RPN calculator code in the simulator.
Runs arbitrary RPN (Reverse Polish Notation) calculator code via the MobiFlight WASM bridge. Can read or write any variable type and perform complex operations. Requires the MobiFlight WASM extension.
The 'auto' mode's heuristic -- code starts with '(', ends with ')', and contains no '(>' -- misclassifies compound read expressions such as '(L:A) (L:B) max' as an execute, because they don't end in ')'. Pass mode='read' explicitly for those.
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": "msfs_execute_calculator_code"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | RPN calculator code, e.g. '(A:PLANE ALTITUDE, feet)' to read a SimVar, '(L:MyCustomVar) 1 + (>L:MyCustomVar)' to increment an L-var, or '1 (>K:PARKING_BRAKES)' to trigger an event. | |
| mode | No | 'read' returns a value, 'execute' runs the code for effect. 'auto' guesses from the syntax, which is unreliable for compound expressions. | auto |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |