Skip to main content
Glama

Elastic Net

elastic_net

Train a regularized regression model that blends L1 and L2 penalties on a numeric, complete train-test split, then return evaluation metrics and top features.

Instructions

Train an Elastic Net regression, a mix of L1 (Lasso) and L2 (Ridge) regularisation. The split must have only numerical, complete features. Args: split_id (str): ID of a split made by train_test_split. alpha (float): Overall regularisation strength, greater than 0. Default is 1.0. l1_ratio (float): Mix between 0 (pure Ridge) and 1 (pure Lasso). Default is 0.5. fit_intercept (bool): Learn an intercept. Default is True. max_iter (int): Maximum solver iterations. Default is 10000. scale (bool): Standardise the features first. Strongly recommended. Default is True. Returns: dict: model_id, train/test metrics (R2, MAE, MSE, RMSE, MAPE), top features and warnings.

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": "elastic_net"
  }
}

Input Schema

NameRequiredDescriptionDefault
alphaNo
scaleNo
l1_ratioNo
max_iterNo
split_idYes
fit_interceptNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4/5.0
Behavior4/5

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

No annotations are supplied, so the description carries the full behavioral burden, and it does substantial work: it discloses the input-data requirement, that features are standardized when scale=True ("Strongly recommended"), the bounds on alpha and l1_ratio, and the exact contents of the returned dict including warnings. It does not state error behavior for invalid splits or whether the fitted model persists under model_id, which keeps it from 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.

Conciseness4/5

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

Front-loaded with a one-line statement of what the tool does, followed by a precondition and an Args/Returns block that is easy to scan. Some space is spent restating types and defaults already present in the schema, but given 0% schema coverage that repetition is the compensation rather than waste.

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?

For a six-parameter training tool with no annotations and no output schema, the definition covers the essentials: data requirements, every parameter's meaning, and the shape of the return value including metrics and warnings. It is only slightly incomplete on failure modes and the meaning of model_id.

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 entirely, and it does: all six parameters are explained with type, default, and meaning, including the semantics of the 0-to-1 l1_ratio continuum and the constraint that alpha be greater than 0. This adds real interpretation beyond the bare JSON schema types and defaults.

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?

States a specific verb and resource: "Train an Elastic Net regression, a mix of L1 (Lasso) and L2 (Ridge) regularisation." The algorithm is named and briefly characterized, so an agent can tell it apart from sibling model trainers such as decision_tree_regressor or benchmark_models without opening a schema. It stops short of explicit sibling differentiation, so it is not a 5.

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

Usage Guidelines3/5

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

Provides a hard prerequisite: the split "must have only numerical, complete features," which tells the agent when this tool is not applicable. However, there is no guidance on when to choose Elastic Net over Ridge/Lasso or model-selection tools like compare_models or benchmark_models, and no note on the practical effect of l1_ratio choice.

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