olcabasic_run
Run olcaBASIC programs against openLCA in a stateful session to build models, calculate product systems, query results, and batch-process work, with dry-run validation before execution.
Instructions
Run olcaBASIC code against openLCA, in a session that keeps its state between calls.
One statement per line; names in "double quotes"; blocks end with END .
Explore with FIND, SHOW and CAT; build with BRIDGE, MAKE PROCESS and SYSTEM; analyse with CALCULATE "system" USING "method", then RESULT ... on the result it leaves open, CONTRIBUTION, SENSITIVITY. PARAMETER name = value makes an openLCA parameter (global at the top level, the process's own inside MAKE PROCESS or BRIDGE, the scenario's value inside SCENARIO); LET is a program variable and never writes to openLCA.
The language refuses anything that would build or calculate a wrong model: a background process used without a bridge, an ambiguous or partial name, a changed block run again, a product system that is out of date or failed VALIDATE, a programme rule broken in an EPD. There is no override. Each error gives the line and a hint that says what to type: do that.
A program stops at its first error. dry_run=true checks a program without touching openLCA. Use a FOR loop in one program for batch work.
The reply is JSON: ok, text, data (the structured result of each command, RESULT queries included), errors, warnings. DELETE needs CONFIRM DELETE ON. Commands that ask a person (PARAMETERISE ... ALL, changing a method olcaBASIC did not make, SHUTDOWN SERVER) only run in the olcaBASIC terminal; INPUT runs here only with a DEFAULT, which it takes. Call olcabasic_help first for the command list; olcabasic_help with a topic or a command name gives syntax and examples.
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": "olcabasic_run"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | olcaBASIC program text, one statement per line | |
| dry_run | No | Parse and check the program without touching openLCA |