Skip to main content
Glama

help

Retrieve documentation and usage information for any Stata command. Understand syntax, options, and troubleshoot errors before running your analysis.

Instructions

Retrieve documentation and usage information for a Stata command. Use when you need to understand a command's syntax, options, or troubleshoot errors before running it.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cmdYes
replaceNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • StataHelp class initializes with stata_cli, cache_dir, project_tmp_dir, and config. It creates a StataController for running Stata commands.
    class StataHelp:
        def __init__(
                self,
                stata_cli: str,
                project_tmp_dir: Path | None = None,
                cache_dir: Path | None = None,
                config: "Config | None" = None,
        ):
            self._config = config
            self.help_cache_dir = cache_dir or (
                config.HELP_CACHE_DIR if config else Path.home() / ".statamcp" / "help"
            )
            self.help_cache_dir.mkdir(parents=True, exist_ok=True)
  • StataHelp.help() method implements the core logic: checks saved/cached results first, then runs `help {cmd}` in Stata via StataController, and caches/saves the result.
    def help(self, cmd: str, replace: bool = False) -> str:
        if not replace:
            saved_help_result = self.load_from_project(cmd)
            cached_help_result = self.load_from_cache(cmd)
            if saved_help_result and self.IS_SAVE:
                return f"Saved result for {cmd}\n" + saved_help_result
            if cached_help_result and self.IS_CACHE:
                return f"Cached result for {cmd}\n" + cached_help_result
    
        # If no cached help found, get from Stata
        try:
            help_result = self.load_from_stata(cmd)
        except Exception as e:
            return str(e)
    
        self._cache_and_save(cmd, content=help_result, force=replace)
        return help_result
Behavior3/5

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

No annotations are provided, so the description must cover behavioral aspects. It states the tool 'retrieves documentation,' which implies a read-only operation, but it does not disclose the format of the output (e.g., text, pager) or any potential side effects. The description is adequate but minimal.

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

Conciseness5/5

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

The description is two sentences long, front-loads the purpose, and contains no redundant information. Every word earns its place.

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?

The tool is simple with an output schema, but the description lacks parameter documentation, which is essential for correct usage. It does not mention whether the command requires internet or works offline. It is minimally complete for a help tool but leaves gaps.

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

Parameters1/5

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

Schema coverage is 0%, meaning the description adds no explanation for the two parameters ('cmd' and 'replace'). The agent receives no guidance on what 'cmd' expects (e.g., a string of the command name) or the effect of 'replace' (e.g., overwriting existing help file). This is a critical gap.

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?

The description clearly states the action ('Retrieve') and the resource ('documentation and usage information for a Stata command'). This distinguishes it well from siblings like 'stata_do' (execute code) and 'get_data_info' (data information).

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?

The description provides explicit context for when to use the tool: 'Use when you need to understand a command's syntax, options, or troubleshoot errors before running it.' It does not specify when not to use it or mention alternatives, but the positive guidance is strong and clear.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/SepineTam/mcp-for-stata'

If you have feedback or need assistance with the MCP directory API, please join our Discord server