Skip to main content
Glama
token-context-mcp

token-context-mcp

Impact candidate slice

get_impact_slice
Read-onlyIdempotent

Traverses 0–3 AST caller/callee hops from a known symbol ID to return a token-budgeted impact slice for code-change analysis, with truncation when caps are hit.

Instructions

Traverse 0-3 hop AST caller/callee edges from a known symbol_id; candidate slice only (truncated=true if capped by max_nodes/max_tokens). For imports use get_module_dependents.

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": {
      "repo_id": "<repo_id>",
      "symbol_id": "<symbol_id>"
    },
    "name": "get_impact_slice"
  }
}

Input Schema

NameRequiredDescriptionDefault
depthNoMaximum AST call-graph hops (0 to 3; defaults to 2 under 'impact' profile; out-of-range errors).
profileNoNamed budget profile preset ('locate', 'orient', 'impact', 'read'); defaults to 'impact'.
repo_idYesRegistered repository ID from list_repositories (never a filesystem path).
directionNoTraversal direction: 'callers' (incoming references), 'callees' (outgoing calls), or 'both'.both
max_nodesNoHard cap on visited graph nodes before setting node_limit_reached=true (1 to max_graph_nodes).
symbol_idYesCanonical or compact 8-char starting symbol_id from get_repo_map, find_symbols, or search_source.
max_tokensNoToken cap for serialized slice (32 to max_result_tokens; defaults to 'impact' profile budget).
min_confidenceNoOptional edge confidence floor (0.0 to 1.0) filtering out weaker lexical call guesses.
filter_ambiguousNoExclude edges with status='ambiguous' (multiple matching targets) when True; set False to inspect uncertain candidates.

Output Schema

