@@ -308,24 +308,72 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
308308 description : `
309309 Start a streaming search that can return results progressively.
310310
311+ SEARCH STRATEGY GUIDE:
312+ Choose the right search type based on what the user is looking for:
313+
314+ USE searchType="files" WHEN:
315+ - User asks for specific files: "find package.json", "locate config files"
316+ - Pattern looks like a filename: "*.js", "README.md", "test-*.tsx"
317+ - User wants to find files by name/extension: "all TypeScript files", "Python scripts"
318+ - Looking for configuration/setup files: ".env", "dockerfile", "tsconfig.json"
319+
320+ USE searchType="content" WHEN:
321+ - User asks about code/logic: "authentication logic", "error handling", "API calls"
322+ - Looking for functions/variables: "getUserData function", "useState hook"
323+ - Searching for text/comments: "TODO items", "FIXME comments", "documentation"
324+ - Finding patterns in code: "console.log statements", "import statements"
325+ - User describes functionality: "components that handle login", "files with database queries"
326+
327+ WHEN UNSURE OR USER REQUEST IS AMBIGUOUS:
328+ Run TWO searches in parallel - one for files and one for content:
329+
330+ Example approach for ambiguous queries like "find authentication stuff":
331+ 1. Start file search: searchType="files", pattern="auth"
332+ 2. Simultaneously start content search: searchType="content", pattern="authentication"
333+ 3. Present combined results: "Found 3 auth-related files and 8 files containing authentication code"
334+
311335 SEARCH TYPES:
312336 - searchType="files": Find files by name (pattern matches file names)
313337 - searchType="content": Search inside files for text patterns
314338
339+ PATTERN MATCHING MODES:
340+ - Default (literalSearch=false): Patterns are treated as regular expressions
341+ - Literal (literalSearch=true): Patterns are treated as exact strings
342+
343+ WHEN TO USE literalSearch=true:
344+ Use literal search when searching for code patterns with special characters:
345+ - Function calls with parentheses and quotes
346+ - Array access with brackets
347+ - Object methods with dots and parentheses
348+ - File paths with backslashes
349+ - Any pattern containing: . * + ? ^ $ { } [ ] | \\ ( )
350+
315351 IMPORTANT PARAMETERS:
316352 - pattern: What to search for (file names OR content text)
353+ - literalSearch: Use exact string matching instead of regex (default: false)
317354 - filePattern: Optional filter to limit search to specific file types (e.g., "*.js", "package.json")
318355 - ignoreCase: Case-insensitive search (default: true). Works for both file names and content.
319356 - earlyTermination: Stop search early when exact filename match is found (optional: defaults to true for file searches, false for content searches)
320357
321- EXAMPLES:
322- - Find package.json files: searchType="files", pattern="package.json", filePattern="package.json"
323- - Find all JS files: searchType="files", pattern="*.js" (or use filePattern="*.js")
324- - Search for "TODO" in code: searchType="content", pattern="TODO", filePattern="*.js|*.ts"
325- - Case-sensitive file search: searchType="files", pattern="README", ignoreCase=false
326- - Case-insensitive file search: searchType="files", pattern="readme", ignoreCase=true
327- - Find exact file, stop after first match: searchType="files", pattern="config.json", earlyTermination=true
328- - Find all matching files: searchType="files", pattern="test.js", earlyTermination=false
358+ DECISION EXAMPLES:
359+ - "find package.json" → searchType="files", pattern="package.json" (specific file)
360+ - "find authentication components" → searchType="content", pattern="authentication" (looking for functionality)
361+ - "locate all React components" → searchType="files", pattern="*.tsx" or "*.jsx" (file pattern)
362+ - "find TODO comments" → searchType="content", pattern="TODO" (text in files)
363+ - "show me login files" → AMBIGUOUS → run both: files with "login" AND content with "login"
364+ - "find config" → AMBIGUOUS → run both: config files AND files containing config code
365+
366+ COMPREHENSIVE SEARCH EXAMPLES:
367+ - Find package.json files: searchType="files", pattern="package.json"
368+ - Find all JS files: searchType="files", pattern="*.js"
369+ - Search for TODO in code: searchType="content", pattern="TODO", filePattern="*.js|*.ts"
370+ - Search for exact code: searchType="content", pattern="toast.error('test')", literalSearch=true
371+ - Ambiguous request "find auth stuff": Run two searches:
372+ 1. searchType="files", pattern="auth"
373+ 2. searchType="content", pattern="authentication"
374+
375+ PRO TIP: When user requests are ambiguous about whether they want files or content,
376+ run both searches concurrently and combine results for comprehensive coverage.
329377
330378 Unlike regular search tools, this starts a background search process and returns
331379 immediately with a session ID. Use get_more_search_results to get results as they
0 commit comments