write_st_logic
Write or replace IEC 61131-3 Structured Text logic for a program section. Optionally declare variables, then run build_project to fix errors.
Instructions
Write a program section in plain IEC 61131-3 Structured Text — no XML required. Creates the section or replaces its logic if it exists.
st_source is raw ST (IF/CASE/FOR, FB calls like 'T1(IN := x, PT := t#3s, Q => y);', set()/reset() on EBOOLs, re()/fe() edges). declare optionally declares variables as a comma-separated 'name:TYPE' list, e.g. 'StartPB:BOOL, Delay1:TON, Level:REAL' — FB instances called in the code (TON/TOF/CTU/DFB types) must exist or be declared here. Run build_project afterwards and fix any errors from its output.
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": {
"task": "<task>",
"section": "<section>",
"st_source": "<st_source>"
},
"name": "write_st_logic"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task | Yes | ||
| section | Yes | ||
| st_source | Yes | ||
| declare | No |