Skip to main content
Glama
token-context-mcp

token-context-mcp

Inspect symbol (composite)

inspect_symbol
Read-onlyIdempotent

Resolve an unknown symbol by exact or wildcard name to get a token-budgeted code context packet with status for not found, ambiguous, or full details.

Instructions

1-turn lookup by exact/wildcard name when symbol_id is unknown (use find_symbols for bulk lists, get_symbol_context by ID); returns status='not_found', 'ambiguous', or view='full' packet.

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>",
      "query": "<query>"
    },
    "name": "inspect_symbol"
  }
}

Input Schema

NameRequiredDescriptionDefault
viewNoDetail level: 'minimal' (signature + 3-tuple edges), 'normal' (adds body + edge dicts), 'full' (context packet with callers/callees/tests).normal
queryYesExact or wildcard symbol name to resolve (prefers unique exact match; returns up to 5 candidates if ambiguous).
repo_idYesRegistered repository ID from list_repositories (never a filesystem path).
budget_tokensNoTotal token cap (clamped to 256..8192); splits budget between body and relationships and sets retry_hint if body is clipped.

Output Schema

NameRequiredDescriptionDefault
dataNoComposite resolution status, target symbol metadata, optional body/packet, and direct relationships.
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.
schema_versionNoEnvelope schema version ('1.0').
untrusted_repository_contentNoTrue when payload embeds raw repository text.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv0.3.8
    • changedInput schema / properties / budget_tokens / description
      Previous value: -"Maximum token budget for the composite inspection response (32 to max_result_tokens)."New value: +"Total token cap (clamped to 256..8192); splits budget between body and relationships and sets retry_hint if body is clipped."
    • changedInput schema / properties / query / description
      Previous value: -"Symbol name, qualified name, or keyword query to resolve and inspect in one turn."New value: +"Exact or wildcard symbol name to resolve (prefers unique exact match; returns up to 5 candidates if ambiguous)."
    • changedInput schema / properties / view / description
      Previous value: -"Projection detail: 'minimal' (signatures+edges), 'normal' (adds body), or 'full' (context packet with tests)."New value: +"Detail level: 'minimal' (signature + 3-tuple edges), 'normal' (adds body + edge dicts), 'full' (context packet with callers/callees/tests)."
    • 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": "Composite resolution status, target symbol metadata, optional body/packet, and direct relationships.",
      +      "properties": {
      +        "candidate_count": {
      +          "description": "Number of matching candidates when status='ambiguous'.",
      +          "type": "integer"
      +        },
      +        "candidates": {
      +          "description": "Up to 5 disambiguation candidates when status='ambiguous'.",
      +          "items": {
      +            "additionalProperties": true,
      +            "type": "object"
      +          },
      +          "type": "array"
      +        },
      +        "content": {
      +          "description": "Target symbol body in view='normal' (null if omitted/stale).",
      +          "type": [
      +            "string",
      +            "null"
      +          ]
      +        },
      +        "message": {
      +          "description": "Guidance message when status is 'not_found' or 'ambiguous'.",
      +          "type": "string"
      +        },
      +        "packet": {
      +          "additionalProperties": true,
      +          "description": "Full context packet with target body, callers/callees, and tests when view='full'.",
      +          "type": "object"
      +        },
      +        "query": {
      +          "description": "Original symbol name or pattern query.",
      +          "type": "string"
      +        },
      +        "relationship_count": {
      +          "description": "Number of relationships included.",
      +          "type": "integer"
      +        },
      +        "relationships": {
      +          "description": "Direct 1-hop caller/callee entries (tuples in minimal, dicts in normal).",
      +          "items": {},
      +          "type": "array"
      +        },
      +        "relationships_filtered": {
      +          "description": "Count of low-confidence or ambiguous edges excluded.",
      +          "type": "integer"
      +        },
      +        "relationships_omitted": {
      +          "description": "Count of relationships omitted due to budget.",
      +          "type": "integer"
      +        },
      +        "retry_hint": {
      +          "additionalProperties": true,
      +          "description": "Follow-up get_symbol_context call parameters if body was clipped.",
      +          "type": "object"
      +        },
      +        "status": {
      +          "description": "Resolution outcome: 'resolved', 'ambiguous', or 'not_found'.",
      +          "type": "string"
      +        },
      +        "symbol": {
      +          "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"
      +        },
      +        "target_symbol_id": {
      +          "description": "Resolved canonical symbol_id (when status='resolved').",
      +          "type": "string"
      +        }
      +      },
      +      "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. Changed4 schema fields changedv0.3.7
    • addedInput schema / properties / budget_tokens / description
      Added value: +"Maximum token budget for the composite inspection response (32 to max_result_tokens)."
    • addedInput schema / properties / query / description
      Added value: +"Symbol name, qualified name, or keyword query to resolve and inspect in one turn."
    • addedInput schema / properties / repo_id / description
      Added value: +"Registered repository ID from list_repositories (never a filesystem path)."
    • addedInput schema / properties / view / description
      Added value: +"Projection detail: 'minimal' (signatures+edges), 'normal' (adds body), or 'full' (context packet with tests)."
  3. Addedv0.2.0

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare read-only, idempotent, closed-world, non-destructive semantics, so the safety profile is free; the description adds useful behavior by naming the outcome states ('not_found', 'ambiguous', view='full' packet) and the 1-turn nature of the call. It stops short of explaining what ambiguity resolution costs or how the caller should follow up on a non-unique match.

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?

One front-loaded sentence with the primary trigger first and routing second, then return outcomes. Dense and largely waste-free, though the stacked parentheticals make it slightly telegraphic to parse on first read.

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?

With an output schema present the description need not enumerate return fields, and annotations cover safety, so what remains — when to call it, how it differs from siblings, and what failure states look like — is fully supplied for a four-parameter composite lookup.

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% and the schema already spells out view levels, exact-vs-wildcard matching with a 5-candidate cap, and budget_tokens clamping. The description echoes the wildcard/exact-name semantics rather than adding syntax, matching rules, or format detail beyond it, so the baseline 3 applies.

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 ('1-turn lookup by exact/wildcard name') plus the precondition ('when symbol_id is unknown'), immediately marking the two other tools it is not and why. An agent can pick between inspect_symbol, find_symbols, and get_symbol_context from this sentence alone.

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 alternatives and their selecting conditions are given: find_symbols for bulk lists, get_symbol_context when an ID is already known. The 'when symbol_id is unknown' clause is a clean positive trigger, so the routing decision requires no inference.

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