callgraph
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| CALLGRAPH_LANG | No | Set to hu for Hungarian output; English is the default. | en |
| CALLGRAPH_NEXT | No | Set to 1 to allow results to end with a suggested next-step line; equivalent to callgraph mcp --next. | 0 |
| CALLGRAPH_COUNT | No | Set to 0 to turn off the anonymous daily usage count (version, platform and new/weekly/monthly flags; no ID, no IP stored). DO_NOT_TRACK=1 does the same. | 1 |
| CALLGRAPH_STATS | No | Set to 0 to turn off local usage statistics. | 1 |
| CALLGRAPH_STRICT | No | Set to 1 to make show, locate and profile exit with code 3 when a file they read has a syntax error. | 0 |
| CALLGRAPH_NO_GRAPH | No | Set to 1 to run without the project map for layer classification. | 0 |
| CALLGRAPH_GITIGNORE | No | Set to 0 to map files that .gitignore excludes for the MCP server and the hook; .callgraphignore and the built-in skipped folders still apply. | 1 |
| CALLGRAPH_TELEMETRY | No | Set to 0 as a hard off switch for telemetry (telemetry is opt-in and off unless you turn it on). | |
| CALLGRAPH_SIGNATURES | No | Set to 1 to print the signature (params, return type) on outline method lines. | 0 |
| CALLGRAPH_UPDATE_CHECK | No | Set to 0 to turn off all update checks, including the MCP server's update check. | 1 |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
Which tool for what: plain text search (an exact string, log message, config value) → Grep, it is the best at
that; "where do I start with this task?" → locate; definitions, structure, callers, impact → callgraph (outline,
method_body, find_callers, depth).
The first call of a task: give locate the names and domain terms of the task in ONE call: function, class,
property and file names, columns, routes, translation keys, and for a non-English domain word its English code name too (e.g.
visszatérítés → refund). It answers from the project map without reading files: the top 5 files (all: true: every
match), each with its reasons (exact definition, file name, name part, string, call, callers: N). Continue on
those files with the outline / method_body / find_callers.
Recipes: bug fix = locate → outline of the top file → method_body of the method. "Who calls it / what breaks" =
the name pattern with find_callers and depth 2 → method_body of the calling method. Unfamiliar project = project_profile →
locate → outline. "Where is this text / constant" = search (strings) / search (constants) (exact text: Grep).
callgraph (callgraph mcp): AST-based, token-efficient code map (PHP, Rust, JS / TS / Vue, Swift, Python, Go, SCSS); the CLI's
queries as read-only tools, with the same output. Use it before reading a code file. Paths are relative to the project
root: a registered alias (project, list: projects) or the server's working directory. Typical flow: locate
(where to start) → outline → method_body for just the method you need → find_callers with the name pattern.
locate{terms}: where to start with a task (see above): ranked files with reasons, from the names and terms of the task in one call;all: true= every match, not just the top 5.outline{path}: structure of a file or directory: classes / components, methods with line ranges, calls by category. Start here.method: one method's call graph;format:api,flow(branches),summary,hotspots.method_body{path, method}: line-numbered source;methodis a name or a list (["store", "update"]). Compact by default (docblock above and blank lines dropped, comments kept, line numbers exact);doc: trueadds the docblock,raw: truegives the exact text.find_callers{pattern}: who calls it (file, method, line range, call line);pathnarrows the scope,depth2–5 = impact analysis (callers of callers),guess: trueadds name-only matches. JS / TS / Vue keys:useForm.js::submit(export),route::orders.show,i18n::orders.title,vue::emit:save,Atoms/AtomButton.vue.search{kind: strings | constants, pattern}: where a string literal (error message, key) or a constant is.framework_view{view, path}:routes,middleware,validation,jobs,events,providers,magic,di,viewsof a directory.notes: notes left on files / methods (📝, read-only).guide: this manual in full (CLI examples, languages).next{result_id, choice}: when the server runs withcallgraph mcp --next, some results end with↪ r7 possible next: [1] … [2] …(read-only navigation); run one by number (choice: 1or[1, 3]), only if it fits your task; otherwise ignore the line. Output is capped at 400 lines (directory → summary, file → method index, search → 1 line per match): narrowpath,methodorpatternfirst;full: trueonly when justified.
Finding callers: start with the name pattern (^|::|\.|->)name$. It catches every call, also where the receiver
type is unknown, inherited or comes from a trait. Type::method finds only the calls resolved to that type (plus
calls through its interface / parent / trait), so it can miss callers; use it to narrow a noisy common name
(save, find, get).
Reading search output (find_callers, depth, search (strings), search (constants), directories):
First line
root: /abs/path: every path after it is relative to that project root; pass them back as they are (with the sameproject).L25 │ $this->repo->find($id): the call's own source line. You don't needmethod_bodyjust to see how something is called, only for the full logic.via Resolver: the call goes through an interface, parent class or trait of the searched type.L12, L40 │ …: the same call on several lines; at most 3 rows per caller, then… +2 more: L55, L61.?/?::name: the receiver type is unknown, a name-only match; it may be wrong, check the line.🔒after a file path: the file is protected; read it, don't edit it.
Static analysis: dynamic calls ($this->$method(), obj[key]()), magic methods and class names / registered components
assembled at runtime cannot be resolved. They are marked dynamic_call in the outline (PHP, JS / TS / Vue, Python;
listed last, the target is the called expression): not a caller edge, so find_callers / depth / locate ignore it —
depth only notes how many callers contain one ("check them by hand"). By default depth follows only the certain (resolved) callers;
name-only matches are shown by guess: true with a "?" mark. For the exact control logic you need method_body (compact, comments kept; raw: true gives the exact text).
A ⚠ syntax error line means a file did not parse fully: the result may be incomplete — read that file directly.
Project profile of the working directory (from folder and file names; details: project_profile; narrow a query to one layer with layer):
profile: SwiftUI MVVM (Views → ViewModels) · confidence: medium
layers (files):
command src/cli/commands (+2 more) 27
model src/model (+2 more) 15
component golden/samples/js 2
view (rust) src/notes (+1 more) 2
handler golden/samples/rust/src 1
route src/query/format/framework 1
store golden/samples/swift 1
view (swift) golden/samples/swift 1
viewmodel golden/samples/swift 1
… +3 more layers (profile --full)
patterns: Command / Handler (28: src/cli/commands), Adapter (3), Strategy (2), Builder (1)
unknown: src/query/format (22 files), src/profile (19 files), src/lang/js (15 files), +63 more folders
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| find_callersA | Who calls it: file, method, line range and the call's own line ( |
| framework_viewA | Framework view of a directory: routes, middleware, validation, jobs, events, providers, magic, di, views. Example: {"view": "routes", "path": "routes"}. Run it on the directory that holds the definitions (a file works too). |
| guideA | The full callgraph manual (the skill's SKILL.md in the configured language): every query with CLI examples, JS/TS/Vue, Rust, Swift, Python and Go specifics, formats, limits. Call it once when the server instructions are not enough; the CLI flags map to these tools (see its MCP section). |
| locateA | Where to start with a task: give the names and domain terms from the task in ONE call; answers from the project map (no file reading) with a short ranked list of files (top 5; |
| method_bodyA | Line-numbered source of one or more methods/functions, compact: the docblock above the method and blank lines dropped, comments inside the body kept (line numbers stay exact; the header says when a docblock was omitted; |
| nextA | Run a suggested next step by its number instead of composing the call: some results end with |
| notesA | Notes (pilot) attached to files or methods by people/agents: |
| outlineA | Structure of a code file or directory without reading it: classes/components, methods with line ranges, calls by category. With |
| project_profileA | Project profile from folder and file names, checked against the code graph: architecture (Laravel/Yii layered MVC, DDD/hexagonal, Vue/React frontend, SwiftUI MVVM, Rust web), layers with their folders and file counts, design patterns, the call direction between layers, unknown folders (~15 lines). Call it first in an unfamiliar project, then pass |
| projectsA | Registered project aliases and their roots (for the |
| searchA | Where a string literal (error message, key) or a constant is used/defined (substring match). Example: {"kind": "strings", "pattern": "Order not found"} or {"kind": "constants", "pattern": "STATUS_ACTIVE"}. For calls of a function use |
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
Most tools target a clearly distinct question (who calls X vs. what's inside X vs. where do I start), and descriptions explicitly cross-reference each other ('For calls of a function use find_callers', 'Start here once you know the file (else locate)'). The residual overlaps are directory-level inspection (outline vs. framework_view) and symbol lookup (locate vs. search by strings/constants), which a careful agent could still confuse on a first pass.
Names are readable but mix conventions: verb-style (find_callers, locate, search) alongside bare nouns (outline, notes, next, guide, projects) and compound nouns (framework_view, project_profile, method_body). There is a loose theme but no predictable verb_noun pattern, and closely related tools (projects vs. project_profile) differ only by a suffix.
Eleven tools is well within a comfortable range and each maps to a real step in code exploration (project setup, orientation, localization, structure, bodies, callers, text search, help). No obvious filler tools; guide and next are thin but justified as meta-helpers.
The exploration lifecycle is largely covered: project registration/profile, symbol location, structural outline, method bodies, caller/impact analysis, and literal search, plus framework-specific views. Gaps are minor: no explicit callees/downstream-call tool (partly covered by outline with method), and notes are read-only with writes only via the CLI.