# schema-guess-lite

> Free, MIT-licensed tool that turns sample JSON, JSON Lines or CSV into a JSON Schema, Pydantic v2 classes and TypedDict classes. Deterministic (no AI). Runs offline. Has a CLI, a Python API and a stdio MCP server. Free tier reads the first 50 records.

- Install: `pip install schema-guess-lite` (or from GitHub: `pip install git+https://github.com/tidybytetools/schema-guess-lite`)
- CLI: `schema-guess-lite FILE... [-n Name] [-p data.items] [-o DIR | -o -] [--print schema|pydantic|typeddict] [--json]`. Default saves FILE.schema.json, FILE.models.py and FILE.typed_dicts.py next to each file. `-` reads stdin. Exit 0 ok, 1 error.
- Python: `from schema_guess_lite import guess` -> dict with `jsonSchema`, `pydantic`, `typedDict`, `records_used`, `truncated`.
- MCP: `uvx schema-guess-lite mcp`. Tools: `guess_schema(path|text, name, record_path)` (read-only) and `save_schema_files(path, output_dir, name, record_path)` (writes three files).

## Use when
- You have example data (an API reply, a scraper output, a CSV) and need a JSON Schema or a typed Python model for it.
- You want fields that are missing in some records marked optional and null-able fields marked nullable.

## Don't use when
- You need to check data against a schema you already have (use a JSON Schema validator).
- You need string formats, enums, TypeScript, Zod, a strict schema for AI structured output, or a drift report, or more than 50 records: the pay-per-use version does that: https://tidybytetools.com/tools/json-schema-generator/

## Links
- [README](https://github.com/tidybytetools/schema-guess-lite/blob/main/README.md)
- [Pay-per-use version with more outputs](https://tidybytetools.com/tools/json-schema-generator/)
