MCP Tools
sqry exposes 33 tools over MCP. Every tool returns a JSON payload with version, data, and execution_ms fields wrapped in the standard MCP content array. Use tools/list or sqry-mcp --list-tools to retrieve the authoritative parameter schema at runtime.
Semantic Search
semantic_search
Fuzzy, typo-tolerant symbol search with structured filters and pagination.
Key parameters: query (string), limit (int), kind (function/class/method/…), async (bool), visibility (public/private/…), lang (rust/typescript/…), file (path or regex)
Example: Find all public async functions whose name contains “auth”:
{ "query": "kind:function AND async:true AND visibility:public AND name~=/auth/" }
hierarchical_search
RAG-optimized search that returns results grouped by file → container → symbol. Useful when an AI needs to build a structured context window.
Key parameters: query, maxFiles, maxSymbolsPerFile, maxTotalSymbols, includeContainerContext, languages, symbolKinds, scoreMin
Example: { "query": "payment validation", "maxFiles": 5, "maxSymbolsPerFile": 10 }
search_similar
Find symbols that are semantically similar to a reference symbol using fuzzy matching.
Key parameters: filePath, symbolName, maxResults, similarityThreshold
Example: { "filePath": "src/auth/service.ts", "symbolName": "authenticate", "similarityThreshold": 0.75 }
pattern_search
Substring or wildcard match on symbol names. Faster than semantic search for exact-prefix or suffix queries.
Key parameters: pattern (supports * for any sequence, ? for a single character), limit
Example: { "pattern": "*Handler", "limit": 50 }
Code Understanding
explain_code
Return a symbol’s signature, documentation, callers, and callees in a single response.
Key parameters: filePath, symbolName, includeContext (bool), includeRelations (bool)
Example: { "filePath": "src/auth.ts", "symbolName": "validateToken", "includeContext": true }
relation_query
Query any relation type for a target symbol: callers, callees, imports, exports, or returns.
Key parameters: relation (callers/callees/imports/exports/returns), target, limit
Example: { "relation": "callers", "target": "processUser", "limit": 20 }
show_dependencies
Return the dependency tree for a file or symbol up to a configurable depth.
Key parameters: filePath, symbolName (optional), maxDepth, maxResults
Example: { "filePath": "src/payment/service.ts", "maxDepth": 3 }
dependency_impact
Reverse-dependency analysis: given a symbol, return all symbols that would be affected if it changed.
Key parameters: symbol, maxDepth, includeIndirect (bool)
Example: { "symbol": "UserRepository", "includeIndirect": true, "maxDepth": 4 }
Navigation
get_definition
Look up the definition location of a symbol — equivalent to LSP go-to-definition.
Key parameters: symbol or filePath + line + character
Example: { "symbol": "authenticate" }
get_references
Return all reference locations for a symbol across the workspace.
Key parameters: symbol, limit
Example: { "symbol": "UserService", "limit": 100 }
get_hover_info
Return hover information (signature, type, documentation) for a symbol at a file position.
Key parameters: filePath, line, character
Example: { "filePath": "src/api/routes.ts", "line": 42, "character": 15 }
get_document_symbols
List all symbols defined in a specific file.
Key parameters: filePath
Example: { "filePath": "src/models/user.ts" }
get_workspace_symbols
Search for symbols by name across the entire indexed workspace.
Key parameters: query, limit
Example: { "query": "PaymentService", "limit": 10 }
Call Hierarchy
call_hierarchy
Return a call hierarchy tree rooted at a symbol, traversing callers or callees to a configurable depth.
Key parameters: symbol, direction (incoming/outgoing), maxDepth
Example: { "symbol": "checkout", "direction": "incoming", "maxDepth": 3 }
direct_callers
Single-hop callers only — faster than call_hierarchy when depth-1 is sufficient.
Key parameters: symbol, limit
Example: { "symbol": "validatePayment", "limit": 25 }
direct_callees
Single-hop callees only.
Key parameters: symbol, limit
Example: { "symbol": "processOrder", "limit": 25 }
Graph Operations
export_graph
Export a subgraph as DOT, D2, Mermaid, or JSON for visualization or external tooling.
Key parameters: format (json/dot/d2/mermaid), filePath, symbolName, maxDepth, maxResults, includeCalls, includeImports, verbose
Example: { "format": "mermaid", "symbolName": "AuthService", "maxDepth": 2 }
subgraph
Extract a focused subgraph around one or more seed symbols, including their immediate callers and callees.
Key parameters: symbols (array), maxDepth, maxNodes, includeCallers, includeCallees, includeImports
Example: { "symbols": ["UserService", "AuthService"], "maxDepth": 2, "maxNodes": 30 }
trace_path
Find all call paths between two symbols. Useful for understanding how control flows from an entry point to a target function.
Key parameters: fromSymbol, toSymbol, maxHops, maxPaths, minConfidence, crossLanguage
Example: { "fromSymbol": "handleRequest", "toSymbol": "writeDatabase", "maxHops": 6 }
cross_language_edges
List edges that cross language boundaries (e.g., a Python module calling a Rust extension, or a TypeScript file importing a Go-compiled WASM module).
Key parameters: sourceLanguage, targetLanguage, sortOrder (alphabetical/byFrequency/byRelevance), limit, offset
Example: { "sourceLanguage": "python", "targetLanguage": "rust", "sortOrder": "byFrequency" }
Introspection
list_files
List all files in the index, optionally filtered by language.
Key parameters: path, offset, limit
Example: { "limit": 100, "offset": 0 }
list_symbols
List indexed symbols, optionally filtered by kind.
Key parameters: kind (function/class/method/…), offset, limit
Example: { "kind": "class", "limit": 50 }
get_graph_stats
Return aggregate graph statistics: total nodes, total edges, total files, breakdown by symbol kind, and breakdown by language.
Key parameters: path (optional, scope to a subdirectory)
Example: { } — returns stats for the entire workspace.
get_insights
Return codebase health indicators: language distribution, symbol kind distribution, cycle count, unused symbol count, duplicate group count, and cross-language edge count.
Key parameters: path (optional)
Example: { } — returns a full health summary.
complexity_metrics
Return cyclomatic complexity and line counts for symbols, sorted by complexity.
Key parameters: target (file path or symbol name, optional), minComplexity, sortByComplexity, maxResults
Example: { "minComplexity": 10, "maxResults": 20 } — list the 20 most complex symbols with complexity ≥ 10.
Analysis
find_duplicates
Detect duplicate symbol bodies by comparing hashes. Returns groups of symbols that share identical implementations.
Key parameters: duplicateType (currently "body"), limit
Example: { "limit": 50 }
find_cycles
Detect cycles in call graphs, import graphs, or module graphs.
Key parameters: circularType (calls/imports/modules), limit, shouldIncludeSelfLoops
Example: { "circularType": "imports", "shouldIncludeSelfLoops": false }
find_unused
Detect dead code — symbols with no incoming references within the indexed workspace.
Key parameters: scope (all/public/private/function/struct), limit
Example: { "scope": "public", "limit": 100 }
is_node_in_cycle
Check whether a specific symbol participates in a cycle and optionally return the cycle path.
Key parameters: symbol, cycleType (calls/imports/all), showCycle (bool)
Example: { "symbol": "OrderService", "cycleType": "calls", "showCycle": true }
Index & Diff
get_index_status
Return index metadata: file path, symbol count, edge count, last-built timestamp, and format version.
Key parameters: path (optional)
Example: { } — returns status for the current workspace index.
rebuild_index
Trigger a full rebuild of the unified graph index for the workspace.
Key parameters: path (optional)
Example: { } — rebuilds the index in the current workspace root.
semantic_diff
Compare semantic changes between two git refs. Returns added, removed, modified, renamed, and signature-changed symbols — not raw text diffs.
Key parameters: base.ref, base.filePath (optional), target.ref, target.filePath (optional), filters.changeTypes, filters.symbolKinds, includeUnchanged, maxResults
Example: { "base": { "ref": "main" }, "target": { "ref": "feature-branch" }, "filters": { "changeTypes": ["added", "removed"] } }
Natural Language
sqry_ask
Translate a natural language query into a sqry command. Responds with an execute, confirm, disambiguate, or reject result along with the translated command and confidence score.
Key parameters: query (string)
Example: { "query": "find all public functions that return a Promise" } — returns the equivalent structured sqry query.