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 youUse
Want a count, a list, a ranking or a comparisonquery
Can describe a behaviour but don’t know where it livesexplore
Already know the file or declarationread
Need several steps where each depends on the lastexecute

Start from the views

The index is exposed as tables you can query with DuckDB SQL. Most questions start from four views:

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:

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

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 · CLIMeaning
sql · first argumentRequired. The DuckDB SQL to run.
tokenBudget · --token-budgetThe most tokens the response may use. Rows beyond it are cut.
timeoutMs · --timeout-msStop the query after this many milliseconds. The default is five minutes.
uplink · --uplinkQuery a team’s uplink instead of your local repository.
CLI only: --max-rowsReturn at most this many rows.
CLI only: --json · --jsonlStructured output, as one JSON document or one line per row. --jsonl emits every row, ignoring --max-rows and --token-budget.
CLI only: --cache-secondsReuse the result of an identical query run within this many seconds.
CLI only: --no-launchAnswer 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/.