Документация

Analysis & Navigation Tools

Symbol navigation, call graphs, route extraction, and code outlining

Symbol navigation, call graphs, route extraction, and code outlining

These tools leverage tree-sitter AST parsing across 18 languages to provide precise symbol navigation, call graph traversal, route extraction, and structural code outlining.

Tools Overview

ToolWhat It Does
ctx_symbol Read a specific symbol (function, struct, class) by name. Returns only the symbol code block instead of the entire file. 90-97% fewer tokens than full file read.
ctx_callgraph Unified call graph query. direction=callers|callees for a symbol. Returns file/symbol/line edges.
ctx_callers Find all symbols that call a given function/method. Deprecated alias for ctx_callgraph direction=callers.
ctx_callees Find all functions/methods called by a given symbol. Deprecated alias for ctx_callgraph direction=callees.
ctx_outline List all symbols in a file (functions, structs, classes, methods) with signatures. Much fewer tokens than reading the full file.
ctx_routes List HTTP routes/endpoints extracted from the project. Supports Express, Flask, FastAPI, Actix, Spring, Rails, Next.js.
ctx_review Automated code review: combines impact analysis, caller tracking, and test discovery. Actions: review (single file), diff-review (from git diff), checklist (structured review questions).
ctx_smells Code smell detection (Property Graph). Actions: scan|summary|rules|file. 8 rules: dead_code, long_function, long_file, god_file, fan_out_skew, duplicate_definitions, untested_function, cyclomatic_complexity. Optional: format=text|json.

ctx_symbol

ctx_symbol finds symbol definitions (functions, classes, types, constants) across the project using tree-sitter AST parsing. Returns file path, line number, and signature.

Parameters

ParameterTypeRequiredDescription
namestringYesSymbol name to search for
kindstringNoFilter by kind: function, class, type, const, etc.
filestringNoScope search to a specific file

Example

ctx_symbol name="handleRequest"
→ 2 definitions found:
  src/http/server.rs:142  fn handleRequest(req: Request) -> Response
  src/http/middleware.rs:28  fn handleRequest(req: Request, next: Next) -> Response

ctx_callers

ctx_callers finds all symbols that call a given function or method. Useful for understanding impact before refactoring.

Parameters

ParameterTypeRequiredDescription
symbolstringYesSymbol name to find callers of
filestringNoScope to a specific file

Example

ctx_callers symbol="validateToken"
→ 4 callers:
  src/http/middleware.rs:45  fn authMiddleware
  src/http/handler.rs:23    fn handleLogin
  src/api/graphql.rs:67     fn resolveUser
  tests/auth_test.rs:12     fn test_token_validation

ctx_review

ctx_review automates code review by combining impact analysis, caller tracking, and test file discovery into a single tool call. Three actions available.

Parameters

ParameterTypeRequiredDescription
actionstringYesreview | diff-review | checklist
pathstringNoFile path to review (for review/checklist) or git diff text (for diff-review)
depthintegerNoAnalysis depth (default: 3)

Actions

  • review: Full analysis - runs impact analysis, caller tracking, and finds related test files
  • diff-review: Extracts changed files from a git diff and reviews each one
  • checklist: Generates structured review questions with checkboxes based on impact and test coverage

ctx_callees

ctx_callees finds all functions/methods called by a given symbol. The inverse of ctx_callers - useful for understanding dependencies.

Parameters

ParameterTypeRequiredDescription
symbolstringYesSymbol name to find callees of
filestringNoScope to a specific file

ctx_outline

ctx_outline generates a structural outline of a file: all functions, classes, interfaces, types, and constants with their line numbers. Lighter than signatures mode - great for quick navigation.

Parameters

ParameterTypeRequiredDescription
pathstringYesFile path to outline
kindstringNoFilter by kind (function, class, type, etc.)

Example

ctx_outline path="src/auth/service.ts"
→ src/auth/service.ts (142 lines)
  L1    import { db } from '../db'
  L8    type AuthResult = { ... }
  L15   fn generateToken():string
  L28   fn async createUser(email, password, name)
  L56   fn async authenticateUser(email, password)
  L89   fn async validateSession(token)
  L112  fn async refreshToken(token)
  L130  const TOKEN_EXPIRY = 7200

ctx_routes

ctx_routes extracts HTTP routes from web frameworks (Express, Fastify, Actix, Axum, Gin, Django, etc.). Returns method, path, handler file, and line number.

Parameters

ParameterTypeRequiredDescription
pathstringNoProject path to scan (default: project root)
methodstringNoFilter by HTTP method (GET, POST, etc.)

Example

ctx_routes
→ 12 routes found:
  GET    /api/users          src/routes/users.ts:8
  POST   /api/users          src/routes/users.ts:24
  GET    /api/users/:id      src/routes/users.ts:42
  POST   /api/auth/login     src/routes/auth.ts:12
  POST   /api/auth/refresh   src/routes/auth.ts:35
  DELETE /api/auth/logout     src/routes/auth.ts:58