query
Run read-only SQL SELECT statements over v_entities, v_relations, and v_facts to answer analytical questions that structured entity/count filters cannot express.
Instructions
Run a read-only SQL SELECT over the curated views (v_entities, v_relations, v_facts) — the analytical escape hatch for questions the structured entities/count filters can't express. Single statement, SELECT/WITH only; writes are rejected and impossible. Run introspect for the view columns. Scope: results default to project+personal; pass scopes:["team"] to include team rows. The views are pre-filtered to the requested scopes before your SQL runs — no WHERE scope = … clause needed.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | A single read-only SELECT (or WITH … SELECT) statement. Query the curated views: v_entities, v_relations, v_facts (run introspect for their columns). Writes, multiple statements, PRAGMA/ATTACH and DDL are rejected; the connection is read-only regardless. | |
| limit | No | Maximum rows to return. Defaults to 200, hard-capped at 1000. Rows beyond the cap set truncated=true. | |
| scopes | No | Scope filter: which data partitions to include. Allowed values: project, personal, team. Defaults to [project, personal] when omitted — team rows are hidden unless you pass scopes:["team"]. The curated views are pre-filtered to the requested scopes before your SQL runs, so no WHERE scope = … clause is needed. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rows | Yes | Result rows as column→value objects. | |
| columns | Yes | Result column names in order. | |
| rowCount | Yes | Number of rows returned (after the limit cap). | |
| truncated | Yes | True when more rows matched than the limit returned. |