Skip to main content
Glama
leolulu

siyuan-mcp-server

by leolulu

search_blocks

Search SiYuan notes for content blocks by keyword, block type, parent, or time range. Retrieve matching blocks with filtered results to locate specific notes efficiently.

Instructions

根据关键词、类型等多种条件在思源笔记中搜索内容块。

这是最核心和最灵活的查询工具。

适用场景: - 全局关键词检索。 - 按块类型和时间窗口缩小范围。

使用方法: - query: 使用 SQL LIKE 语义匹配 content。 - parent_id: 按直接父块 ID 过滤。 - block_type: 例如 p/h/l。

注意事项: - parent_id 仅匹配直接子块,不会递归后代。 - 返回 content 会做敏感信息打码处理。

Args: query (str): 在块内容中搜索的关键词。 parent_id (Optional[str]): 在哪个文档或父块下进行搜索。如果省略,则全局搜索。 block_type (Optional[str]): 限制块的类型,例如 'p' (段落), 'h' (标题), 'l' (列表)。 created_after (Optional[str]): 查找在此日期之后创建的块,格式为 'YYYYMMDDHHMMSS'。 updated_after (Optional[str]): 查找在此日期之后更新的块,格式为 'YYYYMMDDHHMMSS'。 limit (int): 返回结果的最大数量,默认为 20。

Returns: list: 包含块信息的字典列表。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
queryYes
parent_idNo
block_typeNo
created_afterNo
updated_afterNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.31.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 behavioral transparency burden. It discloses important traits: query uses SQL LIKE semantics, parent_id only matches direct children, and returned content is masked for sensitive information. This goes well beyond a simple 'search' statement.

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

Conciseness4/5

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

The description is well-structured with sections for scenarios, usage, notes, args, and returns. It is slightly redundant because the '使用方法' section partially repeats the Args section, but the organization and front-loaded purpose make it easy for an agent to scan.

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?

The description covers the tool's purpose, parameter behavior, edge cases (non-recursive parent_id), and security-relevant masking behavior. It does not mention all possible sibling alternatives or boundary semantics like inclusive/exclusive time filters, but the essentials for invoking it correctly are present.

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

Parameters5/5

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

Schema description coverage is 0%, so the description fully compensates. Every parameter is explained with meaning, optionality, formats, and defaults. It also adds semantics not obvious from the schema, such as the date format YYYYMMDDHHMMSS and the default limit of 20.

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?

The description clearly states the tool searches content blocks in SiYuan Notes by keyword, type, and other conditions. It also labels itself as the core and most flexible query tool, which helps differentiate it from mutation and retrieval siblings like update_block or get_block_content.

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?

The description provides explicit usage scenarios: global keyword search and narrowing by block type or time window. It gives practical method notes for query, parent_id, and block_type, though it does not explicitly compare against sibling alternatives or state when not to use this tool.

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