Skip to main content
Glama

Linear Regression

linear_regression

Train an ordinary least squares regression model on a prepared numerical split, then evaluate train/test metrics and return model details for prediction and comparison.

Instructions

Train an ordinary least squares linear regression on a split and evaluate it on train and test. The split must have only numerical, complete features (run encode_categorical / impute_missing first). Args: split_id (str): ID of a split made by train_test_split. fit_intercept (bool): Learn an intercept. Default is True. positive (bool): Force all coefficients to be non-negative. Default is False. scale (bool): Standardise the features first (same predictions, but coefficients become comparable between features). Default is True. Returns: dict: model_id (use it in plots and other model tools), train/test metrics (R2, MAE, MSE, RMSE, MAPE), top features and warnings such as possible overfitting.

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": {
      "split_id": "<split_id>"
    },
    "name": "linear_regression"
  }
}

Input Schema

NameRequiredDescriptionDefault
scaleNo
positiveNo
split_idYes
fit_interceptNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.4/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does well: it discloses that both train and test are evaluated, that warnings such as possible overfitting are emitted, and that scale changes coefficient comparability while leaving predictions unchanged. It does not mention cost, determinism, or failure modes for ill-conditioned data, which keeps it below a 5.

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?

Purpose, prerequisites, Args, and Returns are front-loaded in a compact structure with no filler sentences. Every line, including the default values, is actionable.

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

Completeness5/5

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

There is no output schema, and the description compensates by enumerating the return dict: model_id, train/test metrics (R2, MAE, MSE, RMSE, MAPE), top features, and warnings. Combined with prerequisites and full parameter coverage, an agent has everything needed to call it correctly.

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

Parameters5/5

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

Schema description coverage is 0%, so the description must compensate, and it documents all four parameters with types, defaults, and meaning. The scale explanation (same predictions, comparable coefficients) and positive (non-negative coefficients) add real semantic value an agent could not get from the raw schema.

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

Purpose4/5

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

"Train an ordinary least squares linear regression on a split and evaluate it on train and test" is a specific verb + resource + scope, and "ordinary least squares" implicitly separates it from the ridge_regression and lasso_regression siblings. It stops short of explicitly contrasting itself with those regularized alternatives, so an agent must infer the choice.

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 gives a concrete precondition: the split must contain only numerical, complete features, and names the sibling tools (encode_categorical, impute_missing) to run first. It also says where model_id is consumed (plots and other model tools). It lacks explicit guidance on when to prefer this over ridge/lasso, so no exclusions are stated.

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

Deploy Server

Other Tools