Skip to main content
Glama

gograph_context

Read-onlyIdempotent

Fetch a pre-flight context bundle for one Go symbol: AST metadata, source, direct callers, callees, linked tests, and architectural role in a single read-only call before editing.

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. Traversal consumers refuse deleted declarations requiring historical caller evidence. Review instead includes changes --git HEAD declaration evidence and names unavailable historical callers, tests and risk. Incomplete comparisons and missing/ambiguous current identities remain errors. Rebuild before traversing newly added symbols.

Input Schema

NameRequiredDescriptionDefault
rootNoAbsolute path of the checkout you are working in (your cwd or git worktree). Must be this server's repository or one of its git worktrees; the answer then comes from that checkout's own graph. A path elsewhere is refused. Alias: cwd. Omit only when the configured checkout is the one you mean.
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.
intentionNoTechnical rationale, required for analytical calls selecting an active session.
session_idNoCaller selector returned by session_create. Omission means an independent caller; never inherits server environment or another caller's session.
uncommittedNoIf true, return context for all uncommitted modified symbols bundled in one response.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv1.7.18
    • addedInput schema / properties / intention
      Added value: +{
      +  "description": "Technical rationale, required for analytical calls selecting an active session.",
      +  "type": "string"
      +}
    • addedInput schema / properties / root
      Added value: +{
      +  "description": "Absolute path of the checkout you are working in (your cwd or git worktree). Must be this server's repository or one of its git worktrees; the answer then comes from that checkout's own graph. A path elsewhere is refused. Alias: cwd. Omit only when the configured checkout is the one you mean.",
      +  "type": "string"
      +}
    • addedInput schema / properties / session_id
      Added value: +{
      +  "description": "Caller selector returned by session_create. Omission means an independent caller; never inherits server environment or another caller's session.",
      +  "type": "string"
      +}
  2. 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"
      +}
  3. 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."
  4. First observedv1.0.0

TDQS

A4.4/5.0
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint, and destructiveHint=false, so the safety profile is given. The description still adds real behavioral context beyond them: freshness checking/refresh of precise and precise_fallback graphs, possible local command telemetry during an active audit session, partial-context source_error with graph_state.read_diagnostic, and refusal to traverse deleted declarations. Some of this is dense jargon (CHA/SSA retry) rather than actionable agent guidance, so it stops short of the top score.

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?

Strongly front-loaded: purpose first, then WHEN TO USE, NOT TO USE, and RETURNS sections. The RETURNS block, however, is a wall of run-on edge-case clauses ('Traversal consumers refuse deleted declarations requiring historical caller evidence', 'Incomplete comparisons and missing/ambiguous current identities remain errors') that cost more parsing effort than they repay.

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, so the description carries the return contract itself and does so thoroughly: node/nodes[], source, callers[], callees[], tests[], test_results[], role in text and gograph.read.v1, the contexts[] variant, and the named error/diagnostic paths. It also flags the rebuild prerequisite for newly added symbols, leaving little an agent needs before calling.

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 description coverage is 100%, so the baseline is 3; the description still adds meaning the schema does not — uncommitted=true compares declarations against HEAD including selected untracked files and returns a contexts[] array with count:0 when nothing is modified, and it notes that missing symbols are named errors while exact controls matching strictness. root/session_id/intention semantics 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?

Opens with a specific verb and resource ('Fetch a pre-flight context bundle for a single Go symbol') and enumerates exactly what the bundle contains (AST metadata, source, callers, callees, tests, role classification). This is clearly distinguishable from siblings like gograph_node or gograph_source that return single facets.

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?

Explicit 'WHEN TO USE: As the first call before editing a symbol — eliminates 4–5 separate tool roundtrips' plus a 'NOT TO USE' clause that names the correct alternatives and their conditions (gograph_focus for package orientation, gograph_impact for transitive blast radius). Routing is fully determined.

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