Skip to main content
Glama

Pack Context for a Task

pack_for_task
Read-onlyIdempotent

Pack a token-budgeted context bundle for a C# task by naming the types or methods to seed, then expanding the relevant code neighborhood.

Instructions

Goal-driven context packing: given a natural-language task, seed on every symbol the goal names (type or method), expand the neighborhood, and return a token-budgeted AI-Builder-Markdown bundle - with goal-aware trimming that keeps the most task-relevant methods when the budget is tight. Name the symbols you care about in the goal (e.g. 'refactor OrderService.Cancel and Validate'). budget caps output tokens (floored at 8000). Multi-TFM solutions are deduplicated to one logical project per name (NEWEST TFM's instance, matching find_symbol's view). For an EDIT-ready bundle that also pulls in the covering tests + naming/file siblings (and, on a profile-aware server, renders through the facet's template), use prepare_task instead.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
goalYesThe task description (name the relevant types/methods in it). 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): drop the repeated <AI_CONTEXT_SPEC>/<AI_CONTEXT_META> preamble and omit enabled-but-empty graph sections ('- none'). Keeps PATH_LEGEND / COMPRESSION_LEGEND and all non-empty sections. Set false for the full AI-Builder-MD document.
facetNoOptional facet - the task axis of this call: General, Exploration, Refactoring, Debugging, Review, Testing, Documentation, Architecture, or Performance. pack_for_task always renders the lean bundle (its render deliberately stays template-free - use prepare_task for a template-shaped bundle); the facet appends a short work-style trailer with suggested next tools. (The name 'slot' is accepted too.)
budgetNoOptional 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. Exact type names and exact method names with one owner are pinned; broad subword/ambiguous same-name families may be capped by closeness and in-slice fan-in. A leading comment discloses how many types were dropped. Omitted, the bundle 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 bundle.
sessionIdYesThe session_id returned by analyze_solution. Also takes an absolute .sln/.slnx/.slnf path, analyzed on first use.
includeQualityMetricsNoWhen true, also emit the <QUALITY_HOTSPOTS> section plus complexity=""/ce="" tag attributes (cyclomatic complexity, efferent coupling) for the packed symbols. Default false. Set true when the task is a refactor/quality pass.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.5.46513
    • 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.8/5.0
Behavior5/5

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

Annotations already cover the safety profile (readOnly, idempotent, non-destructive), and the description adds substantial non-obvious behavior: the 8000-token budget floor, two-way budget enforcement (body compaction plus dropping least-relevant non-seed types), pinned exact names, a dropped-types comment, multi-TFM dedup to the NEWEST TFM, and the default ~10000-token ceiling.

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

Conciseness4/5

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

Front-loaded with the core behavior in the first sentence, then progressively narrower detail. It is dense and on the long side, with some parenthetical tangents (the 'slot' alias, the profile-token-budget aside), but nearly every clause carries actionable information.

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 (lean vs full AI-Builder-MD, PATH/COMPRESSION legends, quality hotspots section), so an agent knows what it will receive. Combined with the routing to prepare_task and the session/prerequisite context, nothing essential is missing.

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?

Schema coverage is 100%, so the baseline is 3, but the description genuinely enriches it: the goal's symbol-matching semantics (exact names suppress other words; segment matching for 'cancel order' -> CancelOrder), the lean default's effect on preamble/sections, and budget's dual enforcement. Only the facet enum values are left entirely to the schema.

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?

States a precise verb+resource: 'Goal-driven context packing' that seeds on goal-named symbols, expands the neighborhood, and returns a token-budgeted Markdown bundle. It explicitly distinguishes itself from the closest sibling by routing edit-ready/template work to prepare_task.

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?

Gives explicit when-to-use conditions (name symbols in the goal to steer seeding; use prepare_task for an EDIT-ready or template-shaped bundle; set includeQualityMetrics for refactor/quality passes). Alternatives and exclusions are named rather than implied.

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