Skip to main content
Glama
sayranovv
by sayranovv

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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

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
    """
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states it 'Returns: List of notes containing the query' which implies read-only behavior, but doesn't disclose other traits like whether it's case-sensitive, supports wildcards, has rate limits, requires authentication, or how it handles empty results. For a search tool with zero annotation coverage, this leaves significant behavioral gaps.

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 appropriately sized and structured with clear sections (purpose, Args, Returns). Each sentence earns its place, though the Args and Returns sections are very brief. It's front-loaded with the core purpose. No wasted words, but could be slightly more informative without losing conciseness.

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

Completeness3/5

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

Given 1 parameter, no annotations, and an output schema (which likely describes the return structure), the description is minimally complete. It covers the basic purpose and parameter, but lacks usage guidelines and behavioral details. For a simple search tool, it's adequate but has clear gaps in guiding the agent effectively.

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

Parameters3/5

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

Schema description coverage is 0%, so the schema provides no parameter descriptions. The description adds minimal semantics: 'query: Search query' in the Args section, but this is basic and doesn't explain format, constraints, or examples (e.g., is it free text, supports operators?). With 1 parameter and low coverage, it partially compensates but remains vague.

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

Purpose4/5

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

The description clearly states the tool's purpose: 'Search for text within notes' specifies the verb (search) and resource (notes). It distinguishes from siblings like list_notes (which presumably lists all notes without searching) and read_note (which reads a specific note). However, it doesn't explicitly mention how it differs from siblings beyond the search functionality.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. With siblings like list_notes and read_note available, there's no indication of when search_notes is preferred (e.g., for finding specific content vs. browsing all notes). No prerequisites, exclusions, or comparison to siblings are mentioned.

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

Install Server

Other Tools

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