Skip to Content
OchreML
MCP Tools

ochreml_inspect_dit & ochreml_verify_dit

Inspect .dit binary model headers and metadata, or verify model integrity without corruption.

OchreML persists trained models in a compact binary .dit format (DIT\x01 magic header + 1-byte model tag). Two dedicated MCP tools inspect and validate .dit artifacts inside the allowed MCP root.

Both tools enforce require_dit=True via OchreMCPServer._resolve_contained(), rejecting any path that escapes the root or does not end with .dit.


ochreml_inspect_dit

Inspect a .dit binary model header (DIT\x01), numeric model tag, category (classical_ml, preprocessing, or nn), file size, and safe loaded model metadata. Backed by ochreml._ops.op_inspect_dit().

Input Schema

ParameterTypeRequiredDescription
pathstringYesPath to .dit model file (.dit extension enforced).

Example JSON-RPC Call

{
  "jsonrpc": "2.0",
  "id": 4,
  "method": "tools/call",
  "params": {
    "name": "ochreml_inspect_dit",
    "arguments": {
      "path": "models/ridge.dit"
    }
  }
}

Response Fields

FieldTypeDescription
pathstringResolved .dit file path.
size_bytesintegerFile size in bytes.
formatstring"DIT\\x01" for native binary format, or "archive_fallback" for joblib/pickle .dit archives.
taginteger | nullNumeric model tag byte from ochreml._DIT_TAG_REGISTRY.
model_typestringPython class name (e.g. "Ridge", "RandomForestClassifier", "Sequential").
modulestringOchreML module path (e.g. "ochreml._linear_base"), present for native DIT\x01 tags.
categorystring | null"nn" (tag >= 100), "preprocessing" (7 <= tag <= 37), or "classical_ml".
metadataobjectSafe JSON-serializable attributes extracted after loading on CPU: class_name, n_features_in_, device_, hyperparameters (alpha, fit_intercept, max_depth, criterion, n_estimators, max_iter, n_clusters, n_components, kernel, C), classes, and coef_shape / coef_len.

ochreml_verify_dit

Verify that a .dit model file has a valid .dit extension, intact header, and deserializes cleanly on CPU. Backed by ochreml._ops.op_verify_dit().

Unlike ochreml_inspect_dit (which raises an error if the file is corrupt), ochreml_verify_dit always returns a structured boolean status object (valid: true or valid: false).

Input Schema

ParameterTypeRequiredDescription
pathstringYesPath to .dit model file (.dit extension enforced).

Example JSON-RPC Call

{
  "jsonrpc": "2.0",
  "id": 5,
  "method": "tools/call",
  "params": {
    "name": "ochreml_verify_dit",
    "arguments": {
      "path": "models/ridge.dit"
    }
  }
}

Response Payload (Valid vs. Invalid)

On a valid .dit file:

{
  "valid": true,
  "path": "/workspace/models/ridge.dit",
  "format": "DIT\\x01",
  "tag": 2,
  "model_type": "Ridge",
  "size_bytes": 412
}

On a missing or corrupted .dit file:

{
  "valid": false,
  "path": "/workspace/models/corrupt.dit",
  "error": "Unknown model tag (255) in .dit file (・`ω´・)"
}

On this page