extract_function
Extract a block of MQL4/MQL5 source lines into a new helper function, detecting parameters and call site. Use dry-run to preview changes before applying.
Instructions
Extract a contiguous block of lines into a new helper function.
Brace-counting + regex param detection — not a full AST parser. Returns the
proposed helper, call site, and parameter list. Set dry_run=False to write.
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": {
"source": "<source>",
"line_start": "<line_start>",
"line_end": "<line_end>",
"new_name": "<new_name>"
},
"name": "extract_function"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| source | Yes | Absolute Windows path to the .mq4/.mq5/.mqh source file. | |
| dry_run | No | true = preview the change and write nothing; false = apply it to the files. | |
| line_end | Yes | Last line (1-based, inclusive) of the block to extract. | |
| new_name | Yes | Name of the new helper function. | |
| line_start | Yes | First line (1-based, inclusive) of the block to extract. | |
| return_type | No | Return type of the helper, e.g. void or double. | void |
| target_file | No | Optional .mqh path to append the helper to; defaults to inserting above the enclosing function. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||