Skip to main content
Glama
gitmystuff

MCP Machine Learning Agent

by gitmystuff

MCP Machine Learning Agent

This project demonstrates how to deploy Machine Learning models as real MCP (Model Context Protocol) tools. You will train Logistic Regression and KNN models, evaluate them, select the best model, generate SHAP explanations, and log results to Parquet — all exposed through an MCP server.

This project accompanies the MCP and Agent Skills module.


What This Project Includes

The MCP server exposes the following tools:

Tool

What it does

train_models

Train Logistic Regression and KNN and export them to joblib

get_sample_input

Return a real test-set patient as a ready-to-use prediction input

predict_logistic_regression

Predict malignant or benign with the Logistic Regression model

predict_knn

Predict malignant or benign with the KNN model

confusion_matrix_metrics

Confusion matrix, accuracy, precision and recall for both models

select_best_model

Select the best model using a rule

shap_explain_selected

Global and local SHAP explanations for the selected model

export_parquet_audit

Export a copy of the Parquet audit log

Every tool call is logged to Parquet.

About the labels

The data is scikit-learn's Wisconsin breast cancer dataset (569 patients, 30 numeric features).

  • 0 = malignant

  • 1 = benign

Missing a cancer is the costly mistake, so malignant is the positive class: precision and recall are reported for malignant, and the default selection rule picks the model with the highest malignant recall. Confusion matrices are ordered [malignant, benign], with rows = actual and columns = predicted.

