Skip to content

Improve search tool prompts to encourage regex usage #6

Description

@vlad-ds

Summary

The search tools (search_pdf and search_multiple_pdfs) currently don't effectively encourage users to use regex patterns, which are much more powerful than plain text searches.

Current State

  • Tool descriptions mention regex support as /pattern/flags format
  • Users often default to plain text searches
  • Missing examples of common regex patterns that would be useful for PDF analysis

Proposed Improvements

1. Enhanced Tool Descriptions

Update tool descriptions to lead with regex capabilities and provide concrete examples:

Current:

Search for text patterns (including regex) within a PDF file...

Proposed:

Search for text patterns using regex or plain text within a PDF file. Supports powerful regex patterns like /budget|forecast/gi (case-insensitive search for budget OR forecast), /\d{4}-\d{2}-\d{2}/g (dates in YYYY-MM-DD format), or /section\s+\d+/i (section numbers). Use plain text for literal searches.

2. Add Common Regex Examples

Include helpful regex patterns in descriptions:

  • /\$[\d,]+\.?\d*/g - Currency amounts
  • /\b\d{4}\b/g - Years (4-digit numbers)
  • /chapter\s+\d+/gi - Chapter references
  • /table\s+\d+/gi - Table references
  • /figure\s+\d+/gi - Figure references
  • /\b[A-Z]{2,}\b/g - Acronyms
  • /\b\w+@\w+\.\w+/g - Email addresses

3. Parameter Description Updates

Enhance the search_pattern parameter description with:

  • Leading with regex capabilities
  • Clear format explanation: /pattern/flags
  • Common flags explanation (g, i, m, s)
  • Fallback to literal text when not using /pattern/ format

4. Documentation Examples

Add examples to CLAUDE.md showing:

  • How to search for financial data with regex
  • How to find structured references (chapters, sections, tables)
  • How to extract specific data patterns from documents

Benefits

  • More powerful searches leading to better PDF analysis
  • Reduced need for multiple search calls
  • Better extraction of structured data from documents
  • More efficient document processing

Files to Update

  • src/index.ts - Tool descriptions
  • server/index.js - Compiled descriptions
  • manifest.json - DXT tool descriptions
  • CLAUDE.md - Documentation and examples

Priority

Medium - This would significantly improve the user experience and tool effectiveness without breaking existing functionality.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions