Tool
query
Answer questions about your code as data. query runs SQL over the index, so you can count, list, join and compare files and declarations without opening them one by one.
| If you | Use |
|---|---|
| Want a count, a list, a ranking or a comparison | query |
| Can describe a behaviour but don’t know where it lives | explore |
| Already know the file or declaration | read |
| Need several steps where each depends on the last | execute |
Start from the views
The index is exposed as tables you can query with DuckDB SQL. Most questions start from four views:
Files: one row per indexed file, with its path, size, headline and token count.Functions: functions, methods, constructors and other members of types, with their signature and line range.Types: classes, interfaces and other types, with what they extend and implement.Annotations: diagnostics such as imported lint findings.
Run DESCRIBE Files to see a view’s columns. When you need the raw graph, the base tables node and edge hold every declaration and relationship.
Scope by address. The views cover everything indexed, including the built-in help:/// manual and any imported repositories. Filter with matches_glob(uri, 'src/**'), which understands addresses; a pattern without a scheme means your repository. Don’t use LIKE with a glob. It uses % and _, so a glob matches nothing and returns no rows without an error.
Join the index to more
Registered functions return tables too, so you can join them with the views:
search_pipelineranks files by words and meaning, likeexplore.glob_files,grep_matchesandregex_matchesselect files and lines.git_status,git_diff,git_blame,git_hotspotsandgit_patchesread your git history.parseturns CSV, JSON or YAML text into rows, andxlsxreads spreadsheets.asksends rows to a language model and returns its answer.mcp_toolslists the tools on your connected MCP servers and whether SQL can call them. Read-only tools can be called; others need to be allowed first.
Most queries run locally. A query reaches the network only when it calls something that does, such as ask or an external MCP tool.
What comes back
Terminal
rql query "SELECT name, function_kind, file, start_line
FROM Functions
WHERE matches_glob(uri, 'src/auth/**')
ORDER BY file, start_line"
Output
name function_kind file start_line
SignOut constructor file:///src/auth/SignOut.cs 4
Execute method file:///src/auth/SignOut.cs 7
TokenService constructor file:///src/auth/TokenService.cs 4
Issue method file:///src/auth/TokenService.cs 7
RevokeCliTokens method file:///src/auth/TokenService.cs 10
Refresh method file:///src/auth/TokenService.cs 13
- Every method and constructor in
src/auth, one row each. - The file and start line of each. Combine them into an address, such as
src/auth/TokenService.cs#symbol=TokenService.RevokeCliTokens, toreadthe code. - A stable order, because the query says
ORDER BY.
Keep results complete
Always use ORDER BY when order matters. Without it, rows can come back in any order, and a LIMIT keeps an arbitrary set.
Fit the result to the budget. When the rows don’t fit the token budget, you get the rows that fit and a note such as “showing 6 of 272 rows”. Select fewer columns, add LIMIT, or aggregate. If the SQL contains a comment, RepoQL tries to summarise the result in place of the cut table. That summary may not arrive, so never rely on it when you need every row.
Parameters
| MCP · CLI | Meaning |
|---|---|
sql · first argument | Required. The DuckDB SQL to run. |
tokenBudget · --token-budget | The most tokens the response may use. Rows beyond it are cut. |
timeoutMs · --timeout-ms | Stop the query after this many milliseconds. The default is five minutes. |
uplink · --uplink | Query a team’s uplink instead of your local repository. |
CLI only: --max-rows | Return at most this many rows. |
CLI only: --json · --jsonl | Structured output, as one JSON document or one line per row. --jsonl emits every row, ignoring --max-rows and --token-budget. |
CLI only: --cache-seconds | Reuse the result of an identical query run within this many seconds. |
CLI only: --no-launch | Answer only if a host is already running. Never start one. |
Further reference
In the installed manual: help:///tools/query.md, help:///commands/query.md, help:///schema/core.md, help:///schema/views/ and help:///schema/functions/.