mcp-context-optimizer

v0.1.9
mcp-context-optimizer Checked 1 hour ago Published 1 month ago

Keep 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.

ParameterTypeDescription
records *arrayArray 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).

ParameterTypeDescription
query *stringNatural-language query or task description.
limitintegerMax fragments to return (default 10).
recordsarrayOptional 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.

ParameterTypeDescription
limitinteger
querystringOptional 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.

ParameterTypeDescription
path *stringFile 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.

ParameterTypeDescription
task *stringThe current task description.
querystringAdditional relevance terms.
recordsarrayOptional inline records to include in addition to stored records.
tokenBudgetintegerOverride the server token budget.