NameRequiredDescriptionDefault
dataNoCandidate caller/callee traversal slice and truncation diagnostics.
errorNoPresent when the tool call fails (either a structured {code, message, details} object or a diagnostic string).
budgetNoToken budget accounting for this response.
repo_idNoRegistered repository identifier.
evidenceNoSource-verified file line spans and SHA-256 hashes backing the response.
warningsNoFreshness, ambiguity, redaction, or security warnings.
freshnessNoIndex freshness state ('fresh', 'pending', 'stale', or 'unknown').
truncatedNoTrue if items were omitted due to budget or node limits.
ledger_revNoCurrent evidence ledger revision for repo_id.
completenessNoCoverage/resolution completeness indicator.
index_run_idNoIdentifier of the active index snapshot run.
edge_precisionNoResolved vs. ambiguous edge ratio summary.
schema_versionNoEnvelope schema version ('1.0').
untrusted_repository_contentNoTrue when payload embeds raw repository text.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed9 schema fields changedv0.3.8
    • changedInput schema / properties / depth / description
      Previous value: -"Maximum AST call-graph traversal hops (0 to 3; defaults to 2 in 'impact' profile)."New value: +"Maximum AST call-graph hops (0 to 3; defaults to 2 under 'impact' profile; out-of-range errors)."
    • changedInput schema / properties / direction / description
      Previous value: -"Call-graph traversal direction: 'callers' (who calls this), 'callees' (what this calls), or 'both'."New value: +"Traversal direction: 'callers' (incoming references), 'callees' (outgoing calls), or 'both'."
    • changedInput schema / properties / filter_ambiguous / description
      Previous value: -"Exclude ambiguous lexical edges that match multiple candidate targets when True."New value: +"Exclude edges with status='ambiguous' (multiple matching targets) when True; set False to inspect uncertain candidates."
    • changedInput schema / properties / max_nodes / description
      Previous value: -"Maximum number of graph nodes to visit before truncating (1 to max_graph_nodes)."New value: +"Hard cap on visited graph nodes before setting node_limit_reached=true (1 to max_graph_nodes)."
    • changedInput schema / properties / max_tokens / description
      Previous value: -"Maximum token budget for the impact slice (32 to max_result_tokens)."New value: +"Token cap for serialized slice (32 to max_result_tokens; defaults to 'impact' profile budget)."
    • changedInput schema / properties / min_confidence / description
      Previous value: -"Minimum edge resolution confidence (0.0 to 1.0) required to include an edge."New value: +"Optional edge confidence floor (0.0 to 1.0) filtering out weaker lexical call guesses."
    • changedInput schema / properties / profile / description
      Previous value: -"Named budget profile ('locate', 'orient', 'impact', 'read'); defaults to 'impact'."New value: +"Named budget profile preset ('locate', 'orient', 'impact', 'read'); defaults to 'impact'."
    • changedInput schema / properties / symbol_id / description
      Previous value: -"Exact starting symbol_id obtained from find_symbols, get_repo_map, or search_source."New value: +"Canonical or compact 8-char starting symbol_id from get_repo_map, find_symbols, or search_source."
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": true,
      +  "properties": {
      +    "budget": {
      +      "additionalProperties": true,
      +      "description": "Token budget accounting for this response.",
      +      "properties": {
      +        "envelope_reserve": {
      +          "description": "Wire-framing token reserve when budget >= 512.",
      +          "type": "integer"
      +        },
      +        "estimated_tokens": {
      +          "description": "Estimated serialized response tokens.",
      +          "type": "integer"
      +        },
      +        "requested_tokens": {
      +          "description": "Requested or profile-default token budget.",
      +          "type": "integer"
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "completeness": {
      +      "additionalProperties": true,
      +      "description": "Coverage/resolution completeness indicator.",
      +      "properties": {
      +        "basis": {
      +          "description": "How completeness was computed.",
      +          "type": "string"
      +        },
      +        "value": {
      +          "description": "Completeness ratio in [0.0, 1.0], or null if N/A.",
      +          "type": [
      +            "number",
      +            "null"
      +          ]
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "data": {
      +      "additionalProperties": true,
      +      "description": "Candidate caller/callee traversal slice and truncation diagnostics.",
      +      "properties": {
      +        "depth": {
      +          "description": "Traversal depth applied (0-3).",
      +          "type": "integer"
      +        },
      +        "direction": {
      +          "description": "Traversal direction applied ('callers', 'callees', or 'both').",
      +          "type": "string"
      +        },
      +        "edges": {
      +          "description": "Filtered caller/callee edges fitting within token budget.",
      +          "items": {
      +            "additionalProperties": true,
      +            "description": "Observed AST/lexical call or reference edge between symbols.",
      +            "properties": {
      +              "backend": {
      +                "description": "Extractor backend producing this edge.",
      +                "type": "string"
      +              },
      +              "confidence": {
      +                "description": "Edge resolution confidence in [0.0, 1.0].",
      +                "type": [
      +                  "number",
      +                  "null"
      +                ]
      +              },
      +              "edge_kind": {
      +                "description": "Relationship kind (e.g. calls, instantiates, inherits).",
      +                "type": "string"
      +              },
      +              "source_line": {
      +                "description": "1-based line number of the edge.",
      +                "type": "integer"
      +              },
      +              "source_path": {
      +                "description": "File path where the edge occurs.",
      +                "type": "string"
      +              },
      +              "source_symbol_id": {
      +                "description": "Caller or source symbol ID.",
      +                "type": "string"
      +              },
      +              "status": {
      +                "description": "Resolution status ('resolved', 'ambiguous', or 'unresolved').",
      +                "type": "string"
      +              },
      +              "target_name": {
      +                "description": "Target symbol name at call site.",
      +                "type": "string"
      +              },
      +              "target_symbol_id": {
      +                "description": "Resolved target symbol ID, or null if external/unresolved.",
      +                "type": [
      +                  "string",
      +                  "null"
      +                ]
      +              }
      +            },
      +            "type": "object"
      +          },
      +          "type": "array"
      +        },
      +        "node_limit_reached": {
      +          "description": "True if traversal stopped at max_nodes.",
      +          "type": "boolean"
      +        },
      +        "nodes_visited": {
      +          "description": "Total graph nodes visited during traversal.",
      +          "type": "integer"
      +        },
      +        "note": {
      +          "description": "Reminder that lexical edges form a candidate impact slice.",
      +          "type": "string"
      +        },
      +        "omitted_count": {
      +          "description": "Count of visited symbols omitted due to budget.",
      +          "type": "integer"
      +        },
      +        "omitted_edge_count": {
      +          "description": "Count of edges omitted due to budget.",
      +          "type": "integer"
      +        },
      +        "root_symbol_id": {
      +          "description": "Canonical starting symbol_id.",
      +          "type": "string"
      +        },
      +        "symbols": {
      +          "description": "Visited symbols fitting within token budget.",
      +          "items": {
      +            "additionalProperties": true,
      +            "description": "Indexed symbol definition metadata.",
      +            "properties": {
      +              "end_line": {
      +                "description": "1-based declaration end line.",
      +                "type": "integer"
      +              },
      +              "kind": {
      +                "description": "Symbol kind (function, class, method, interface, etc.).",
      +                "type": "string"
      +              },
      +              "name": {
      +                "description": "Short symbol name.",
      +                "type": "string"
      +              },
      +              "path": {
      +                "description": "Repository-relative file path.",
      +                "type": "string"
      +              },
      +              "qualified_name": {
      +                "description": "Qualified symbol name.",
      +                "type": "string"
      +              },
      +              "roles": {
      +                "description": "Detected semantic/architectural roles.",
      +                "items": {
      +                  "type": "string"
      +                },
      +                "type": "array"
      +              },
      +              "signature": {
      +                "description": "Declaration signature header.",
      +                "type": "string"
      +              },
      +              "start_line": {
      +                "description": "1-based declaration start line.",
      +                "type": "integer"
      +              },
      +              "symbol_id": {
      +                "description": "Canonical repository-scoped symbol identifier.",
      +                "type": "string"
      +              }
      +            },
      +            "type": "object"
      +          },
      +          "type": "array"
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "edge_precision": {
      +      "additionalProperties": true,
      +      "description": "Resolved vs. ambiguous edge ratio summary.",
      +      "properties": {
      +        "ambiguous_rate": {
      +          "description": "Fraction of edges marked ambiguous.",
      +          "type": [
      +            "number",
      +            "null"
      +          ]
      +        },
      +        "basis": {
      +          "description": "Measurement basis.",
      +          "type": "string"
      +        },
      +        "resolved_rate": {
      +          "description": "Fraction of edges resolved unambiguously.",
      +          "type": [
      +            "number",
      +            "null"
      +          ]
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "error": {
      +      "additionalProperties": true,
      +      "description": "Present when the tool call fails (either a structured {code, message, details} object or a diagnostic string).",
      +      "properties": {
      +        "code": {
      +          "description": "Machine-readable error code.",
      +          "type": "string"
      +        },
      +        "details": {
      +          "description": "Optional structured metadata for the error.",
      +          "type": "object"
      +        },
      +        "message": {
      +          "description": "Human-readable error explanation.",
      +          "type": "string"
      +        }
      +      },
      +      "type": [
      +        "object",
      +        "string"
      +      ]
      +    },
      +    "evidence": {
      +      "description": "Source-verified file line spans and SHA-256 hashes backing the response.",
      +      "items": {
      +        "additionalProperties": true,
      +        "properties": {
      +          "end_line": {
      +            "description": "1-based end line in source.",
      +            "type": "integer"
      +          },
      +          "path": {
      +            "description": "Repository-relative file path.",
      +            "type": "string"
      +          },
      +          "sha256": {
      +            "description": "12-character hex prefix of indexed file SHA-256.",
      +            "type": "string"
      +          },
      +          "start_line": {
      +            "description": "1-based start line in source.",
      +            "type": "integer"
      +          }
      +        },
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "freshness": {
      +      "description": "Index freshness state ('fresh', 'pending', 'stale', or 'unknown').",
      +      "type": "string"
      +    },
      +    "index_run_id": {
      +      "description": "Identifier of the active index snapshot run.",
      +      "type": [
      +        "string",
      +        "null"
      +      ]
      +    },
      +    "ledger_rev": {
      +      "description": "Current evidence ledger revision for repo_id.",
      +      "type": "integer"
      +    },
      +    "repo_id": {
      +      "description": "Registered repository identifier.",
      +      "type": "string"
      +    },
      +    "schema_version": {
      +      "description": "Envelope schema version ('1.0').",
      +      "type": "string"
      +    },
      +    "truncated": {
      +      "description": "True if items were omitted due to budget or node limits.",
      +      "type": "boolean"
      +    },
      +    "untrusted_repository_content": {
      +      "description": "True when payload embeds raw repository text.",
      +      "type": "boolean"
      +    },
      +    "warnings": {
      +      "description": "Freshness, ambiguity, redaction, or security warnings.",
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    }
      +  },
      +  "type": "object"
      +}
  2. Changed9 schema fields changedv0.3.7
    • addedInput schema / properties / depth / description
      Added value: +"Maximum AST call-graph traversal hops (0 to 3; defaults to 2 in 'impact' profile)."
    • addedInput schema / properties / direction / description
      Added value: +"Call-graph traversal direction: 'callers' (who calls this), 'callees' (what this calls), or 'both'."
    • addedInput schema / properties / filter_ambiguous / description
      Added value: +"Exclude ambiguous lexical edges that match multiple candidate targets when True."
    • addedInput schema / properties / max_nodes / description
      Added value: +"Maximum number of graph nodes to visit before truncating (1 to max_graph_nodes)."
    • addedInput schema / properties / max_tokens / description
      Added value: +"Maximum token budget for the impact slice (32 to max_result_tokens)."
    • addedInput schema / properties / min_confidence / description
      Added value: +"Minimum edge resolution confidence (0.0 to 1.0) required to include an edge."
    • addedInput schema / properties / profile / description
      Added value: +"Named budget profile ('locate', 'orient', 'impact', 'read'); defaults to 'impact'."
    • addedInput schema / properties / repo_id / description
      Added value: +"Registered repository ID from list_repositories (never a filesystem path)."
    • addedInput schema / properties / symbol_id / description
      Added value: +"Exact starting symbol_id obtained from find_symbols, get_repo_map, or search_source."
  3. Changed2 schema fields changedv0.2.0
    • addedInput schema / properties / filter_ambiguous
      Added value: +{
      +  "default": true,
      +  "title": "Filter Ambiguous",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / min_confidence
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "number"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Min Confidence"
      +}
  4. First observedv0.1.0

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already declare readOnly/idempotent/non-destructive/closed-world, so the bar is lower; the description still adds real behavioral value by warning that output is a truncated candidate slice and by naming the flag (truncated=true) and the causes (max_nodes/max_tokens). It does not discuss confidence heuristics or ambiguity propagation beyond what the schema already says.

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

Conciseness5/5

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

Two sentences, front-loaded with the core action and scope, then the truncation caveat, then the routing hint. No filler, and the densest information (hop limit, candidate-only, cap behavior) comes first.

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

Completeness4/5

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

For a 9-parameter traversal tool with an output schema and full annotation coverage, the description covers what it does, its truncation contract, and its main alternative, which is most of what an agent needs. It leaves the slice's contents to the output schema, which is acceptable, but a note on what 'candidate' implies for downstream reasoning would have made it complete.

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

Parameters3/5

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

Schema description coverage is 100%, so the baseline is 3; every parameter including depth, max_nodes, max_tokens, min_confidence and filter_ambiguous is already documented in the schema. The description only reinforces the 0-3 depth bound and ties the two caps to the truncation flag, adding marginal meaning beyond the structured fields.

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 specific verb and resource ('Traverse 0-3 hop AST caller/callee edges'), the starting anchor ('from a known symbol_id'), and the nature of the result ('candidate slice only'). It also names the sibling that handles a different edge type (get_module_dependents), so an agent can route between them without opening a schema.

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

Usage Guidelines4/5

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

Gives a clear precondition (you must already have a symbol_id) and an explicit alternative for the imports case. It stops short of a full when-not rule — e.g. it doesn't say what to use when you don't yet have a symbol_id (presumably find_symbols/search_source, per the schema).

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