Skip to main content
Glama

from_r

Read-only

Translate one R expression (feols, felm, lm, att_gt, did) into a validated StatsPAI tool-call payload, mirroring the from_stata output shape for direct execution.

Instructions

Translate a single R / fixest / felm / did expression to a verified StatsPAI tool-call payload. Returns the same shape as from_stata. Supported callables: feols / felm / lm / att_gt / did. Pass ONE expression -- no assignment, no piping. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact).

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "expression": "<expression>"
    },
    "name": "from_r"
  }
}

Input Schema

NameRequiredDescriptionDefault
detailNoPayload depth; agent is the fullest.agent
data_idNoData handle (d_...) from load_data; replaces data_path.
data_csvNoSmall inline table as CSV text.
as_handleNoCache the fit and return its result_id.
data_pathNoAbsolute path of a data file on the server.
result_idNoHandle of an earlier fit made with as_handle=true.
expressionYesOne R expression, e.g. 'feols(y ~ x | id^year, data=df, cluster="id")'.
data_recordsNoSmall inline table as row objects.
max_output_bytesNoResult byte budget (default 262144; 0 = none).

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.1/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true and openWorldHint=false, so the description is not required to establish safety. It adds the notion that output is 'verified' against an evidence tier (known-truth, reference, external-parity, Monte Carlo artifact) and that the response mirrors from_stata's shape, but it never explains what the tiers mean operationally or what happens on an unsupported/failed expression.

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?

Front-loaded with the core action, followed by scope, input constraint, and validation note — no filler sentences. The final 'Validation: validated evidence tier (...)' clause is compressed jargon that is harder to parse than the rest, keeping it from a 5.

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

Completeness4/5

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

With an output schema present, return values need no explanation, and 9 parameters at 100% schema coverage leave little to describe. The remaining gap is that the description says nothing about how data inputs (data_id, data_path, data_csv, data_records) are chosen or how result_id/as_handle caching interacts with a fresh expression, though the schema covers each individually.

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

Parameters4/5

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

Schema coverage is 100%, so the schema already documents all nine parameters and baseline would be 3. The description earns above baseline by constraining the expression parameter's form (single expression, no assignment, no piping) and cross-referencing the sibling from_stata for output shape.

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 and resource: translate one R / fixest / felm / did expression into a verified StatsPAI tool-call payload. It also enumerates the supported callables (feols / felm / lm / att_gt / did) so an agent knows immediately whether its expression is in scope, and references from_stata as the parallel path.

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?

Gives concrete input constraints ('Pass ONE expression -- no assignment, no piping') and bounds the surface with a supported-callable list, which effectively tells the agent when this tool applies versus hand-building a payload. It stops short of naming an explicit alternative or exclusion rule (e.g., use from_stata for Stata code).

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