# sqry MCP tool index

sqry exposes its AST-based code graph to AI assistants through the Model Context
Protocol. The `sqry-mcp` binary runs over stdio. In standalone mode it serves
**38 tools**; attached to the `sqryd` daemon (`sqry-mcp --daemon`) it serves a
**16-tool subset** from a warm, preloaded graph with zero rebuild cost.

All tools are read-only except `rebuild_index`. The authoritative, always-current
list is served by the running server: call `tools/list`, run
`sqry-mcp --list-tools`, or read the `sqry://meta/manifest` resource. This page
mirrors that list for the current release.

Client setup: `sqry mcp setup --tool claude|codex|gemini`, or configure your MCP
client to launch `sqry-mcp` with `SQRY_MCP_WORKSPACE_ROOT` set to the absolute
project root. See [/install.md](https://sqry.dev/install.md) and
[/docs/mcp/](https://sqry.dev/docs/mcp/).

## Search and query

- **semantic_search** - Search symbols by name, kind, visibility, and language. C indirect-call precision adds the C-scoped predicates `address_taken:`, `resolved_via:`, and `callsite_promiscuous:`. For incremental cache behaviour and structural-IR query authoring, prefer `sqry_query`.
- **hierarchical_search** - Search symbols with results grouped by file and container for RAG.
- **pattern_search** - Find symbols by substring match on name.
- **sqry_query** - Execute a structural query via the sqry-db planner: parses a predicate-chain text syntax (`kind:function has:caller ...`), runs it against the unified graph, and returns matching nodes with file and line metadata.
- **relation_query** - Query callers, callees, imports, exports, or returns for a symbol.

## Callers, callees, and call paths

- **direct_callers** - Find immediate callers of a symbol (depth 1).
- **direct_callees** - Find immediate callees of a symbol (depth 1).
- **call_hierarchy** - Get the call hierarchy as a tree (incoming or outgoing).
- **trace_path** - Find ranked call paths between two symbols, with cross-language support.

## Graph analysis

- **show_dependencies** - Show the dependency tree for a file or symbol.
- **dependency_impact** - Analyze what would break if a symbol is changed or removed (reverse dependency analysis).
- **find_cycles** - Find circular dependencies in calls, imports, or modules.
- **is_node_in_cycle** - Check if a specific symbol participates in a cycle.
- **find_unused** - Find unreachable or unused symbols.
- **find_duplicates** - Find duplicate functions, signatures, or structs.
- **cross_language_edges** - List cross-language call edges where caller and callee languages differ.
- **subgraph** - Extract a focused subgraph around seed symbols for RAG retrieval.
- **export_graph** - Export a dependency subgraph as JSON, DOT, D2, or Mermaid.
- **get_graph_stats** - Get node, edge, and file counts and a language breakdown.
- **complexity_metrics** - Estimate function complexity from the call graph and line count.
- **get_insights** - Get codebase health metrics including cycle and quality indicators.

## Similarity

- **search_similar** - Find symbols similar to a reference symbol using fuzzy name matching.
- **structural_similar** - Find functions structurally similar to a reference function via the identifier-blind body-shape descriptor (control-flow shape plus MinHash); reports exact `shape_hash` identity plus approximate Jaccard. Distinct from name-based `search_similar`.

## Change analysis

- **semantic_diff** - Compare symbol-level changes between git refs.

## Rules and specialized analysis

- **rules_run** - Run a declarative rule-layer rule or pack against the workspace graph: resolves a shipped rule or pack by stable id, or a TOML rule pack by workspace path, runs the rule engine, and returns each rule's structured output plus witness.
- **context_propagation** - Detect Go call-sites that leak `context.Context` propagation. Modes: `break_site` (sync), `unthreaded_goroutine` (`go f()`), `http_handler_leak` (`http.HandlerFunc` shape).

## Symbols, definitions, and references

- **explain_code** - Explain a symbol with optional context and relations.
- **get_definition** - Find where a symbol is defined.
- **get_references** - Find all references to a symbol.
- **get_hover_info** - Get a symbol's signature, documentation, and type info.
- **get_document_symbols** - Get all symbols (functions, classes, and so on) defined in a specific file.
- **get_workspace_symbols** - Search symbols by name across the workspace.

## Index and workspace

- **get_index_status** - Get the current status and metadata of the symbol index.
- **workspace_status** - Return the aggregate workspace index status, with workspace identity and structure projection.
- **rebuild_index** - Rebuild the code graph index from source files. (The only non-read-only tool.)
- **list_files** - List indexed files, optionally filtered by language.
- **list_symbols** - List indexed symbols, filterable by kind and language.
- **expand_cache_status** - Get the status of the Rust macro-expansion cache (`.sqry/expand-cache/`).

## Daemon-hosted subset (16 tools)

When `sqry-mcp` runs with `--daemon`, it serves these tools from the daemon's
warm graph state:

`semantic_search`, `relation_query`, `structural_similar`, `show_dependencies`,
`rebuild_index`, `export_graph`, `trace_path`, `subgraph`, `dependency_impact`,
`semantic_diff`, `find_cycles`, `find_unused`, `is_node_in_cycle`,
`direct_callers`, `direct_callees`, `complexity_metrics`.

See [/docs/daemon/](https://sqry.dev/docs/daemon/) for daemon setup and
[/docs/mcp/redaction/](https://sqry.dev/docs/mcp/redaction/) for response
redaction.
