history_stats
returns retained window metadata (historysize, earliestcommand, latestcommand, maxhistoryentries).
How to use it
history_stats is exposed by the MCP Stata MCP server. Add the server to your MCP client (Claude Desktop, Cursor, Windsurf and others), and the history_stats tool becomes available to the model automatically. See the full listing for setup details and every tool this server provides.
Install MCP Stata
$
uvx --refresh --refresh-package mcp-stata --from mcp-stata@latest mcp-stataOther tools in MCP Stata (4)
action
describe, codebook, summary, search, list, get, or lint.
detect
Returns metadata about the Stata installation (version, flavor, OS) and optionally SSC packages.
history_diff
returns tracked changes in variables/macros and dataset dimensions.
lint
performs static analysis of .do and .ado files for modern best practices.