siyuan_sql
Run read-only SQL SELECT queries against SiYuan's SQLite database to retrieve blocks, documents, tags, backlinks, and search results; use read_database for Attribute View data.
Instructions
Execute a SQL SELECT on SiYuan's SQLite database. Use for ALL reads: blocks, documents, tags, backlinks, search. Read the siyuan://static/sql-schema resource for table schema and example queries. NOTE: Attribute View (database) data is NOT in SQLite — use read_database instead.
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": "siyuan_sql"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| stmt | Yes | SQL SELECT statement (read-only). Example: SELECT * FROM blocks WHERE type='d' LIMIT 10 |