Search
Search web, library docs, and GitHub code using progressive escalation.
Quick Start
Decision Tree:
- Library/framework docs? → Context7
get-library-docs
- Code examples/patterns? → GitHub Grep
grep_searchGitHub
- Web info/tutorials? → Tavily
tavily_search
- Multiple sources needed? → Run tools in parallel
Default Workflow:
- Start simple:
search_depth: "basic", maxResults: 5
- If insufficient: Escalate to Level 2 (expand query, increase results)
- If repeated problem: Escalate to Level 3 (parallel queries, extraction, crawling)
Tools Overview
Tavily (Web Search)
| Tool |
Purpose |
Key Params |
tavily_search |
Web search |
search_depth, topic, time_range, include_domains |
tavily_extract |
Extract from URLs |
extract_depth, query (for reranking) |
tavily_crawl |
Multi-page crawl |
max_depth, select_paths, instructions |
tavily_map |
Discover site structure |
max_depth, limit |
Context7 (Library Docs)
| Tool |
Purpose |
Key Params |
resolve-library-id |
Get library ID |
libraryName |
get-library-docs |
Fetch docs |
mode: "code"/"info", topic, page |
GitHub Grep (Code Search)
| Tool |
Purpose |
Key Params |
grep_searchGitHub |
Search code patterns |
query, language, repo, path, useRegexp |
Critical: GitHub Grep searches literal code patterns, not keywords!
- ✅ Good:
useState(, getServerSession, (?s)try {.*await
- ❌ Bad:
react tutorial, how to authenticate
Progressive Escalation Levels
Level 1: Simple Search (Default)
When: Quick lookups, straightforward questions, first encounter
- Tavily:
search_depth: "basic", maxResults: 5
- Context7:
mode: "code" for API, mode: "info" for concepts
- GitHub Grep: literal code patterns with language filter
- Parallel execution when appropriate
Sufficient? → Done. Insufficient? → Level 2
Level 2: Enhanced Search
When: Initial results incomplete, need more examples, outdated results
- Expand query: Add synonyms, context (keep <400 chars)
- Increase:
maxResults: 10-15, search_depth: "advanced"
- Filter domains:
include_domains: ["stackoverflow.com", "github.com"]
- Time filter:
time_range: "year" for recent info
- Two-step extraction: Search → Filter by score (>0.5) → Extract top URLs
Sufficient? → Done. Insufficient? → Level 3
Level 3: Deep Research
When: Problem encountered 2+ times, complex topic, building knowledge base
- Parallel queries: 3-5 query variations with synonyms
- Systematic extraction: Top 5-10 URLs with
extract_depth: "advanced"
- Website exploration:
tavily_map → tavily_crawl
- GitHub deep dive: Multiple pattern variations, regex, cross-repo comparison
- Cross-reference: Verify across multiple sources
Key Tips (Reminders)
Query Formulation
- 400 char limit - Break complex queries into sub-queries
- Natural language works better - Full sentences > keywords
- Be specific - Include technology, use case, context
- For full guide: See
references/query-guide.md
Score-Based Filtering
- Tavily results include
score (0-1)
- >0.5 typically good - Adjust based on distribution
- Filter before extracting to save credits
Two-Step Extraction Pattern
1. Search with search_depth: "advanced"
2. Filter URLs by score (>0.5)
3. Extract top 2-5 URLs with extract_depth: "basic"
4. Upgrade to "advanced" only if needed
GitHub Grep Patterns
# API usage
Query: getServerSession
Language: ['TypeScript'], Path: '/api/'
# Multiline with regex
Query: (?s)useEffect\(\(\) => {.*cleanup
useRegexp: true
Cost Optimization
basic = 1 credit, advanced = 2 credits
- Prefer two-step extraction over
include_raw_content: true
- Use
tavily_map before tavily_crawl
For advanced techniques: See references/advanced-techniques.md
Common Patterns
| Pattern |
Level 1 |
Level 2 |
Level 3 |
| Error resolution |
Exact error + SO domain |
Remove quotes, add context |
Extract top answers, cross-ref docs |
| Best practices |
"Tech best practices 2024" |
Domain filter + extract |
Parallel aspect searches |
| API reference |
Context7 with topic |
+ Tavily + GitHub Grep |
Crawl official docs |
| Code patterns |
GitHub Grep literal |
+ language/path filters |
Regex + cross-repo |
For workflow examples: See references/examples/example-workflows.md
References
references/reference-parameters.md - Complete parameter reference for all tools
references/query-guide.md - Query structuring, 400 char limit, expansion strategies
references/advanced-techniques.md - Two-step extraction, post-processing, cost optimization
references/examples/example-workflows.md - Practical workflow examples
Output
Search results are used directly in context. No files saved unless requested. For comprehensive research with evidence cards, use the research skill.
1---2name: search-23description: Search the web, library documentation, and GitHub repositories using Tavily, Context7, and GitHub Grep MCPs. Use when: (1) Looking up documentation for libraries or frameworks, (2) Searching for code examples or tutorials, (3) Finding API references or specifications, (4) Researching best practices or solutions, (5) Looking up error messages or troubleshooting guides, (6) Finding library installation instructions, (7) Searching for real-world code patterns in GitHub repositories, or (8) When you need current web information or documentation. Triggers: search, look up, find documentation, search web, lookup, find examples, search for, how to, tutorial, API reference, documentation for, error message, troubleshoot, best practices, find code examples, GitHub search.4---5
6# Search
7
8Search web, library docs, and GitHub code using progressive escalation.
9
10## Quick Start
11
12**Decision Tree:**
13- **Library/framework docs?** → Context7 `get-library-docs`
14- **Code examples/patterns?** → GitHub Grep `grep_searchGitHub`
15- **Web info/tutorials?** → Tavily `tavily_search`
16- **Multiple sources needed?** → Run tools in parallel
17
18**Default Workflow:**
191. Start simple: `search_depth: "basic"`, `maxResults: 5`
202. If insufficient: Escalate to Level 2 (expand query, increase results)
213. If repeated problem: Escalate to Level 3 (parallel queries, extraction, crawling)
22
23## Tools Overview
24
25### Tavily (Web Search)
26| Tool | Purpose | Key Params |
27|------|---------|------------|
28| `tavily_search` | Web search | `search_depth`, `topic`, `time_range`, `include_domains` |
29| `tavily_extract` | Extract from URLs | `extract_depth`, `query` (for reranking) |
30| `tavily_crawl` | Multi-page crawl | `max_depth`, `select_paths`, `instructions` |
31| `tavily_map` | Discover site structure | `max_depth`, `limit` |
32
33### Context7 (Library Docs)
34| Tool | Purpose | Key Params |
35|------|---------|------------|
36| `resolve-library-id` | Get library ID | `libraryName` |
37| `get-library-docs` | Fetch docs | `mode: "code"/"info"`, `topic`, `page` |
38
39### GitHub Grep (Code Search)
40| Tool | Purpose | Key Params |
41|------|---------|------------|
42| `grep_searchGitHub` | Search code patterns | `query`, `language`, `repo`, `path`, `useRegexp` |
43
44**Critical:** GitHub Grep searches **literal code patterns**, not keywords!
45- ✅ Good: `useState(`, `getServerSession`, `(?s)try {.*await`
46- ❌ Bad: `react tutorial`, `how to authenticate`
47
48## Progressive Escalation Levels
49
50### Level 1: Simple Search (Default)
51**When:** Quick lookups, straightforward questions, first encounter
52
531. Tavily: `search_depth: "basic"`, `maxResults: 5`
542. Context7: `mode: "code"` for API, `mode: "info"` for concepts
553. GitHub Grep: literal code patterns with language filter
564. **Parallel execution** when appropriate
57
58**Sufficient? → Done. Insufficient? → Level 2**
59
60### Level 2: Enhanced Search
61**When:** Initial results incomplete, need more examples, outdated results
62
631. **Expand query:** Add synonyms, context (keep <400 chars)
642. **Increase:** `maxResults: 10-15`, `search_depth: "advanced"`
653. **Filter domains:** `include_domains: ["stackoverflow.com", "github.com"]`
664. **Time filter:** `time_range: "year"` for recent info
675. **Two-step extraction:** Search → Filter by score (>0.5) → Extract top URLs
68
69**Sufficient? → Done. Insufficient? → Level 3**
70
71### Level 3: Deep Research
72**When:** Problem encountered 2+ times, complex topic, building knowledge base
73
741. **Parallel queries:** 3-5 query variations with synonyms
752. **Systematic extraction:** Top 5-10 URLs with `extract_depth: "advanced"`
763. **Website exploration:** `tavily_map` → `tavily_crawl`
774. **GitHub deep dive:** Multiple pattern variations, regex, cross-repo comparison
785. **Cross-reference:** Verify across multiple sources
79
80## Key Tips (Reminders)
81
82### Query Formulation
83- **400 char limit** - Break complex queries into sub-queries
84- **Natural language works better** - Full sentences > keywords
85- **Be specific** - Include technology, use case, context
86- For full guide: See `references/query-guide.md`
87
88### Score-Based Filtering
89- Tavily results include `score` (0-1)
90- **>0.5 typically good** - Adjust based on distribution
91- Filter before extracting to save credits
92
93### Two-Step Extraction Pattern
94```
951. Search with search_depth: "advanced"
962. Filter URLs by score (>0.5)
973. Extract top 2-5 URLs with extract_depth: "basic"
984. Upgrade to "advanced" only if needed
99```
100
101### GitHub Grep Patterns
102```
103# API usage
104Query: getServerSession
105Language: ['TypeScript'], Path: '/api/'
106
107# Multiline with regex
108Query: (?s)useEffect\(\(\) => {.*cleanup
109useRegexp: true
110```
111
112### Cost Optimization
113- `basic` = 1 credit, `advanced` = 2 credits
114- Prefer two-step extraction over `include_raw_content: true`
115- Use `tavily_map` before `tavily_crawl`
116
117For advanced techniques: See `references/advanced-techniques.md`
118
119## Common Patterns
120
121| Pattern | Level 1 | Level 2 | Level 3 |
122|---------|---------|---------|---------|
123| **Error resolution** | Exact error + SO domain | Remove quotes, add context | Extract top answers, cross-ref docs |
124| **Best practices** | "Tech best practices 2024" | Domain filter + extract | Parallel aspect searches |
125| **API reference** | Context7 with topic | + Tavily + GitHub Grep | Crawl official docs |
126| **Code patterns** | GitHub Grep literal | + language/path filters | Regex + cross-repo |
127
128For workflow examples: See `references/examples/example-workflows.md`
129
130## References
131
132- **`references/reference-parameters.md`** - Complete parameter reference for all tools
133- **`references/query-guide.md`** - Query structuring, 400 char limit, expansion strategies
134- **`references/advanced-techniques.md`** - Two-step extraction, post-processing, cost optimization
135- **`references/examples/example-workflows.md`** - Practical workflow examples
136
137## Output
138
139Search results are used directly in context. No files saved unless requested. For comprehensive research with evidence cards, use the `research` skill.