# siyuan_database_query

思源数据库查询工具 - 执行 SQLite 查询语句来查询思源笔记的数据库（树形视图/属性视图） 功能说明 此工具允许您查询思源笔记中的数据库（也称为树形视图或属性视图）。您可以使用标准的 SQLite 语法来查询数据库中的数据。 支持的表 - blocks: 内容块表 - attributes: 属性表 - refs: 引用表 数据库表结构 blocks 表 - id: 内容块 ID - parent_id: 父块 ID - root_id: 文档块 ID - box: 笔记本 ID - path: 内容块路径 - hpath: 人类可读路径 - name: 内容块名称 - alias: 别名 - memo: 备注 - tag: 标签 - content: 内容文本 - fcontent: 第一个子块内容 - markdown: Markdown 格式内容 - length: 内容长度 - type: 块类型 (d:文档, h:标题, p:段落, l:列表, t:表格, b:引述, s:超级块, c:代码块, m:数学公式, av:数据库) - subtype: 子类型 - ial: 内联属性列表 - sort: 排序权重 - created: 创建时间 - updated: 更新时间 attributes 表 - id: 属性 ID - name: 属性名称 (自定义属性需加 custom- 前缀) - value: 属性值 - type: 类型 - block_id: 块 ID - root_id: 文档 ID - box: 笔记本 ID - path: 文档路径 refs 表 - id: 引用 ID - def_block_id: 被引用块 ID - def_block_root_id: 被引用块文档 ID - def_block_path: 被引用块路径 - block_id: 引用块 ID - root_id: 引用块文档 ID - box: 笔记本 ID - path: 引用块路径 - content: 引用锚文本 使用示例 1. 查询所有数据库块: SELECT * FROM blocks WHERE type =

Agent View of the PolicyLayer registry record for `siyuan_database_query`. HTML page: https://policylayer.com/tools/2234839-mcpserver/siyuan-database-query

## Facts

- Tool: `siyuan_database_query`
- Server: Martin MCP Toolbox (`2234839/mcpserver`) — https://policylayer.com/tools/2234839-mcpserver.md
- Homepage: https://github.com/2234839/mcpserver
- Risk category: Read (Low risk)
- Registry record: grade C, identity unverified
- Server rate-limited: no
- Parameters: 0
- Recommended policy verdict: Allowed

## Example call (MCP tools/call, JSON-RPC 2.0)

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "siyuan_database_query",
    "arguments": {}
  }
}
```

## Why siyuan_database_query is rated Low

Although this tool executes SQL queries (which could theoretically Execute), the description and supported operations are limited to data retrieval from read-only table structures (blocks, attributes, refs). No INSERT, UPDATE, DELETE, or DROP operations are mentioned or implied. The tool's purpose is querying/retrieving note data without modifying it.

From the tool's own definition: "Tool executes SQLite queries against SiYuan notes database with statements like 'SELECT' on tables (blocks, attributes, refs). Description states '执行 SQLite 查询语句来查询思源笔记的数据库' (execute SQLite query statements to query SiYuan notes database)."

## Use case

AI agents call siyuan_database_query to retrieve information from Martin MCP Toolbox without modifying anything. It is typically the context-gathering step in research, monitoring, and reporting workflows, before the agent takes action elsewhere.

## Recommended policy (PolicyLayer)

Verdict: **Allowed**. Enforced by the PolicyLayer MCP gateway (https://policylayer.com/mcp-gateway) before a call reaches Martin MCP Toolbox:

```json
{
  "version": "1",
  "default": "deny",
  "tools": {
    "siyuan_database_query": {}
  }
}
```

## Other tools on Martin MCP Toolbox (13)

- `pollinations_generate_text` — Execute — https://policylayer.com/tools/2234839-mcpserver/pollinations-generate-text.md
- `siyuan_query_sql` — Execute — https://policylayer.com/tools/2234839-mcpserver/siyuan-query-sql.md
- `advanced_web_search` — Read — https://policylayer.com/tools/2234839-mcpserver/advanced-web-search.md
- `analyze_video` — Read — https://policylayer.com/tools/2234839-mcpserver/analyze-video.md
- `get_block_kramdown` — Read — https://policylayer.com/tools/2234839-mcpserver/get-block-kramdown.md
- `pollinations_analyze_image` — Read — https://policylayer.com/tools/2234839-mcpserver/pollinations-analyze-image.md
- `read_image` — Read — https://policylayer.com/tools/2234839-mcpserver/read-image.md
- `siyuan_search_blocks` — Read — https://policylayer.com/tools/2234839-mcpserver/siyuan-search-blocks.md
- `web_search` — Read — https://policylayer.com/tools/2234839-mcpserver/web-search.md
- `generate_image` — Write — https://policylayer.com/tools/2234839-mcpserver/generate-image.md
- `pollinations_generate_audio` — Write — https://policylayer.com/tools/2234839-mcpserver/pollinations-generate-audio.md
- `pollinations_generate_image` — Write — https://policylayer.com/tools/2234839-mcpserver/pollinations-generate-image.md
- `update_block` — Write — https://policylayer.com/tools/2234839-mcpserver/update-block.md

## For agents

This record is a snapshot. Live verdicts and the full registry:

- Check every server in your MCP config at once: `npx -y policylayer stack`
- Vet a server before you add it: install the mcp-precheck skill — `npx skills add https://policylayer.com` (skill text: https://policylayer.com/skill.md)
- Query the registry over MCP: endpoint `https://api.policylayer.com/mcp` — tools `check_mcp_server`, `check_mcp_stack`, `check_tool`, `search_registry`, `get_change_events`

---

Source: the PolicyLayer MCP registry — one continuously verified record per MCP server. Full record: https://policylayer.com/registry?q=2234839-mcpserver · API: https://policylayer.com/registry/api · Policy library: https://policylayer.com/policies/2234839-mcpserver
