Run SQL query
sql_queryRun read-only SQL queries against the SiYuan index to count blocks or filter by tag and attribute when other tools cannot. Only SELECT, WITH, and EXPLAIN statements are allowed.
Instructions
Run a read-only SQL query against the SiYuan index to answer questions the other tools cannot, e.g. counting blocks or filtering by tag/attribute. Main table: blocks (id, parent_id, root_id, box, path, hpath, type, subtype, content, tag, ial, created, updated). Only SELECT/WITH/EXPLAIN are allowed; results are capped at 64 rows by the kernel.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"stmt": "<stmt>"
},
"name": "sql_query"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| stmt | Yes | A single read-only SQL statement. |