mcp-context-optimizer
v0.1.9Keep critical context within token limits for AI coding agents.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
ingest_records
Add structured records (messages, tool calls, errors, files, diffs, test results, decisions, notes) to the local in-memory context store. Records are validated; malformed entries are reported and skipped.
| Parameter | Type | Description |
|---|---|---|
records * | array | Array of records; each must have a "kind" field plus kind-specific fields. |
search_context
Retrieve fragments relevant to a query, ranked by the explainable relevance model. Returns fragments with score breakdowns and provenance (never modifies sources).
| Parameter | Type | Description |
|---|---|---|
query * | string | Natural-language query or task description. |
limit | integer | Max fragments to return (default 10). |
records | array | Optional records to search inline, in addition to stored records. |
get_decisions
Retrieve previously recorded technical decisions and constraints (accepted, proposed, superseded, rejected).
get_relevant_errors
Retrieve related errors, failed attempts and diagnostic information (error records, failed tool calls, failing tests). Optionally ranked by a query.
| Parameter | Type | Description |
|---|---|---|
limit | integer | |
query | string | Optional relevance query; omit for all errors. |
get_file_history
Retrieve context associated with a particular file: file snapshots, diffs, errors and test failures pointing at that path.
| Parameter | Type | Description |
|---|---|---|
path * | string | File path (absolute, relative, or basename). |
build_context
Construct a compact, task-specific context under a token budget. Combines stored records with any inline records; returns the rendered context plus provenance, omissions and a reproducible optimization report. Token counts are estimates unless a custom estimator is configured server-side.
| Parameter | Type | Description |
|---|---|---|
task * | string | The current task description. |
query | string | Additional relevance terms. |
records | array | Optional inline records to include in addition to stored records. |
tokenBudget | integer | Override the server token budget. |