get_routine
Retrieve PLC routine logic from an L5X file by program and routine name, returning ladder rungs as compact NeutralText with comments or raw Structured Text.
Instructions
Get routine logic — NeutralText for ladder, raw code for Structured Text.
Ladder rungs are returned as compact NeutralText with rung comments, not raw XML. A single rung like 'XIC Motor_Start XIO Motor_Fault OTE Motor_Run' replaces hundreds of lines of verbose XML.
Args: l5x_path: Path to a .l5x file. program: Program name containing the routine. routine_name: Routine 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": {
"l5x_path": "<l5x_path>",
"program": "<program>",
"routine_name": "<routine_name>"
},
"name": "get_routine"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| program | Yes | ||
| l5x_path | Yes | ||
| routine_name | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |