Skip to content

Add search syntax examples to tool documentation #179

Closed

Description

@bm-claudeai

Enhancement Description

Add comprehensive search syntax examples and documentation to improve user experience with the search_notes tool.

Background

During live testing, it became clear that users need better guidance on:

  • Supported search syntax
  • Query formatting examples
  • Best practices for effective searches
  • Limitations and workarounds

Current State

The search_notes tool works well for basic keyword searches but lacks clear documentation about:

  • What syntax is supported
  • How to format complex queries
  • Examples of effective search patterns
  • Error handling explanations

Proposed Improvements

1. Tool Documentation Enhancement

Add to search_notes tool description:

## Search Syntax Examples

### Basic Searches
- `search_notes("keyword")` - Find any content containing "keyword"
- `search_notes("exact phrase")` - Search for exact phrase match

### Advanced Searches  
- `search_notes("term1 term2")` - Find content with both terms (implicit AND)
- `search_notes("tag:example")` - Search within specific tags
- `search_notes("category:observation")` - Filter by observation categories

### Filtering Options
- `search_notes("query", types=["entity"])` - Search only entities
- `search_notes("query", after_date="2024-01-01")` - Recent content only

2. Error Message Improvements

When search syntax fails, provide:

  • Clear explanation of what went wrong
  • Suggested alternative query formats
  • Examples of working syntax

3. Help Examples in Tool Response

For empty or failed searches, suggest:

  • Alternative query formats
  • Related search strategies
  • Common search patterns

Implementation Areas

  1. MCP Tool Descriptions - Update tool docstrings with examples
  2. Error Responses - Enhance error messages with helpful guidance
  3. Tool Documentation - Add comprehensive search guide
  4. User Guide - Include search best practices

Success Criteria

  • Users can quickly understand supported search syntax
  • Failed searches provide actionable guidance
  • Search success rate improves through better user education
  • Documentation covers edge cases and limitations

Priority

  • Impact: High - Improves user experience significantly
  • Effort: Medium - Documentation and message updates
  • Timeline: Include in v0.14.0 for better search UX

Related

Activity

  1. added
    documentation
    enhancement
    on Jun 26, 2025
  2. added this to the v0.14.0 milestone on Jun 26, 2025
  3. phernandez commented on Jun 26, 2025

    @phernandez
    Member

    @claude make a PR with theseenhancements to the search tool doc for clarity

  4. claude commented on Jun 26, 2025

    @claude
    Contributor

    Claude finished @phernandez's task —— View job • claude/issue-179-20250626_155103 • Create PR ➔


    Implementing Search Tool Documentation Enhancements ✅

    Successfully enhanced the search_notes tool documentation as requested in issue #179.

    Todo List:

    • Explore codebase to locate search_notes tool implementation
    • Review current tool documentation and structure
    • Add comprehensive search syntax examples to tool description
    • Enhance error messages with helpful guidance
    • Update tool responses with better help examples
    • Test changes work properly (skipped due to permissions)
    • Commit changes and provide PR link

    Enhancements Completed:

    1. 📚 Enhanced Tool Description

      • Added comprehensive "Search Syntax Examples" section with 4 categories:
        • Basic Searches (keyword, exact phrase)
        • Advanced Boolean Searches (AND, OR, NOT, grouping)
        • Content-Specific Searches (tag:, category:, author:)
        • Search Type Examples (title, permalink, text)
        • Filtering Options (types, entity_types, after_date)
        • Advanced Pattern Examples (complex boolean logic)
    2. 🔧 Improved Error Handling

      • Enhanced _format_search_error_response with better guidance
      • Added comprehensive alternative search strategies
      • Improved troubleshooting steps with specific examples
      • Enhanced no-results guidance with 6 different approaches
      • Added search syntax reference to generic error handling
    3. ✨ Specific Issue Requirements

      • Included exact patterns from issue: tag:example, category:observation
      • Added filtering examples with multiple approaches
      • Complex boolean logic: (project OR planning) AND notes
      • Pattern matching with wildcards and advanced searches

    Changes Made:

    • Updated src/basic_memory/mcp/tools/search.py with comprehensive documentation
    • Tool description now includes 20+ practical examples
    • Error messages provide 6 alternative search strategies
    • Enhanced guidance covers syntax errors, no results, and general failures

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationenhancement

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions