MCP Tools
expand_result
Get the full source code for a search result by its rank number.
search_code deliberately withholds full source to keep responses small. expand_result is how the agent fetches it — but only for the results it actually needs to read in detail, usually just rank #1.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
rank | integer | ✓ | Result rank number from the last search_code call (1-based — 1 for the top result, 3 for the third). |
How it works
After every search, the server caches the full result set in memory, keyed by rank. When you call expand_result(rank=3), it looks up result #3 in that cache and reads its exact line range from disk — no re-embedding, no re-searching, no re-ranking. Expansions are cheap, precise disk reads.
Example
search_code returns result #3 with a 234 more lines truncation note. To read it in full:
The response is the complete source of that entity, with a header showing its name and file:start-end range.
Notes
- Only works after a
search_codecall in the same session. If the cache is empty you'll be told to runsearch_codefirst. rankmust be between 1 and the number of results returned by the last search.- To read arbitrary files or a named function outside of search results, use
get_sourceinstead.