MCP Tools Reference
Reference for the 3 Distill tools — auto_optimize, smart_file_read, code_execute
MCP Tools Reference
Distill provides 3 always-loaded tools for optimizing LLM token usage.
auto_optimize — Universal Compression
Auto-detects content type and applies the optimal compression strategy.
| Strategy | Content Type | Savings |
|---|---|---|
build | Compiler errors (tsc, rustc, webpack) | 95% |
logs | Server/test/build logs | 80-90% |
errors | Repeated error lines | 70-90% |
diff | Git diffs | 60-80% |
stacktrace | Stack traces | 50-80% |
code / semantic | Source code (TF-IDF) | 40-60% |
config | JSON/YAML configs | 30-60% |
auto | Auto-detect best strategy | varies |
Parameters:
content(required) — The content to compressstrategy— Explicit strategy orauto(default)aggressive— Maximum compression modepreservePatterns— Regex patterns to preserveformat—plainormarkdown
smart_file_read — AST-Powered Reading
Read code with AST extraction — get functions, classes, signatures without loading the full file.
5 modes:
skeleton— Signatures only (depth 1-3)extract— Specific element by type and namesearch— Find elements by queryfull— File structure overviewauto— Detect from params
7 languages: TypeScript, JavaScript, Python, Go, Rust, PHP, Swift
Parameters:
filePath(required) — Path to the filemode— Read mode (autodefault)target— For extract mode:{type, name}query— For search modedepth— Skeleton depth (1-3)
code_execute — Sandboxed TypeScript SDK
Execute TypeScript in a secure sandbox. Replaces 5-10 tool calls with one.
ctx.* SDK:
ctx.files.read(path) // Read a file
ctx.files.glob(pattern) // Find files by pattern
ctx.files.exists(path) // Check if file exists
ctx.code.parse(content, lang) // Parse to structure
ctx.code.extract(content, lang, {type, name}) // Extract element
ctx.code.skeleton(content, lang) // Signatures only
ctx.compress.auto(content, hint?) // Auto-detect and compress
ctx.compress.logs(logs) // Log summarization
ctx.compress.diff(diff) // Diff compression
ctx.compress.semantic(content, ratio?) // TF-IDF compression
ctx.git.diff(ref?) // Get diff
ctx.git.log(limit?) // Commit history
ctx.git.blame(file, line?) // Blame info
ctx.search.grep(pattern, glob?) // Search file contents
ctx.search.symbols(query) // Find code symbols
ctx.utils.countTokens(text) // Count tokens
ctx.utils.detectType(content) // Detect content type
ctx.utils.detectLanguage(path) // Detect language from pathParameters:
code(required) — TypeScript code to executetimeout— Timeout in ms (1000-30000, default 5000)
Security: 7-layer sandbox, 128MB memory limit, blocks eval, require, import(), process.