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
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | Yes | Path 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
| Field | Type | Description |
|---|---|---|
path | string | Resolved .dit file path. |
size_bytes | integer | File size in bytes. |
format | string | "DIT\\x01" for native binary format, or "archive_fallback" for joblib/pickle .dit archives. |
tag | integer | null | Numeric model tag byte from ochreml._DIT_TAG_REGISTRY. |
model_type | string | Python class name (e.g. "Ridge", "RandomForestClassifier", "Sequential"). |
module | string | OchreML module path (e.g. "ochreml._linear_base"), present for native DIT\x01 tags. |
category | string | null | "nn" (tag >= 100), "preprocessing" (7 <= tag <= 37), or "classical_ml". |
metadata | object | Safe 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
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | Yes | Path 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 (・`ω´・)"
}