mcp-gtags-server
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| GTAGS_MCP_ROOT | No | The project root directory. Default is the server's working directory. Override with --root or GTAGS_MCP_ROOT environment variable. | |
| GTAGS_MCP_LABEL | No | Force a specific parser label for GNU Global. Options: 'default' (native-only), 'pygments' (plugin-everything), etc. Override with --label or GTAGS_MCP_LABEL environment variable. |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
| experimental | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| find_definitionA | Find where a C/C++ symbol (function, struct, macro, typedef, enum) is defined. Use this INSTEAD of grep whenever you need a symbol's definition: an indexed lookup that returns only the definition site(s). Multiply-defined symbols (#ifdef alternates) carry each definition's guard stack. Macro-generated symbols resolve too: "sys_read", "trace_sched_switch", or a DEFINE_SPINLOCK/module_param name returns the generator invocation site (SYSCALL_DEFINE3(read, ...)), flagged resolved_via — no build needed. Definitions the index parser missed are recovered from their EXPORT_SYMBOL* site via ctags, flagged resolved_via "ctags:...". On a miss the envelope carries "suggestions": defined symbols starting with the queried name. JSON records: {symbol, path, line, col, kind, typeref, scope, signature, guard, snippet} — kind/typeref/scope/signature are ctags metadata when available; guard is the enclosing #if/#ifdef stack, outermost first, [] = unconditional. Args: symbol: Exact symbol name, e.g. "tcp_v4_rcv". case_insensitive: Match ignoring case. active_config: Kernel .config path or macro list like "CONFIG_SMP,BITS_PER_LONG=64,!CONFIG_DEBUG"; drops definitions whose guard stack is definitely false under it (count reported as config_filtered). Unknown macros never drop anything. |
| find_referencesA | Find all call/usage sites of a C/C++ symbol. Use this INSTEAD of grep for "who calls/uses this?": only real reference sites from the index, each with its #if/#ifdef guard stack. Symbols with no in-tree definition (libc calls, some variables) work too — the query falls back to symbol-usage records, flagged "fallback": "symbol_usages". Args: symbol: Exact symbol name. case_insensitive: Match ignoring case. active_config: Kernel .config path or macro list; drops references whose guard stack is definitely false under it (config_filtered). |
| get_symbol_bodyA | Return the full source of a symbol's definition — just the body. Use this INSTEAD of reading a whole file to see how a function, struct, or macro is implemented: it extracts only the definition's lines, so a one-screen function never costs a 5000-line file read. Macro-generated and parser-missed (EXPORT_SYMBOL-recovered) definitions resolve too, flagged resolved_via. JSON results: {path, line, body} items. Args: symbol: Exact symbol name. max_definitions: Return at most this many bodies when the symbol is multiply defined (default 3). |
| find_callersA | Find the FUNCTIONS that call a symbol, deduplicated, with call counts. Use this INSTEAD of find_references when you want the call graph rather than raw match lines: each reference is mapped to its enclosing function. The highest signal-to-noise "who uses this?" view; iterate it to walk the caller graph upward. JSON results: {caller, path, sites} items. Args: symbol: Exact symbol name whose callers you want. |
| summarize_referencesA | Per-file reference counts for a symbol — the cheapest wide view. Use this FIRST for very widely used symbols (thousands of references): one line per file, sorted by count, shows where usage concentrates; then drill in with find_references or find_callers. JSON results: {path, count} items plus total_references. Args: symbol: Exact symbol name. |
| find_calleesA | What functions does this function CALL? (the outgoing call graph) Use this to see a function's dependencies without reading any file: call sites are detected in its body and verified against the index. Macro-generated and parser-missed (EXPORT_SYMBOL-recovered) definitions resolve too, flagged resolved_via. JSON results: {in_tree: [{symbol, path, line}], external: [names]}. Args: symbol: Exact name of the function to analyze. |
| reachabilityA | Does FROM transitively call TO — and through which call chain? Use this instead of chaining find_callers rounds when the question is "can this function end up in that one?". BFS over the caller graph returns the SHORTEST chain, each hop with the call site's file:line. JSON results: {path_found, hops, depth, nodes_explored}; hops run from from_symbol to to_symbol. Static analysis cannot follow function pointers (ops structs, callbacks). Args: from_symbol: The caller end ("can this reach ..."). to_symbol: The callee end ("... this function?"). max_depth: Longest chain to consider, in calls (1-12, default 8). |
| blast_radiusA | Which functions are impacted by a change? (refactoring blast radius) Use this after editing or before merging: maps every line of
Args:
git_ref: Diff base for |
| symbol_infoA | One-shot overview card for a symbol — the best FIRST query. One call returns where a symbol is defined, WHAT it is (kind, signature, scope), under WHICH #ifdef guards each definition lives (guard_variants
Args: symbol: Exact symbol name. active_config: Kernel .config path or macro list; definitions whose guard stack is definitely false under it are dropped (config_filtered). |
| list_file_symbolsA | List every symbol defined in one source file. Use this INSTEAD of reading a file when you only need its API surface — the functions, structs, and macros it defines — as a compact list with ctags metadata and #ifdef guard stacks when available. Args: file_path: Source file, relative to the project root or absolute. |
| update_indexA | Synchronously refresh the index — the guaranteed-freshness barrier. Query tools refresh the index automatically in the background, so results can lag very recent edits by a few seconds. Call this right after editing files when the very next query must see the changes. Args: full: Rebuild the index from scratch instead of refreshing it incrementally (rarely needed — large branch switch, suspected corruption). |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 11 tools
Each tool has a clearly defined purpose, with distinct focuses: blast_radius on change impact, find_callees/find_callers on call graph, find_definition on definition sites, etc. Some slight overlap exists between blast_radius and reachability, but descriptions adequately differentiate them.
All tool names use lowercase with underscores, predominantly following a verb_noun pattern (e.g., find_definition, list_file_symbols). A few names like blast_radius and reachability are noun phrases but still consistent with the underscore style.
11 tools is well-suited for a code analysis server. Each tool serves a specific, non-redundant purpose, covering search, definitions, references, call graphs, impact analysis, and index management without being overwhelming.
The tool surface covers the core needs of static C/C++ analysis: definitions, references, callers/callees, symbol info, file symbols, and impact analysis. Missing features like direct file reading or documentation retrieval are minor gaps for the intended use case.