SepineTam/mcp-for-stata / plugins/stata-toolbox/skills/stata-skill
stata-skill
FlaggedA packaged Stata Runner skill via official MCP-for-Stata server including stata_do, ado_package_install, help, read_log and get_data_info tools. Use it when (1) need to execute Stata do-file; (2) missing ado-packages; (3) find code error caused by syntax in Stata; (4) want to read smcl and text format log file with rich text output; (5) first encounter a data file and want to understand its structure and content.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 10.6 KB |
| examples/esttab-senior-guidance.md | markdown | 3.6 KB |
| examples/graph-export-guidance.md | markdown | 1.9 KB |
| references/ado_package_install.md | markdown | 4.2 KB |
| references/get_data_info.md | markdown | 4.0 KB |
| references/help.md | markdown | 2.4 KB |
| references/installation.md | markdown | 2.5 KB |
| references/read_log.md | markdown | 2.4 KB |
| references/stata_do.md | markdown | 2.6 KB |
references/read_log.md
View on GitHub# `read_log`
Read a Stata log file (`.log` or `.smcl`) and return its content.
## Parameters
| Parameter | Type | Required | Default | Description |
|:---|:---|:---|:---|:---|
| `file_path` | `str` | Yes | — | Full path to the log file |
| `encoding` | `str` | No | `"utf-8"` | File encoding |
| `output_format` | `"full" \| "core" \| "dict"` | No | `"core"` | Output format when structured parsing is enabled |
| `lines` | `int` | No | `0` | Content trimming: `0`=all, `>0`=first N, `<0`=last \|N\| |
## Returns
String content. Structured parsing is controlled by `[BETA] enable_structured_log`
in `~/.statamcp/config.toml` and is disabled by default.
### `enable_structured_log=false` (default)
Returns raw log text content.
### `enable_structured_log=true`, `output_format="full"`
Returns all original content with SMCL markup parsed.
### `enable_structured_log=true`, `output_format="core"`
Removes framework lines (log open/close headers, footers, log commands).
### `enable_structured_log=true`, `output_format="dict"` (recommended)
Returns structured command-result pairs:
```json
{
"commands": [
{
"cmd": "regress y x1 x2",
"output": "...regression output...",
"timestamp": "..."
}
]
}
```
## When to Use
- Reading execution logs after `stata_do`
- Analyzing structured output from Stata commands
- Inspecting `.smcl` files with structured parsing
## Security Boundary
The log file **must** be within `<WORKING_DIR>/<FOLDER_TAG>/`. Files outside this directory are rejected.
## Structured Parsing
Enable the `StataLog` parser in the Stata-MCP configuration:
```toml
[BETA]
enable_structured_log = true
```
This converts supported logs into structured formats on every supported platform.
If parsing looks incorrect, disable the switch to fall back to raw text.
## `lines` Parameter
| Value | Behavior |
|:---|:---|
| `0` | Return all content |
| `> 0` | Return first N items (lines for raw mode, entries for dict mode) |
| `< 0` | Return last \|N\| items |
Use negative `lines` to quickly inspect the end of a long log (e.g., final regression results).
## Example
```python
# Read full raw log
read_log(file_path="/path/to/project/stata-mcp-log/output.log")
# Read last 50 lines of a log
read_log(file_path="/path/to/project/stata-mcp-log/output.log", lines=-50)
# Structured parsing of SMCL log (requires enable_structured_log=true)
read_log(
file_path="/path/to/project/stata-mcp-log/output.smcl",
output_format="dict"
)
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |