Skip to content

SepineTam/mcp-for-stata / plugins/stata-toolbox/skills/stata-skill

stata-skill

Flagged

A 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.

references/get_data_info.md

View on GitHub
# `get_data_info`

Get descriptive statistics and a data preview for a supported data file.

## Parameters

| Parameter | Type | Required | Default | Description |
|:---|:---|:---|:---|:---|
| `data_path` | `str` | Yes | — | Absolute path to the data file |
| `vars_list` | `List[str] \| None` | No | `None` | Subset of variables to analyze (default: all) |
| `encoding` | `str` | No | `"utf-8"` | File encoding (ignored for `.dta`) |
| `head` | `int` | No | `0` | Number of preview rows (`0` = disabled) |

## Supported Formats

| Extension | Format | Handler |
|:---|:---|:---|
| `.dta` | Stata | `DtaDataInfo` |
| `.csv`, `.tsv`, `.psv` | CSV/Text | `CsvDataInfo` |
| `.xlsx`, `.xls` | Excel | `ExcelDataInfo` |
| `.sav`, `.zsav` | SPSS | `SpssDataInfo` |

## Returns

JSON string containing:

```json
{
  "overview": {
    "source": "data.dta",
    "obs": 1000,
    "var_numbers": 15,
    "var_list": ["id", "year", "income", ...]
  },
  "info_config": {
    "metrics": ["obs", "mean", "stderr", "min", "max"],
    "max_display": 10,
    "decimal_places": 3
  },
  "vars_detail": {
    "income": {
      "type": "float",
      "var": "income",
      "summary": {
        "obs": 998,
        "mean": 45000.123,
        "stderr": 1200.456,
        "min": 10000.0,
        "max": 120000.0
      }
    },
    "gender": {
      "type": "str",
      "var": "gender",
      "summary": {"obs": 1000, "value_list": ["Female", "Male"]}
    },
    "eligible": {
      "type": "bool",
      "var": "eligible",
      "summary": {"obs": 1000, "mean": 0.6, "stderr": 0.016, "min": 0.0, "max": 1.0}
    }
  },
  "saved_path": "/path/to/cache/file.json"
}
```

Types are `"str"`, `"float"`, and `"bool"`. Boolean statistics exclude missing
values and temporarily use `True=1` / `False=0`, so `mean` is the proportion of
non-missing observations that are True. Other metrics follow numeric 0/1 rules;
interpolated quartiles may be fractional, and undefined statistics are `null`.
Source files and previews retain Boolean values (`true` / `false` in JSON).
Do not treat missing values as False or relabel numeric 0/1 columns as Boolean.
Consumers must accept `"bool"` in addition to the existing types.

## When to Use

- First encounter with a data file before writing any analysis code
- Understanding variable types, distributions, and missing values
- Checking data quality before regression

## Caching

Results are cached using content-addressable storage (MD5 hash of file content). Repeated queries on the same file return instantly from cache. The cache file path is returned in `saved_path`.

Cache files use schema version 2, retain the result structure shown above, and add only top-level `$schema` and `schema_version` fields. The version contributes to cache identity, so old version 1 files are left untouched and summaries are recomputed once. Missing or unsupported schema versions are ignored and regenerated. These cache-only fields are removed before the tool returns a cached result, and validation is performed locally without fetching the schema URL.

## Configurable Metrics

The following metrics can be configured via `~/.statamcp/config.toml` under `[data_info]`:

- `obs`: number of observations
- `mean`: arithmetic mean
- `stderr`: standard error
- `min` / `max`: minimum and maximum
- `q1` / `q3`: first and third quartile
- `skewness`: skewness
- `kurtosis`: kurtosis

Default metrics: `obs`, `mean`, `stderr`, `min`, `max`.

## Environment Variables

| Variable | Default | Description |
|:---|:---|:---|
| `STATA_MCP_DATA_INFO_DECIMAL_PLACES` | `3` | Decimal places for numeric output |
| `STATA_MCP_DATA_INFO_STRING_KEEP_NUMBER` | `10` | Max string values to display |
| `STATA_MCP_DATA_INFO_HASH_LENGTH` | `12` | Hash length for cache filename |

## Example

```python
# Analyze all variables in a Stata file
get_data_info(data_path="/path/to/project/data.dta")

# Analyze a specific subset with 5 preview rows
get_data_info(
    data_path="/path/to/project/data.csv",
    vars_list=["income", "education", "age"],
    head=5
)
```
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: 472kUpdated Claude CodeCodexVerifiedInstall
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: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
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 availableStars: 322kUpdated Claude CodeCodexVerifiedInstall