Skip to main content
Glama

resolve_context_bundle

Read-onlyIdempotent

Builds a token-pruned Markdown context bundle from a target file's dependency graph, with optional breaker-state degradation and session budget tracking for multi-module edits.

Instructions

Calculate topological dependency graph distances (D0 full target_file, D1 interface stubs, D2 nominal symbols) within project_root (defaults to target_file's parent directory) and compile a token-pruned Markdown context bundle, with optional reactive degradation via breaker_state ('CLOSED', 'TRIPPED' strips D2+ modules, or 'HALTED' compacts D1 to nominal stubs) and session_id ('SES-...' linked to TokenCast budget tracking). Use this as your primary context builder before editing a file in a multi-module project; for inspecting isolated files, use prune_file instead.

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": {
      "target_file": "<target_file>"
    },
    "name": "resolve_context_bundle"
  }
}

Input Schema

NameRequiredDescriptionDefault
session_idNoSession identifier (SES-...) to connect with TokenCast budget tracking
target_fileYesPath to the active target file in editing (D0)
project_rootNoRoot directory of the project. Defaults to target file's directory.
breaker_stateNoOptional circuit breaker state (CLOSED, TRIPPED, HALTED) or decision kind

Output Schema

NameRequiredDescriptionDefault
contentYesCompiled topological Markdown prompt context bundle
isErrorYesTrue if dependency resolution or file traversal failed

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv3.8.1
    • addedInput schema / properties / breaker_state
      Added value: +{
      +  "description": "Optional circuit breaker state (CLOSED, TRIPPED, HALTED) or decision kind",
      +  "type": "string"
      +}
    • addedInput schema / properties / session_id
      Added value: +{
      +  "description": "Session identifier (SES-...) to connect with TokenCast budget tracking",
      +  "type": "string"
      +}
  2. Changed1 schema field changedv3.5.6
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "content": {
      +      "description": "Compiled topological Markdown prompt context bundle",
      +      "items": {
      +        "properties": {
      +          "text": {
      +            "description": "Token-optimized Markdown context bundle",
      +            "type": "string"
      +          },
      +          "type": {
      +            "enum": [
      +              "text"
      +            ],
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "type",
      +          "text"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "isError": {
      +      "description": "True if dependency resolution or file traversal failed",
      +      "type": "boolean"
      +    }
      +  },
      +  "required": [
      +    "content",
      +    "isError"
      +  ],
      +  "type": "object"
      +}
  3. First observedv3.5.0

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already cover the safety profile (readOnly, idempotent, non-destructive, closed-world), and the description goes further by spelling out the degradation ladder: TRIPPED strips D2+ modules, HALTED compacts D1 to nominal stubs, and session_id ties into TokenCast budget tracking. It stops short of explaining what the resulting bundle looks like, but an output schema exists so that omission is minor.

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?

Two sentences, no filler, and the primary action is stated first. However, the opening sentence is a long chain of parentheticals (D0/D1/D2, breaker_state values, session_id) that would read faster as a short lead sentence with specifics following.

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?

For a four-parameter tool with an output schema and full annotation coverage, this covers everything needed to call it correctly: the required file, root defaulting, degradation modes, and session linkage. Return values are handled by the output schema, so nothing material 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 baseline is 3, but the description adds real semantics the schema lacks: the project_root default ('defaults to target_file's parent directory') and the concrete effect of each breaker_state value, which the schema only lists as bare strings with no formal enums. The vague 'or decision kind' phrasing on breaker_state leaves a small gap.

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?

Names a specific compound action — computing D0/D1/D2 dependency distances and compiling a token-pruned Markdown bundle — plus the key inputs (target_file, project_root). It explicitly contrasts with the sibling prune_file, so an agent can distinguish the two without opening either 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?

States exactly when to reach for it ('primary context builder before editing a file in a multi-module project') and names the alternative for the other case ('for inspecting isolated files, use prune_file instead'). Both the when and the when-not are present.

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