Skip to main content
Glama
stata-copilot

stata-copilot

by Parado-D

Lint Stata code before running it

stata_lint

Checks Stata code for silent logic errors that run without error but produce wrong results, flagging first-observation if, unsorted _n, and undeclared locals; errors block, warnings do not.

Instructions

Check Stata code for constructs that run without an error yet do the wrong thing: the if command (first observation only), _n without a sort, gen on an existing variable, undeclared locals, missing(a b c) as a varlist, variable abbreviation left on. Pass code or file. Errors block, warnings do not: the caller decides.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "stata_lint"
  }
}

Input Schema

NameRequiredDescriptionDefault
cwdNoWorking directory used to resolve `do "other.do"` references.
codeNoStata code to review.
fileNoPath to a .do file to review instead of `code`.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.5.1

TDQS

A4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the burden and does so reasonably: it discloses diagnostic severity semantics (errors block, warnings are advisory and the caller chooses) and implies a non-executing, non-mutating review. It stops short of stating explicitly that the code is never executed or files never modified.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose is front-loaded in the first clause, then the check list, then invocation and severity notes. The construct list is dense but each item names a real, distinct failure mode, so little is wasted.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

There is no output schema, yet the description never characterizes the return value (e.g., per-issue messages, line numbers, severity tags) beyond 'errors block, warnings do not.' For a linter whose whole value is its diagnostics, that is a notable remaining gap.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so parameter documentation is already handled. The description adds only the either/or relationship between `code` and `file` and says nothing about `cwd` or how do-file references are resolved, leaving the baseline 3 appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb ('Check') and resource ('Stata code') plus a precise failure mode ('run without an error yet do the wrong thing'), then enumerates concrete constructs it flags. An agent can distinguish this from stata_run or stata_signature purely from the description.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

'Pass `code` or `file`' tells the agent how to invoke it, and 'Errors block, warnings do not: the caller decides' clarifies control flow. It does not explicitly say to use this before stata_run or name any alternative, so guidance is clear but not exhaustive.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.