Skip to main content

AI agent tools and MCP server

undatum exposes its operations to LLM agents through a JSON tool layer that builds on iterabledata's foundation tools and adds undatum-specific tools (ad-hoc DuckDB SQL, value frequency, and confirm-gated dedup/mask/sample).

JSON tools and function-calling schemas

from undatum import tools
from undatum.tools import schemas

# Call a tool directly (returns {"ok": ..., "data"/"error": ...})
result = tools.detect_format("data.csv")
freq = tools.frequency("data.csv", "country")
freq = tools.frequency("nested.jsonl", "capital_city.lat", flatten_nested=True)

# Dispatch by name (handy for agent runtimes)
schemas.call_tool("query_sql", {"path": "data.parquet", "query": "SELECT * FROM data LIMIT 5"})

# Export schemas for LLM function calling
openai_fns = schemas.to_openai_functions()
anthropic_tools = schemas.to_anthropic_tools()

Write tools (convert_file, deduplicate, mask_fields, sample_data) require confirm=True to prevent accidental writes. Pass flatten_nested=True to unfold nested fields onto dotted paths (same as --flatten-nested on the CLI).

Tool catalog

Foundation tools (from iterabledata) plus undatum extras. undatum mcp tools prints the live list.

ToolWrites?Notes
detect_formatnoFormat and compression for a path
describe_capabilitiesnoCatalog metadata for a format id
read_samplenoBounded sample; optional redact
infer_schemanoInferred schema
analyze_datasetnoStructure; optional autodoc
compute_statsnoColumn statistics
convert_fileyesRequires confirm=true; dry_run available
generate_documentationnoAI dataset documentation
validate_datanoField rules; default mode stats
plan_conversionnoDeclarative convert plan
suggest_transformnoNatural-language transform spec
translate_filternoFilter expression → AST
query_sqlnoDuckDB SQL; file registered as view data
frequencynoValue counts; optional table, flatten_nested
deduplicateyesRequires confirm=true
mask_fieldsyesRequires confirm=true
sample_datayesRequires confirm=true

LangChain

from undatum.tools.langchain import get_tools # pip install "undatum[langchain]"

lc_tools = get_tools() # list[StructuredTool]

MCP server

Expose the tools to MCP-compatible agents (Claude Desktop, Cursor, etc.) over stdio:

pip install "undatum[mcp]"

# List the tools the server exposes
undatum mcp tools

# Run the stdio server (wire this command into your MCP client)
undatum mcp serve

# Standalone console entry point (equivalent)
undatum-mcp

Copy-paste client config (Cursor mcp.json and Claude Desktop) is on the mcp command page.

See also the mcp command.