Get optimized (compressed) context
get_optimized_contextCompresses raw text or file content to fit a token budget using reversible algorithms, with auto-escalation or manual pipeline control.
Instructions
Reversible token-reduction pipeline. Accepts raw text OR a filePath. Three modes of use: (1) set targetTokens and MeshMind auto-escalates algorithms until the output fits your budget; (2) set explicit algorithms; (3) leave both for sensible defaults. Algorithms: strip, whitespace, line-dedup, json-min, truncate, stopwords, summarize. Set summarize=true for an abstractive summary via the host LLM (MCP sampling), extractive fallback. preview=true shows the per-step savings WITHOUT storing a ref. Returns compressed payload, exact BPE savings, and a ref for retrieve_context. Provide exactly one of text or filePath.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | No | Raw text/code/HTML to compress. | |
| filePath | No | Local file to read and compress. | |
| mode | No | Compression regime (default auto). | |
| targetTokens | No | Token budget — auto-escalate the pipeline until output fits. | |
| algorithms | No | Override the algorithm pipeline (ignored if targetTokens set). | |
| maxLines | No | truncate: line budget. | |
| summarize | No | Abstractive summary via host LLM (sampling), extractive fallback. | |
| preview | No | Show per-step savings without storing a ref or recording stats. |