siyuan_query_sql
思源 SQL 查询工具 - 执行 SQLite 查询语句 你是思源小助手,你需要根据用户需求,编写符合思源笔记数据库结构的 SQL 查询语句。在必要时,解释查询结果的含义和用途。 要求 SQL 语法规范: 在默认的情况下,用户可以在思源的嵌入块中输入 SQL 代码查询,此时 SQL 查询语句必须以 select * from blocks 开头:只允许查询 block 表,且不允许单独查询字段 面向开发者的高级用法:用户还可以调用后端 API 接口,发送 SQL 查询,此时是可以使用更普遍的 SQL 语法结构的(查询别的表,返回特定字段) 使用 SQLite 的语法,如 strftime...
This record as markdown: /tools/2234839-mcpserver/siyuan-query-sql.md
What siyuan_query_sql does on Martin MCP Toolbox
AI agents invoke siyuan_query_sql to trigger actions in Martin MCP Toolbox. What it does depends on the arguments the agent supplies, and its effects often reach beyond the immediate call: builds kicked off, notifications sent, workflows started.
Why siyuan_query_sql is rated High
This tool executes arbitrary SQLite SQL queries against SiYuan Notes' database. While the description emphasizes SELECT queries, it explicitly allows 'more universal SQL syntax' via the backend API, which could include destructive statements (DROP, DELETE, UPDATE). Even limited to SELECT, executing arbitrary queries against a local database is Execute-level risk.
From the tool's definition 执行 SQLite 查询语句 (execute SQLite query statements); 'siyuan_query_sql' runs arbitrary SQL including queries against multiple tables and specific fields via backend API
Attacks that exploit this kind of access
The rule that runs siyuan_query_sql safely
PolicyLayer is an MCP gateway: it sits between your AI agents and Martin MCP Toolbox, and checks every tool call against a rule you set before the call runs. Nothing changes on the server itself. For siyuan_query_sql, this is the rule to start with:
siyuan_query_sql stays usable, but rate-capped: a runaway agent can't fire it dozens of times a minute. Everything else on the server is denied unless you say otherwise.
The button opens the PolicyLayer dashboard: create your workspace, connect Martin MCP Toolbox, apply this rule, and every siyuan_query_sql call is checked against it from then on.
Questions about siyuan_query_sql
思源 SQL 查询工具 - 执行 SQLite 查询语句 你是思源小助手,你需要根据用户需求,编写符合思源笔记数据库结构的 SQL 查询语句。在必要时,解释查询结果的含义和用途。 要求 SQL 语法规范: 在默认的情况下,用户可以在思源的嵌入块中输入 SQL 代码查询,此时 SQL 查询语句必须以 select * from blocks 开头:只允许查询 block 表,且不允许单独查询字段 面向开发者的高级用法:用户还可以调用后端 API 接口,发送 SQL 查询,此时是可以使用更普遍的 SQL 语法结构的(查询别的表,返回特定字段) 使用 SQLite 的语法,如 strftime 函数处理时间。 默认情况下,查询结果最多返回 64 个块,除非明确指定了 limit xxx 输出:将查询语句放在一个 \. It is categorised as a Execute tool in the Martin MCP Toolbox MCP Server, which means it can trigger actions or run processes. Use rate limits and argument validation.
Register the Martin MCP Toolbox MCP server in PolicyLayer and add a rule for siyuan_query_sql: allow, deny, rate-limit, or require approval. Point your MCP client at the PolicyLayer proxy URL and the rule is enforced on every call, before it reaches Martin MCP Toolbox. Nothing to install.
siyuan_query_sql is a Execute tool with high risk. Execute tools should be rate-limited and have argument validation enabled.
Yes. Add a rate_limit block to the siyuan_query_sql rule in your PolicyLayer policy. For example, setting max: 10 and window: 60 limits the tool to 10 calls per minute. Rate limits are tracked per agent session and reset automatically.
Set action: deny in the PolicyLayer policy for siyuan_query_sql. The AI agent will receive a policy violation error and cannot call the tool. You can also include a reason field to explain why the tool is blocked.
siyuan_query_sql is provided by the Martin MCP Toolbox MCP server (2234839/mcpserver). PolicyLayer sits as a proxy in front of this server to enforce policies before tool calls reach the server.
More on Martin MCP Toolbox, and thousands of servers like it.
Across the catalogue