Skip to main content
Glama

gograph_context

Read-onlyIdempotent

Fetch AST metadata, source, callers, callees, and tests for a Go symbol in one call, cutting roundtrips before you edit code. Bundle all uncommitted symbols at once.

Instructions

Fetch a pre-flight context bundle for a single Go symbol: AST node metadata, source code, direct callers, direct callees, linked test functions, and architectural role classification — all in one call. The MCP server checks freshness before this call and refreshes in the current requested analysis mode; precise and precise_fallback graphs retry CHA/SSA after source changes. Read-only analysis; an active audit session may append local command telemetry. Set uncommitted=true to bundle context for all currently modified symbols at once. WHEN TO USE: As the first call before editing a symbol — eliminates 4–5 separate tool roundtrips. NOT TO USE: For package-level orientation (use gograph_focus); for transitive blast radius (use gograph_impact). RETURNS: JSON with node (first match), nodes[] (all matches), source, callers[], callees[], tests[], test_results[], and top-level role in both text and gograph.read.v1 structured content; a missing symbol is a named error. source_error reports a partial context when indexed metadata exists but source cannot be served, also named in graph_state.read_diagnostic. With uncommitted=true, returns a contexts[] array; count:0 when no uncommitted symbols exist. Uncommitted modes compare declarations against HEAD, including selected untracked Go files. Current-graph consumers refuse incomplete comparisons, deleted declarations requiring historical caller evidence, and missing/ambiguous graph identities. Inspect changes --git REF for the declaration census; rebuild before traversing newly added symbols.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
exactNoRequire an exact symbol-name or fully-qualified-ID match in single-symbol mode.
symbolNoThe exact name, dot-notation 'graph.Graph', or ID of the symbol to retrieve context for.
uncommittedNoIf true, return context for all uncommitted modified symbols bundled in one response.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / exact
      Added value: +{
      +  "description": "Require an exact symbol-name or fully-qualified-ID match in single-symbol mode.",
      +  "type": "boolean"
      +}
  2. Changed1 schema field changed
    • changedInput schema / properties / symbol / description
      Previous value: -"The exact name or ID of the symbol to retrieve context for."New value: +"The exact name, dot-notation 'graph.Graph', or ID of the symbol to retrieve context for."
  3. First observedv1.0.0

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already declare readOnlyHint/idempotent/destructive/openWorld, and the description adds substantial context beyond them: the freshness-check-before-call behavior, precise/precise_fallback CHA/SSA retry semantics, the audit-session telemetry caveat, and the uncommitted-mode declaration-vs-HEAD comparison rules including refusal conditions. It also documents partial-failure behavior (source_error, graph_state.read_diagnostic) and named errors.

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 purpose and clearly labeled WHEN TO USE / NOT TO USE / RETURNS sections make it scannable despite its length. The opening paragraph is dense with internals (CHA/SSA retry, precise_fallback) that are less relevant to selection, adding some weight without much routing value.

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?

There is no output schema, so the description carries the full burden and meets it: it spells out the JSON return fields (node, nodes[], source, callers[], callees[], tests[], test_results[], role), the uncommitted contexts[] variant, error/partial-context states, and the git-inspection follow-up. For a tool with a batch mode and multiple failure paths, this is complete.

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 schema already defines exact, symbol, and uncommitted, making the baseline 3. The description adds value by tying uncommitted=true to a different return shape (contexts[], count:0) and to declaration-census/HEAD comparison semantics, which goes slightly beyond the schema's own wording.

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 (fetch) and resource (pre-flight context bundle for a single Go symbol) and enumerates exactly what the bundle contains: AST node metadata, source, direct callers, direct callees, tests, and role classification. It distinguishes itself from siblings by explicitly naming gograph_focus and gograph_impact as the tools for adjacent needs, so an agent can route 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?

Includes explicit WHEN TO USE ('first call before editing a symbol — eliminates 4–5 separate tool roundtrips') and NOT TO USE clauses that name the alternatives and the conditions that select them (gograph_focus for package orientation, gograph_impact for transitive blast radius). Nothing is left to inference.

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