Skip to main content
Glama
Miles1994

siyuan-note-mcp

by Miles1994

Run SQL query

sql_query

Run 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.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
stmtYesA single read-only SQL statement.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and does well: it discloses read-only semantics, the permitted statement classes (SELECT/WITH/EXPLAIN), and the kernel's 64-row result cap. It omits permission/auth requirements and what happens if a forbidden statement is submitted, so it is strong but not exhaustive.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loads purpose and routing, then packs table schema and hard limits into two tight sentences with no filler. Every clause carries actionable information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a raw SQL tool with no output schema, the description covers the query surface and row cap well, but does not describe the shape of returned results (columns/rows) beyond the cap, leaving the agent to infer the output format.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% (baseline 3), and the description adds meaningful constraints beyond the schema's 'single read-only SQL statement': the allowed statement types and the primary `blocks` table with its column list. That extra context helps the agent construct a valid `stmt`.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Run a read-only SQL query against the SiYuan index') and explicitly positions it against siblings by scoping it to 'questions the other tools cannot' with concrete examples (counting blocks, filtering by tag/attribute). An agent can distinguish it from search_notes/get_block without opening any schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives a clear selection condition — use this when the other tools cannot answer, with examples of such cases. It does not name a specific sibling as the preferred alternative or state explicit exclusions (e.g. 'do not use for full-text search'), so it stops short of full when/when-not routing.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.