Cross-Language
Overview
Modern codebases rarely live in a single language. A typical service might have TypeScript on the frontend calling a Python API, which in turn writes to SQL tables, while a performance-critical path calls into a C library via Rust FFI.
sqry’s unified graph detects these cross-language relationships automatically during indexing. The detection runs in Pass 5 of the multi-pass graph build pipeline, after all per-language symbol graphs are constructed. sqry matches declarations in one language to definitions in another — for example, matching a Rust extern "C" declaration to the corresponding C function definition, or matching a fetch("/api/users") call in TypeScript to a @app.route("/api/users") handler in Python.
Cross-language relationships are first-class edges in the graph and are available through graph commands, visualization/export, and the cross_language_edges MCP tool.
Supported Edge Types
| Graph edge kind | CLI --edge-type filter | Example | Languages |
|—|—|—|
| FfiCall | ffi | Rust extern "C" declaration matched to C/C++ function definition | Rust → C, Rust → C++, C → C++ |
| HttpRequest | http | fetch("/api/users") or axios.post("/users") matched to route handler | JS/TS → Python, JS/TS → Go, JS/TS → Java |
| GrpcCall | not exposed by graph cross-language --edge-type | gRPC stub call matched to service method definition | Any client → any server language |
| TableRead / TableWrite | table_read, table_write | SQL reads/writes referencing a named table | SQL → table definition or table-use node |
| WebSocket | not exposed by graph cross-language --edge-type | WebSocket emit/on matched across client and server | JS/TS ↔ Python, JS/TS ↔ Go |
| GraphQLOperation | not exposed by graph cross-language --edge-type | GraphQL query/mutation matched to resolver | JS/TS, Python |
| MessageQueue | not exposed by graph cross-language --edge-type | Message producer matched to consumer by topic/queue name | Any language |
| ProcessExec | not exposed by graph cross-language --edge-type | Shell exec/spawn calls referencing an external binary or script | Shell/Bash → any |
Detection is heuristic-based and works on naming conventions, route strings, and extern declarations. Accuracy improves when codebases follow standard framework patterns (Express, FastAPI, Gin, Spring MVC, etc.).
For C and C++, indirect (function-pointer) calls are resolved into the call graph rather than being dropped. Each recovered edge carries resolved_via provenance recording how it was matched — direct for ordinary calls, type_match for type-based recovery, and binding_plane for function-pointer / indirect calls. Filter on it with the resolved_via:<kind> predicate, for example sqry query "callers:my_read resolved_via:binding_plane lang:c".
Additional edge types
Beyond the primary types above, sqry also detects:
| Edge type | Description |
|---|---|
file_ipc | File-based inter-process communication (shared files, pipes) |
protocol_call | Generic protocol-based calls not covered by specific types |
web_assembly_call | WebAssembly module imports and exports |
FFI detection by language
sqry detects FFI boundaries for 11 languages. See Language Support — FFI Support for the complete list of supported mechanisms per language (e.g., Rust extern "C", Go CGo, Java JNI/JNA, Python ctypes/cffi).
CLI Queries
List all cross-language edges in the current workspace:
sqry graph cross-language
Filter by source language and edge type:
# All FFI calls originating from Rust
sqry graph cross-language --from-lang rust --edge-type ffi
# All SQL table access edges
sqry graph cross-language --from-lang sql --edge-type table_read
sqry graph cross-language --from-lang sql --edge-type table_write
# All HTTP calls from TypeScript to any backend
sqry graph cross-language --from-lang ts --edge-type http
# Flutter/Dart platform channel invocations
sqry graph cross-language --from-lang dart --edge-type channel_invoke
Combine with visualization to produce a cross-language dependency diagram:
sqry visualize "callers:main" --format mermaid
sqry export --format dot --output-file cross-lang.dot
MCP Tool
The cross_language_edges MCP tool exposes cross-language relationship data to AI assistants via the Model Context Protocol. It is available to any MCP client (Claude, Codex, Gemini, Cursor, Windsurf) connected to a running sqry mcp server.
The tool returns a structured list of cross-language edges, each with:
- Source symbol and language
- Target symbol and language
- Edge type (
FfiCall,HttpRequest,TableRead,TableWrite, etc.) - File locations for both sides
This lets an AI assistant answer questions like “what Python routes does the TypeScript frontend call?” or “which C functions are exposed to Rust via FFI?” with ground-truth data from the graph, rather than guessing from code patterns.
The cross_language_edges tool can be enabled or disabled independently using the SQRY_MCP_ENABLE_CROSS_LANGUAGE environment variable:
# Disable cross-language edges in the MCP server (all other tools unaffected)
export SQRY_MCP_ENABLE_CROSS_LANGUAGE=false