Prepare Context for an Edit
prepare_taskBuild an edit-ready context bundle for a task goal. It covers symbol sources, dependencies, covering tests, and convention siblings, all within a token budget.
Instructions
Build an EDIT-ready context bundle for a task goal: the source of the symbols the goal names, their dependency neighborhood, the test methods that cover them and 1-2 naming/file-convention siblings (the test, the factory, the validator you'd otherwise miss) - as one token-budgeted AI-Builder-MD document.
Prefer this over pack_for_task when you're about to EDIT, not just read. pack_for_task packs the goal-seeded neighborhood alone, without covering tests and siblings. For one symbol use get_context or explain_symbol; for blast radius and test coverage as numbers use review_context.
Returns text, not JSON. It starts with a manifest comment (goal | seeds | tests | siblings | render) so you can see what was covered - and what was NOT ((none)); after a source edit a staleness comment precedes it. 'render' names the path that produced the body. 'template' is the default, because a plain 'aicb mcp' resolves the standard config DB: the chosen facet's template (graphs, detail, line numbers, quality) in the active profile's notation - YAML under the built-in profiles. 'lean' is the fallback of a server without a config DB: tag Markdown. Multi-TFM solutions are deduplicated to one logical project per name (NEWEST TFM's instance, matching find_symbol's view).
Read-only. Parameters: a tight budget drops neighborhood types, tests and siblings first. A type the goal names, or the one owner of a method it names, is never dropped (too large, it renders as structure: members and signatures); the owners of a method name several types share can be dropped. A leading note names the drops. lean and includeQualityMetrics act on the lean render only, so not on a default server.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| goal | Yes | The task description - name the relevant types/methods in it (e.g. 'refactor OrderService.Cancel and its validation'). Once the goal names a symbol exactly, its other words only steer the trimming and seed nothing of their own; a goal naming no symbol is matched by name segments instead ('cancel order' -> CancelOrder). | |
| lean | No | Lean slice (default TRUE): on the lean-render path, drop the repeated <AI_CONTEXT_SPEC>/<AI_CONTEXT_META> preamble and omit enabled-but-empty graph sections ('- none'); keeps PATH_LEGEND / COMPRESSION_LEGEND, the manifest and all non-empty sections. Set false for the full AI-Builder-MD document. (Ignored on the profile-aware slot-template render path, which the active profile controls.) | |
| facet | No | Optional facet to work under - the task axis of this call: General (default), Exploration, Refactoring, Debugging, Review, Testing, Documentation, Architecture, or Performance. On a server with a config DB (the default: a plain 'aicb mcp' resolves the standard one) the facet's template shapes the render; it always appends a short work-style trailer with suggested next tools. (The former name 'slot' is still accepted.) | |
| budget | No | Optional token budget (floored at 8000). Applies to BOTH the lean and the profile-aware template render path: it compacts/drops method bodies AND drops the least-relevant types when the neighborhood overflows. A type the goal names, and the one owner of a method name it names, is never dropped - one whose own source does not fit renders as structure (members and signatures). The owners of a method name several types share are capped like the neighborhood: some are reduced to structure, some dropped. The bundled covering tests/siblings are BUDGET-BOUND - under a tight budget they are dropped to fit (a leading comment names the drops so you can ask for one by name). Overrides any MCP-profile/template token budget. Omitted, the bundle still renders against a ceiling (the MCP profile's token budget, else the facet template's, else a ~10000-token default budget) that bounds the neighborhood. | |
| sessionId | Yes | The session_id returned by analyze_solution. Also takes an absolute .sln/.slnx/.slnf path, analyzed on first use. | |
| includeTests | No | Include the test methods that cover the seeded symbols (default true). | |
| includeSiblings | No | Include 1-2 naming/file-convention siblings of the seeded types (default true). | |
| includeQualityMetrics | No | When true, also emit the <QUALITY_HOTSPOTS> section plus complexity=""/ce="" tag attributes for the bundled symbols (lean path). Default false. Set true for a refactor/quality pass. |