Run a .do file
stata_run_doExecute an existing Stata do-file on disk to run analyses, with optional background jobs and working directory defaults.
Instructions
Execute an existing do-file. The file must already exist on disk (agents should write the file, not push a giant string through stata_run). cwd defaults to the do-file's folder. Set background:true to run it as a separate Stata process and get a job id back instead of waiting.
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": {
"file": "<file>"
},
"name": "stata_run_do"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | Working directory override (default: the do-file folder). | |
| file | Yes | Absolute path to the .do file. | |
| mode | No | Tighten the policy for this call. | |
| label | No | Label for the background job. | |
| verify | No | Fingerprint the data before and after (datasignature) and report whether it changed. In-session runs only. | |
| timeout | No | Seconds before Stata is interrupted (1-600, default 300). Ignored in background mode, which takes up to 86400. | |
| background | No | Run as a background job; returns a job id instead of the transcript. |