Artifacts generated:

  • artifacts/*.joblib (trained models)

  • artifacts/*.json (feature schema, training settings, selection, SHAP)

  • data_parquet/*.parquet (audit log)

The evaluation, selection and SHAP tools reuse the saved models when they were trained with the same settings, so every tool describes the exact models the predict tools use. If you pass different settings (for example knn_neighbors), the models are retrained and re-saved.


Requirements

You must install:

  • Python 3.10 or newer

  • uv package manager

  • VSCode (recommended)

Setup Instructions

Related MCP server: ML MCP Server

Step 1 — Clone the repository

In VSCode:

File → Open Folder → select the project folder

OR from terminal:

git clone <repository_url>
cd mcp_ml_agent

Step 2 — Open terminal in the project folder

In VSCode:

Right-click on:

pyproject.toml

Select:

Open in Integrated Terminal

Confirm you are in the correct folder:

Windows:

dir pyproject.toml

Mac/Linux:

ls pyproject.toml

Step 3 — Install dependencies

In terminal, run:

If (base) or any conda environment is showing in your command line path:

conda deactivate
uv sync

This will:

  • Create .venv

  • Install all dependencies

  • Prepare MCP environment

This may take a few minutes the first time.


Running the MCP Server

Start the MCP server:

uv run python mcp_ml_server.py

If successful, the server will start and wait for MCP tool requests.

No additional output is expected — this is normal.


Running the Client Demo (Optional)

To test the tools automatically:

uv run python mcp_client_demo.py

This will:

  • Train models

  • Run predictions on sample patients with both models

  • Show a prediction from an edited input, and the error returned for an invalid one

  • Evaluate models

  • Select best model

  • Generate SHAP explanations

  • Export Parquet audit log


Making Predictions

Both predict tools take an input_data object containing all 30 features, keyed by their exact names, as numbers. A missing, misspelled or non-numeric feature returns an error that lists the expected names.

Train the models first (train_models), then use either approach below.

Option 1 — Let the server give you a valid input

Call get_sample_input with a test-set row number:

{"index": 0}

It returns the patient's true diagnosis and an input_data dictionary you can pass straight to a predict tool:

{
  "status": "success",
  "index": 0,
  "true_label": 0,
  "true_class": "malignant",
  "input_data": {"mean radius": 19.55, "mean texture": 28.77, "...": "..."}
}

Option 2 — Use the example file

examples/prediction_examples.json contains two complete patients (one malignant, one benign). Copy one input_data block, change any values you like, and call a predict tool:

{
  "input_data": {
    "mean radius": 19.55,
    "mean texture": 28.77,
    "mean perimeter": 133.6,
    "...": "all 30 features"
  },
  "request_id": "my-first-prediction"
}

The response

{
  "status": "success",
  "tool": "predict_logistic_regression",
  "model_used": "logistic_regression",
  "result": {
    "prediction": 0,
    "predicted_class": "malignant",
    "confidence": 0.99999,
    "probabilities": {"malignant": 0.99999, "benign": 0.00001}
  }
}

Predictions from Python

import json
import ml_pipeline as ml

ml.train_and_export_all()

example = json.load(open("examples/prediction_examples.json"))["examples"][0]
model = ml.load_model("logistic_regression")
print(ml.predict_with_model(model, example["input_data"]))

Asking an AI agent

When the server is connected to an MCP host (such as Claude Desktop or VS Code), you can ask in plain language, for example:

Train the models, get test patient 2, and predict it with both models. Do they agree with the true diagnosis?


Generated Files

After running tools, you will see:

artifacts/
    logistic_regression.joblib
    knn.joblib
    feature_names.json
    training_config.json
    selection.json
    shap_*.json

data_parquet/
    tool_audit.parquet
    audit_export.parquet   (or the filename you choose)

You can open Parquet files in Python:

import pandas as pd

df = pd.read_parquet("data_parquet/tool_audit.parquet")
print(df)

Running Jupyter Notebook (Optional)

If using the notebook version:

uv run jupyter notebook

Open the notebook and run the cell.


Important: Do NOT manually activate .venv

Do NOT run:

.venv\Scripts\activate

Always use:

uv run python filename.py

uv automatically uses the correct environment.


Project Structure

mcp_ml_agent/
- pyproject.toml
- uv.lock
- mcp_ml_server.py      MCP server: exposes the tools
- mcp_client_demo.py    scripted client that calls every tool
- ml_pipeline.py        training, evaluation, selection, SHAP, prediction
- parquet_store.py      Parquet audit log
- examples/
    - prediction_examples.json

artifacts/        (created when you run the tools)
data_parquet/     (created when you run the tools)

The server works with both version 1.x and 2.x of the MCP Python SDK.

Available Tools

8 tools
confusion_matrix_metricsA

Compute the confusion matrix plus accuracy/precision/recall for both models on the test set. Precision and recall are for the malignant class. Confusion matrix order is [malignant, benign]; rows = actual, columns = predicted.

ParametersJSON Schema
NameRequiredDescriptionDefault
test_sizeNoFraction of the data held out for testing.
request_idNoYour own id for this call; recorded in the audit log.unknown
random_stateNoRandom seed for the train/test split.
knn_neighborsNoNumber of neighbors for the KNN model.

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.7/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, and it does disclose two genuinely important traits: that precision/recall refer to the malignant class, and that the matrix is ordered [malignant, benign] with rows=actual, columns=predicted. However, it never says whether calling it re-trains/re-splits the models (the knn_neighbors and test_size params suggest it might), whether it is deterministic, or what the safety profile of the operation is.

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?

Three tight sentences with the core action front-loaded, and each remaining sentence adds non-obvious output semantics rather than filler. Slightly dense but no wasted text.

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?

An output schema exists, so return shape needn't be explained, and the description complements it with class orientation and matrix layout. The main gap is the relationship to prior training state and how this differs operationally from the prediction tools.

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

Parameters3/5

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

Schema description coverage is 100%, so all four parameters (test_size, random_state, knn_neighbors, request_id) are already documented in the schema, and the description adds no per-parameter meaning. Baseline of 3 applies when the schema does the heavy lifting.

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 ('compute the confusion matrix plus accuracy/precision/recall') and scopes it precisely ('for both models on the test set'). This cleanly separates it from siblings like predict_logistic_regression, predict_knn, and select_best_model, which perform prediction or selection rather than evaluation.

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?

The phrase 'on the test set' and 'for both models' implies this is a post-training evaluation step, so usage is inferable but never stated. There is no explicit when-to-use, no ordering relative to train_models or select_best_model, and no statement of when not to use it.

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

export_parquet_auditB

Export a copy of the Parquet audit log for submission.

ParametersJSON Schema
NameRequiredDescriptionDefault
filenameNoPlain file name for the copy, written to data_parquet/.audit_export.parquet
request_idNoYour own id for this call; recorded in the audit log.unknown

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.2/5.0
Behavior2/5

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

No annotations are provided, so the description carries the full behavioral burden. It does not say whether an existing file at the target path is overwritten, whether permissions or prior setup are needed, what the side effects are (the schema alone notes the request_id is recorded in the audit log), or whether the source log is affected beyond the word 'copy'. That is a large gap for a tool with zero annotation coverage.

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?

A single front-loaded sentence with no filler; the verb and object come first. It is arguably too terse for the behavioral gaps it leaves, but there is no wasted text.

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?

An output schema exists, so return values need no explanation, and the schema covers both optional parameters with defaults. However, with no annotations and no mention of overwrite behavior, destination, or side effects, the description is only minimally sufficient for an agent to invoke it confidently.

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

Parameters3/5

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

Schema description coverage is 100%: the schema already documents 'filename' (written to data_parquet/) and 'request_id' (recorded in the audit log) including defaults. The description adds nothing about either parameter, so the baseline 3 applies.

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: 'Export a copy of the Parquet audit log', with the added purpose 'for submission'. It is unambiguous what the tool produces, though it offers no differentiation from siblings (none of which are audit/export tools, so that is a minor gap).

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?

The phrase 'for submission' implies the usage context (producing a deliverable artifact) but there is no explicit when-to-use, when-not-to-use, or named alternative. Usage is only implied, not stated.

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

get_sample_inputA

Return one test-set patient as a ready-to-use input_data dictionary for the predict tools, along with that patient's true diagnosis.

ParametersJSON Schema
NameRequiredDescriptionDefault
indexNoRow of the held-out test set to return.
test_sizeNoFraction of the data held out for testing.
request_idNoYour own id for this call; recorded in the audit log.unknown
random_stateNoRandom seed for the train/test split.

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.8/5.0
Behavior3/5

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

No annotations are provided, so the description carries the full behavioral burden. It does disclose the two things returned (an input_data dict and the true diagnosis), but says nothing about determinism of the split, bounds/error behavior for index, or the audit-logging behavior implied by request_id. Adequate but thin for an unannotated tool.

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?

A single front-loaded sentence with no filler; the key output ('ready-to-use input_data dictionary') leads and the secondary return ('true diagnosis') follows. Nothing is wasted.

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?

An output schema exists, so return-value explanation is not required, and the schema fully documents parameters. The description is complete enough for a simple fetch tool, with only a minor gap around how index/test_size/random_state jointly determine the returned row.

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

Parameters3/5

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

Schema description coverage is 100%, so all four parameters are already documented in the schema, setting the baseline at 3. The description adds no syntax, format, or interaction details beyond the schema, so it neither compensates nor detracts.

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 (return) and resource (one test-set patient as an input_data dictionary plus the true diagnosis), and names its audience explicitly ('for the predict tools'), which cleanly separates it from the predict_* siblings that consume that dictionary.

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?

The description implies usage by tying the output to 'the predict tools', so an agent can infer this is a setup/example-fetching step before prediction. However, it gives no explicit when-to-use statement, no guidance on choosing index/test_size/random_state consistently with the split, and no exclusions.

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

predict_knnA

Predict malignant (0) or benign (1) using the saved KNN model.

ParametersJSON Schema
NameRequiredDescriptionDefault
input_dataYesFeature dictionary with all 30 breast cancer features as numbers, keyed by their exact names (e.g. 'mean radius', 'worst area'). Use get_sample_input to get a valid example.
request_idNoYour own id for this call; recorded in the audit log.unknown

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.5/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 burden. It usefully discloses the class-label mapping (0=malignant, 1=benign), which is real behavioral value, but says nothing about the prerequisite trained-model state, failure behavior when no model is saved, or whether the call is a pure read.

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?

A single front-loaded sentence with zero waste. The action, model, and output interpretation are all in the first clause.

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?

An output schema exists so return values need no explanation, and the schema points to get_sample_input for valid feature examples. However, for a no-annotation inference tool the description omits the key precondition (a previously trained/saved KNN model) and any failure mode, leaving a real gap.

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

Parameters3/5

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

Schema description coverage is 100% and both parameters are fully documented in the schema (input_data keyed by exact feature names, request_id for the audit log). The description adds no further parameter meaning, so the baseline 3 applies.

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?

Specific verb (predict), specific resource (the saved KNN model), and even the output label semantics (0=malignant, 1=benign). The model name implicitly separates it from the predict_logistic_regression sibling, though the description never explicitly contrasts them.

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?

There is no explicit when-to-use/when-not statement or routing between the sibling predictors. The phrase 'the saved KNN model' only implies the prerequisite that train_models must have already run, leaving usage to inference.

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

predict_logistic_regressionB

Predict malignant (0) or benign (1) using the saved Logistic Regression model.

ParametersJSON Schema
NameRequiredDescriptionDefault
input_dataYesFeature dictionary with all 30 breast cancer features as numbers, keyed by their exact names (e.g. 'mean radius', 'worst area'). Use get_sample_input to get a valid example.
request_idNoYour own id for this call; recorded in the audit log.unknown

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.4/5.0
Behavior2/5

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

No annotations are provided, so the description carries the full behavioral burden, yet it discloses almost nothing beyond the purpose line. It does not state what happens if no saved model exists, whether the call is read-only or has side effects (an audit-logged call per the request_id param), or how failures surface. The word 'saved' is the only hint at a dependency.

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?

A single front-loaded sentence with no filler. The output label mapping (0/1) is packed in without wasted words.

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?

An output schema exists, so return-value explanation is unnecessary, and the input schema fully documents the nested feature dictionary. The only real omission is the untrained/unsaved-model prerequisite and any indication of error behavior, which the description leaves unaddressed.

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

Parameters3/5

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

Schema description coverage is 100%: input_data is documented as a 30-feature dictionary keyed by exact feature names and even points to get_sample_input, and request_id is documented as an audit-log id. The description adds no parameter detail, so the baseline 3 applies.

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 (predict), the exact output semantics (malignant=0 / benign=1), and the specific model artifact used (the saved Logistic Regression model). This distinguishes it cleanly from the sibling predict_knn without needing to open either schema.

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

Usage Guidelines2/5

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

No guidance on when to choose this over predict_knn, nor on prerequisites such as whether a Logistic Regression model must already have been trained via train_models. The only implicit usage cue is that it operates on a 'saved' model.

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

select_best_modelB

Select the best model using a rule (default: recall, then precision, then accuracy).

ParametersJSON Schema
NameRequiredDescriptionDefault
ruleNoOne of: recall_then_precision_then_accuracy, accuracy, precision, recall. Precision/recall refer to the malignant class.recall_then_precision_then_accuracy
test_sizeNoFraction of the data held out for testing.
request_idNoYour own id for this call; recorded in the audit log.unknown
random_stateNoRandom seed for the train/test split.
knn_neighborsNoNumber of neighbors for the KNN model.

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.2/5.0
Behavior2/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 discloses the default rule order but says nothing about whether this mutates/persists a 'selected model' state, what preconditions exist (trained models), or any side effects. For a selection tool with zero annotation coverage this is a significant gap.

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?

A single tight sentence that front-loads the action and includes the default. No filler, though it is perhaps too terse to be fully useful given the missing behavioral and usage detail.

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?

An output schema exists, so return values need not be explained. However, for a tool operating on models produced by siblings, the description omits prerequisites and whether the selection persists, leaving key context incomplete.

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

Parameters3/5

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

Schema description coverage is 100%, so all five parameters (rule, test_size, request_id, random_state, knn_neighbors) are already documented in the schema. The description only restates the default rule, adding nothing beyond what the schema provides. Baseline 3 applies when the schema does the heavy lifting.

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?

The description states a specific verb+resource: it selects the best model using a scoring rule. An agent can tell this apart from prediction and training siblings (predict_knn, train_models), though the description doesn't explicitly name what pool of models it selects from. Clear but without mindful sibling differentiation.

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?

Usage is only implied — after training/comparing models you pick the best one by a rule. There is no statement of prerequisites (e.g., models must already be trained), no when-not-to-use, and no routing to siblings like confusion_matrix_metrics for inspecting metrics. Adequate but with clear gaps.

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

shap_explain_selectedB

Run SHAP for the selected model: global top features plus a local explanation for one test row. Positive SHAP values push toward malignant.

ParametersJSON Schema
NameRequiredDescriptionDefault
top_kNoHow many top features to return.
test_sizeNoFraction of the data held out for testing.
request_idNoYour own id for this call; recorded in the audit log.unknown
local_indexNoTest-set row to explain individually.
random_stateNoRandom seed for the train/test split.
knn_neighborsNoNumber of neighbors for the KNN model.
selection_ruleNoRule used to pick the model to explain.recall_then_precision_then_accuracy

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.4/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 burden. It does add genuine value by disclosing the sign convention ('Positive SHAP values push toward malignant'), but it fails to disclose that the tool appears to re-split data and re-train models internally (test_size, random_state, knn_neighbors, selection_rule), nor whether it is read-only, deterministic, or expensive.

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?

Two tight sentences with no filler, and the core operation is front-loaded before the interpretive detail. Slightly under-specified rather than padded.

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?

An output schema exists, so return values need not be explained. However, for a 7-parameter tool that re-runs training/splitting and writes to an audit log, the description omits prerequisites, cost, and how selection_rule interacts with sibling tools like select_best_model.

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

Parameters3/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. The description loosely maps 'top features' to top_k and 'one test row' to local_index, but adds no format or semantic detail beyond the 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?

Clear verb+resource: it runs SHAP on the model chosen by the selection rule and returns both a global feature ranking and a single-row local explanation. This distinguishes it from train_models and select_best_model, though it never explicitly names those siblings as prerequisites.

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?

Usage is only implied by the phrase 'for the selected model' and the selection_rule parameter, which hints that a model must be selected first. There is no explicit when-to-use statement, no when-not-to-use, and no named alternative tool for interpretation.

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

train_modelsB

Train Logistic Regression and KNN on the breast cancer dataset and export joblib artifacts.

ParametersJSON Schema
NameRequiredDescriptionDefault
test_sizeNoFraction of the data held out for testing.
request_idNoYour own id for this call; recorded in the audit log.unknown
random_stateNoRandom seed for the train/test split.
knn_neighborsNoNumber of neighbors for the KNN model.

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.3/5.0
Behavior2/5

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

No annotations are provided, so the description carries the full behavioral burden. It does disclose one useful trait — that the call exports joblib artifacts, implying a filesystem write — but says nothing about whether existing artifacts are overwritten, where they are written, expected runtime, or any permissions/auth needed for a mutation-style tool.

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?

A single front-loaded sentence with no filler: verb, models, dataset, and output all appear before any padding. Nothing in the sentence is redundant with the schema or title.

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?

With an output schema present and full parameter documentation, the return values and arguments are covered. What remains missing for a training/export tool is behavioral context: overwrite semantics for the artifacts, ordering relative to the predict/select siblings, and any side-effect warnings.

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

Parameters3/5

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

Schema description coverage is 100%, and the schema documents all four parameters (test_size, random_state, knn_neighbors, request_id) with defaults and bounds. The description adds no parameter-level meaning beyond that, so the baseline of 3 applies.

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 names a specific verb (Train), two concrete model types (Logistic Regression and KNN), the exact dataset (breast cancer), and the side effect (export joblib artifacts). This is unambiguous and clearly separable from the sibling prediction tools (predict_logistic_regression, predict_knn) and from select_best_model.

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

Usage Guidelines2/5

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

There is no statement of when to call this versus its siblings, e.g. whether it must be run before predict_logistic_regression/predict_knn, whether it can be re-run, or how it relates to select_best_model. The usage context is only implied by the verb 'Train'.

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

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 8 tool updatesv0.2.0
    • First observedconfusion_matrix_metrics
    • First observedexport_parquet_audit
    • First observedget_sample_input
    • First observedpredict_knn
    • First observedpredict_logistic_regression
    • First observedselect_best_model
    • First observedshap_explain_selected
    • First observedtrain_models

TDQS

A3.6/5.0

Scored across 8 tools

Disambiguation4/5

Each tool targets a distinct stage of the ML pipeline (train, sample input, per-model predict, metrics, selection, SHAP, export). The only mild overlap is predict_logistic_regression vs predict_knn, but the names and descriptions clearly distinguish which model each uses.

Naming Consistency4/5

Most tools follow a verb_noun pattern (train_models, predict_knn, select_best_model, export_parquet_audit). A couple deviate into noun-heavy forms (confusion_matrix_metrics, shap_explain_selected), but the set remains readable and predictable.

Tool Count5/5

8 tools is well-scoped for a focused ML agent, mapping cleanly onto the train/evaluate/select/explain/export lifecycle. No filler tools and no obvious missing step.

Completeness4/5

The pipeline covers training, per-model prediction, evaluation, model selection, explainability, and audit export. Minor gaps exist (e.g. no predict endpoint for arbitrary new input beyond the provided sample, no listing of saved artifacts), but these are workable around.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables training and using machine learning models on local CSV datasets or data from other MCP servers, supporting tasks like forecasting, regression, classification, and anomaly detection.
    -
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables any MCP client to run a complete data-science pipeline on a CSV: exploration, cleaning, model comparison, training, tuning, and plain-language analysis. Exposes nine tools that turn raw data into trained models and reports.
    1
    MIT
  • F
    license
    Not graded
    quality
    B
    maintenance
    Local-first MCP server for credit risk analysis. It enables explainable rule discovery, statistical validation, PSI drift monitoring, and root-cause diagnosis on user-approved Parquet data while preserving privacy.
    -