Skip to main content
Glama

search_notes

Find specific text within your Markdown notes using full-text search to locate relevant information quickly.

Instructions

Search for text within notes

Args: query: Search query

Returns: List of notes containing the query

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes

Implementation Reference

  • The handler function for the 'search_notes' tool. It searches all .md note files for the given query (case-insensitive), extracts titles, finds matching lines with context, and returns formatted results. Registered via @mcp.tool() decorator.
    @mcp.tool() def search_notes(query: str) -> str: """ Search for text within notes Args: query: Search query Returns: List of notes containing the query """ ensure_notes_dir() results = [] query_lower = query.lower() for filename in os.listdir(NOTES_DIR): if filename.endswith('.md'): filepath = os.path.join(NOTES_DIR, filename) with open(filepath, "r", encoding="utf-8") as f: content = f.read() if query_lower in content.lower(): title_match = re.search(r'^# (.+)$', content, re.MULTILINE) title = title_match.group(1) if title_match else filename lines = content.split('\n') for i, line in enumerate(lines): if query_lower in line.lower(): context = line[:100] + "..." if len(line) > 100 else line results.append(f"- [{filename}] {title}\n → {context}") break if not results: return f"No matches found for '{query}'" return "\n\n".join(results)
  • The @mcp.tool() decorator registers the search_notes function as an MCP tool.
    @mcp.tool()
  • The docstring defines the input schema (query: str) and output description for the tool.
    """ Search for text within notes Args: query: Search query Returns: List of notes containing the query """

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/sayranovv/notes-mcp-server'

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