Skip to main content
Glama

Prepare Context for an Edit

prepare_task
Read-onlyIdempotent

Builds a token-budgeted, EDIT-ready context bundle for a task goal: seed symbol sources, dependency neighborhood, covering tests and naming siblings in one AI-Builder-MD document.

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 declaration per type (the NEWEST TFM's where it has one), as find_symbol lists them.

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.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "sessionId": "<sessionId>",
      "goal": "<goal>"
    },
    "name": "prepare_task"
  }
}

Input Schema

NameRequiredDescriptionDefault
goalYesThe 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).
leanNoLean 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.)
facetNoOptional 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.)
budgetNoOptional 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.
sessionIdYesThe session_id returned by analyze_solution. Also takes an absolute .sln/.slnx/.slnf path, analyzed on first use.
includeTestsNoInclude the test methods that cover the seeded symbols (default true).
includeSiblingsNoInclude 1-2 naming/file-convention siblings of the seeded types (default true).
includeQualityMetricsNoWhen 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.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.5.46513
    • changedInput schema / properties / budget / description
      Previous value: -"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. The goal-named seeds are never dropped - one whose own source does not fit renders as structure (members and signatures); 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."New value: +"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."
    • changedInput schema / properties / facet / description
      Previous value: -"Optional facet to work under - the task axis of this call: General (default), Exploration, Refactoring, Debugging, Review, Testing, Documentation, Architecture, or Performance. On a profile-aware server (aicb mcp --db-path) 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.)"New value: +"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.)"
    • changedInput schema / properties / sessionId / description
      Previous value: -"The session_id returned by analyze_solution."New value: +"The session_id returned by analyze_solution. Also takes an absolute .sln/.slnx/.slnf path, analyzed on first use."
  2. First observed

TDQS

A4.7/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations cover the safety profile (readOnly, idempotent, non-destructive), and the description goes well beyond them: output is text not JSON, a manifest comment (goal | seeds | tests | siblings | render) reveals what was and was not covered, a staleness comment appears after a source edit, and multi-TFM declarations are deduplicated to the newest TFM. It also discloses drop ordering under budget pressure and the never-drop guarantee for goal-named types.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The core purpose and the sibling routing are front-loaded, which is good, but the body is two very dense paragraphs mixing render-path mechanics, budget fallbacks, and TFM rules into single sprawling sentences. Several clauses (e.g. the lean/template/default-server interplay) duplicate or re-litigate what the schema already says, so length is not fully earned.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema exists, and the description compensates by describing the return shape in detail: text not JSON, manifest header, staleness prefix, render path naming, and the leading note naming budget drops. For an 8-parameter tool with two render paths this is complete enough for an agent to invoke it correctly and interpret the result.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 100% schema coverage the baseline is 3, and the description does add some interaction semantics the schema leaves scattered, notably that lean and includeQualityMetrics act only on the lean render and therefore not on a default (config-DB) server. Much of the budget/lean explanation restates the already verbose schema text, so the net addition is modest rather than substantial.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

"Build an EDIT-ready context bundle for a task goal" is a specific verb+resource, and the description enumerates the bundle's contents (seeds, dependency neighborhood, covering tests, naming/file-convention siblings) as one token-budgeted AI-Builder-MD document. It explicitly separates itself from pack_for_task, get_context/explain_symbol, and review_context, so an agent can pick it without opening another schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives an explicit decision rule: prefer this over pack_for_task when about to EDIT rather than read, because pack_for_task lacks tests and siblings. It also routes single-symbol lookups to get_context/explain_symbol and numeric blast-radius/coverage to review_context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.