Skip to Content
OchreML
MCP Tools

ochreml_dataset_profile

Profile a CSV, TSV, or Parquet dataset for shape, column dtypes, missingness, summary stats, and target task inference.

ochreml_dataset_profile inspects a tabular dataset inside the allowed MCP root and returns column-level statistics without requiring pandas or numpy. CSV and TSV files are parsed with Python's stdlib csv module; Parquet files (.parquet / .pq) are read automatically if optional pyarrow, polars, or pandas is installed.

It is backed by ochreml._ops.op_dataset_profile().

Input Schema

ParameterTypeRequiredDefaultDescription
pathstringYes—Path to CSV, TSV, or Parquet file (contained within MCP root).
targetstringNonullOptional target column name for task inference and distribution summary.
max_rowsintegerNonullOptional maximum number of rows to scan (sets truncated: true if hit).

Guardrails

  • path is validated by OchreMCPServer._resolve_contained(path). Any traversal outside --root / OCHREML_MCP_ROOT returns isError: true.
  • Missing tokens recognized case-insensitively: "", "na", "n/a", "nan", "null", "none", "inf", "-inf".

Example JSON-RPC Call

{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "tools/call",
  "params": {
    "name": "ochreml_dataset_profile",
    "arguments": {
      "path": "data/housing.csv",
      "target": "price",
      "max_rows": 5000
    }
  }
}

Response Fields

FieldTypeDescription
pathstringResolved dataset path.
formatstringDetected format: "csv", "tsv", or "parquet".
size_bytesintegerFile size in bytes.
n_rowsintegerNumber of rows scanned.
n_colsintegerNumber of columns.
truncatedbooleantrue if max_rows capped the scan.
columnsobject[]Per-column profiles: name, dtype ("numeric", "categorical", or "empty"), missing_count, missing_pct, n_unique, plus min/max/mean/std (numeric) or top_values top-5 map (categorical).
target_summaryobjectIncluded when target is specified: column, inferred_task ("classification" or "regression"), dtype, missing_count, n_unique, and either class_distribution (top 20 classes) or min/max/mean/std.

Example Response Payload

{
  "path": "/workspace/data/housing.csv",
  "format": "csv",
  "size_bytes": 184320,
  "n_rows": 5000,
  "n_cols": 4,
  "truncated": true,
  "columns": [
    {
      "name": "sqft",
      "missing_count": 0,
      "missing_pct": 0.0,
      "n_unique": 1420,
      "dtype": "numeric",
      "min": 450.0,
      "max": 6800.0,
      "mean": 1982.4,
      "std": 612.15
    }
  ],
  "target_summary": {
    "column": "price",
    "inferred_task": "regression",
    "dtype": "numeric",
    "missing_count": 0,
    "n_unique": 3890,
    "min": 85000.0,
    "max": 1950000.0,
    "mean": 412500.0,
    "std": 185200.5
  }
}

On this page