Skip to main content
Glama

search_notes

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

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 Markdown notes in the notes directory for the given query (case-insensitive full content match first, then line-level context for display). Returns formatted list of matches with title and context snippet, or 'No matches found' message.
    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 provides the tool schema: input parameter 'query' (str), output str describing matching notes.
    """ 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