Skip to main content
Glama

compare_models

Fit and compare candidate algorithms on a dataset with cross-validation, returning fold metrics and selecting a winner by your chosen metric.

Instructions

Fit and compare candidate algorithms on a dataset using cross-validation (CV). Returns fold metrics and selects a winner by the requested metric. Provide a split_manifest_id to reserve its test rows. Records experiments when possible. Use compare_experiments for saved metrics or automl_run for hyperparameter search.

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": {
      "name": "<name>",
      "target_column": "<target_column>",
      "task_type": "<task_type>"
    },
    "name": "compare_models"
  }
}

Input Schema

NameRequiredDescriptionDefault
cvNoCross-validation folds (default 5).
nameYesDataset filename.
metricNoSelection metric (default auto).
modelsNoModels to compare.
delimiterNoCSV delimiter (comma, semicolon, tab, pipe). Auto.
task_typeYes'classification' or 'regression'.
test_sizeNoTest fraction (default 0.2).
random_stateNoRandom seed (default 42).
target_columnYesTarget variable column.
exclude_columnsNoFeature columns to exclude before preprocessing/training.
split_manifest_idNoID of a validated split manifest to enforce indices.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • addedInput schema / properties / delimiter
      Added value: +{
      +  "description": "CSV delimiter (comma, semicolon, tab, pipe). Auto.",
      +  "type": "string"
      +}
    • addedInput schema / properties / exclude_columns
      Added value: +{
      +  "description": "Feature columns to exclude before preprocessing/training.",
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • addedInput schema / properties / split_manifest_id
      Added value: +{
      +  "description": "ID of a validated split manifest to enforce indices.",
      +  "type": "string"
      +}
  2. First observedv0.1.0

TDQS

A4.1/5.0
Behavior3/5

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

With no annotations, the description carries the full behavioral burden. It usefully discloses the return shape (fold metrics), the winner-selection behavior, the test-row reservation from split_manifest_id, and that experiments are recorded 'when possible'. However, 'when possible' is vague, and it omits whether fitted models are persisted/exportable, whether preprocessing mutates the dataset, failure behavior for invalid metric or model names, and rough compute cost for an 11-parameter multi-model CV run.

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?

Four tight sentences, front-loaded with the core action and return behavior, then the split-manifest caveat, then sibling routing. No restated field names and no filler; 'Records experiments when possible' is the only slightly soft phrase.

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?

For an 11-parameter, compute-heavy tool with no annotations and no output schema, the description covers purpose, primary return, and routing well. It leaves gaps an agent would want: whether the winning model becomes a loadable artifact (relevant given export_model/load_model_handle siblings), what happens when 'models' is omitted, and how the metric default ('auto') is chosen relative to task_type.

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 description coverage is 100%, so the baseline is 3, and the description adds real meaning on top: it explains that split_manifest_id's purpose is to reserve test rows and that metric drives winner selection rather than just being a label. This contextualizes the two parameters whose effects cross parameter boundaries (metric + winner, split_manifest_id + test_size interaction), though it does not clarify defaults for models or cv.

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 combination ('Fit and compare candidate algorithms on a dataset using cross-validation') plus the outcome ('Returns fold metrics and selects a winner by the requested metric'). This is clearly distinguishable from sibling tools like get_model_leaderboard and compare_experiments, so an agent can pick it without opening the schema.

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?

Explicitly routes the agent elsewhere: 'Use compare_experiments for saved metrics or automl_run for hyperparameter search', giving both an alternative and the condition that selects it. It also gives a positive usage signal via split_manifest_id to reserve test rows. It stops short of saying when not to use it (e.g., single-model training via train_baseline), which keeps it from a 5.

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