Get Code Context for a Symbol
get_contextRetrieve a token-budgeted code slice around a C# symbol, including source, direct dependencies, and callees, so agents get focused context for one type or method.
Instructions
Return a dense, token-budgeted AI-Builder-Markdown slice of the code around a symbol: the symbol's source plus its expanded neighborhood (direct dependencies + callees, depth 1). Pass a type or method simple name (use find_symbol first to disambiguate). budget caps the output in tokens (floored at 8000); omit for full bodies. The fastest single-symbol retrieval - prefer it over export_markdown (which renders the WHOLE solution) when you only need one symbol's context. Multi-TFM solutions are deduplicated to one logical project per name, keeping the NEWEST TFM's instance (matching find_symbol's view; export_markdown keeps the unfiltered per-TFM render). Need a CHOSEN environment of one symbol (callers / tests / implementations / quality)? use explain_symbol. Bundling a whole task from a natural-language goal? use pack_for_task (read) or prepare_task (edit-ready: + covering tests & siblings).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lean | No | Lean slice (default TRUE): drop the repeated <AI_CONTEXT_SPEC> format-rules preamble and the <AI_CONTEXT_META> block, and omit any enabled-but-empty graph section (the ones that would otherwise render just '- none'). On a focused single-symbol slice that boilerplate is >4x the actual signal. The PATH_LEGEND, COMPRESSION_LEGEND (decoding keys) and all non-empty sections are kept. Set false to get the full AI-Builder-MD document with the format contract. | |
| budget | No | Optional token budget (floored at 8000). Caps the slice TWO ways: it compacts/drops method bodies AND - when the expanded neighborhood still overflows - drops the least-relevant non-seed types entirely, ranked by closeness to the seed and in-slice fan-in. The seed itself is never dropped: it renders with its full source when that fits the budget, otherwise as STRUCTURE (identity, members, every method signature) with a leading note naming the measured size of the full-code render and the budget that holds it. A leading comment discloses how many types were dropped. Omitted, the slice still renders against a ceiling (the active MCP profile's token budget, else a ~10000-token default budget) that bounds the neighborhood; pass a value for a tighter slice. | |
| symbol | Yes | The type or method simple name to center the slice on. | |
| sessionId | Yes | The session_id returned by analyze_solution. Also takes an absolute .sln/.slnx/.slnf path, analyzed on first use. | |
| includeQualityMetrics | No | When true, also emit the <QUALITY_HOTSPOTS> section plus complexity=""/ce="" tag attributes for the sliced symbols (cyclomatic complexity, efferent coupling). Default false (leaner slice). Set true when reviewing code quality / picking refactor targets. |