optimize_context_tool
Retrieve targeted source code matching a query, compressed to fit a token budget. Avoid reading full files to save tokens and get direct answers.
Instructions
Return the most relevant REAL source code for a question, within a token budget.
Use this FIRST for any "how does X work / where is Y" question about the
codebase, and prefer it over reading files or grepping. Call it ONCE per
question: the returned optimized_context contains the relevant code —
answer directly from it and do NOT separately read the files it came from
(that defeats the whole point of the token savings).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| codebase_path | Yes | ||
| query | Yes | ||
| token_budget | No |