Skip to main content

Module inspect

Module inspect 

Source
Expand description

Dry-run file inspection for the inspect_file MCP tool.

Given a path to a CSV, Parquet, or Arrow IPC file, inspect_source returns the schema we would use to create a table (using the exact same inference + full-file numeric widening as crate::ingest) along with per-column diagnostics that help an LLM pick a safer schema override before running load_file:

  • null_count — how many null / empty cells were seen in the full file.
  • min / max — smallest and largest values observed for numeric columns.
  • sample_values — a handful of raw string values from the first rows.

Nothing is written to Hyper; the engine is not even touched. The result is intentionally cheap enough to call eagerly before every load_file, which is the workflow we recommend in the tool description and error suggestions.

For non-CSV inputs we fall back to the file’s embedded schema (Parquet / Arrow IPC carry exact types) and skip min/max because extracting those cheaply would mean decoding every batch.

Structs§

ColumnStats
Per-column diagnostics returned alongside the inferred schema.
InspectReport
Full inspection result for a single source.

Constants§

DEFAULT_SAMPLE_ROWS
Default number of sample rows returned for each column if the caller does not request a specific count. Small enough to keep the response compact for LLM clients while still giving a human-readable preview.

Functions§

inspect_json_from_text
Inspect a JSON / JSONL text string (already in memory) without reading from a file. Used by the inspect_file handler when json_extract_path has already extracted the relevant slice.
inspect_source
Top-level dispatcher: pick the right inspector for path using the same extension + content-sniffing logic crate::ingest::detect_file_format drives for the ingest side. That shared dispatcher is what ensures inspect_file and load_file can never disagree on what a file is — if inspect says “this is JSONL”, load will try it as JSONL too.