Skip to main content
Glama

search_blocks

Search and retrieve blocks from a Logseq graph using specific queries, such as finding blocks on a page, journal, or containing a search term. Ideal for targeted knowledge retrieval.

Instructions

Searches for blocks matching a query in the Logseq graph. Examples of useful queries: - page:"Page Name" - find all blocks on a specific page - "search term" - find blocks containing the term - page:"Apr 4th, 2025" - find all blocks in a journal - [[Page Name]] - find references to a specific page Returned blocks from journal pages will include: - "journal?": true - "journalDay": YYYYMMDD - The date in numeric format Args: query (str): The search query. Returns: list: A list of blocks matching the search query.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes

Implementation Reference

  • The MCP tool handler for 'search_blocks', decorated with @mcp.tool(). Includes schema via type hints and docstring. Delegates to LogseqAPIClient.search_blocks(query).
    @mcp.tool() def search_blocks(query: str) -> List[Dict]: """ Searches for blocks matching a query in the Logseq graph. Examples of useful queries: - page:"Page Name" - find all blocks on a specific page - "search term" - find blocks containing the term - page:"Apr 4th, 2025" - find all blocks in a journal - [[Page Name]] - find references to a specific page Returned blocks from journal pages will include: - "journal?": true - "journalDay": YYYYMMDD - The date in numeric format Args: query (str): The search query. Returns: list: A list of blocks matching the search query. """ """Search for blocks matching the query.""" return logseq_client.search_blocks(query)
  • Core implementation in LogseqAPIClient that performs the actual API call to Logseq's Editor.search endpoint.
    def search_blocks(self, query: str) -> List[Dict]: """Search for blocks matching a query""" response = self.call_api("logseq.Editor.search", [query]) if isinstance(response, list): return response return response.get("result", []) if isinstance(response, dict) else []
  • Re-exports search_blocks from blocks.py, making it available for import in higher modules.
    from .blocks import get_page_blocks, get_block, create_block, update_block, remove_block, insert_block, move_block, search_blocks
  • Includes search_blocks in the public API export via __all__.
    search_blocks,

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mikeysrecipes/logseq-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server