Research Tool Routing
Optimal routing of research tasks across Perplexity MCP, Firecrawl MCP, and Context7 MCP.
Each tool has distinct strengths — use the right one for each job.
Tool Strengths at a Glance
| Tool |
Best For |
Cost |
Speed |
| Context7 |
Library/framework docs, API reference |
Free |
Fast (cached <5ms) |
| Perplexity Ask |
Knowledge Q&A, current events, fact-checking |
~$0.02/query |
Fast |
| Perplexity Research |
Deep investigations, comprehensive reports |
~$0.10/query |
Slow |
| Firecrawl Scrape |
Extract content from specific URL |
1 credit |
Fast |
| Firecrawl Map |
Discover all URLs on a site |
1 credit |
Fast |
| Firecrawl Extract |
Structured JSON from pages |
5-20 credits |
Medium |
| Firecrawl Agent |
Autonomous multi-page research |
100-1500+ credits |
Slow |
Decision Tree
What do you need to find out?
├─ LIBRARY DOCS?
│ "How does React useEffect work?"
│ "What's the Prisma findMany API?"
│ "Next.js App Router conventions?"
│ └─→ Context7 (resolve-library-id → query-docs)
│ Free, current, version-specific, no hallucination
│
├─ GENERAL KNOWLEDGE?
│ "What is the latest in AI?"
│ "Explain event sourcing"
│ "Compare Redis vs Memcached"
│ └─→ Perplexity Ask (perplexity_ask)
│ Fast, cheap, citations included
│
├─ CURRENT EVENTS?
│ "What happened at AWS re:Invent?"
│ "Latest security vulnerability in Log4j?"
│ └─→ Perplexity Search (perplexity_search)
│ Real-time web search with ranked results
│
├─ DEEP RESEARCH?
│ "Comprehensive comparison of 5 auth solutions"
│ "Full analysis of microservice vs monolith tradeoffs"
│ └─→ Perplexity Research (perplexity_research)
│ Deep-Research model, thorough, multiple sources
│
├─ EXTRACT FROM KNOWN URL?
│ "Get the pricing from https://example.com/pricing"
│ "Extract the API reference from this page"
│ └─→ Firecrawl Scrape (firecrawl_scrape)
│ 1 credit, clean markdown or JSON output
│
├─ FIND PAGES ON A SITE?
│ "What docs pages exist on docs.example.com?"
│ "Find the webhook documentation page"
│ └─→ Firecrawl Map (firecrawl_map)
│ Discover URLs, then scrape the relevant ones
│
├─ STRUCTURED DATA EXTRACTION?
│ "Get all product prices as JSON from this catalog"
│ "Extract API endpoints with parameters"
│ └─→ Firecrawl Extract (firecrawl_extract)
│ Custom JSON schema extraction
│
└─ COMPLEX MULTI-SOURCE?
"Research X across official docs, blogs, and forums"
└─→ Chain: Context7 → Perplexity → Firecrawl
1. Context7: Official library docs (free)
2. Perplexity: Broader knowledge synthesis ($0.02)
3. Firecrawl: Extract from specific URLs found (1 credit each)
Perplexity MCP Tools
perplexity_search
- Best for: Finding URLs, quick fact-checking, ranked results
- Model: Sonar (fast, cheap)
- Output: Search results with URLs, snippets, rankings
perplexity_ask
- Best for: Direct Q&A, conversational answers with citations
- Model: Sonar-Pro (balanced speed/quality)
- Output: Text answer + source citations
- Context: 128K tokens for comprehensive analysis
perplexity_research
- Best for: Deep investigations, detailed reports
- Model: Sonar-Deep-Research
- Output: Comprehensive analysis with multiple sources cited
- Cost: 3-5x more than perplexity_ask
perplexity_reason
- Best for: Logical analysis, structured problem-solving
- Model: Sonar-Reasoning-Pro
- Output: Step-by-step reasoning with conclusions
Firecrawl MCP Tools
firecrawl_scrape
- Best for: Single page content extraction
- Cost: 1 credit (cheapest Firecrawl operation)
- Formats: markdown, JSON, HTML, screenshot, branding
- Tip: Use
onlyMainContent: true to skip headers/footers
- Tip: For JS-rendered pages, add
waitFor: 5000
firecrawl_map
- Best for: Discovering URLs on a site before scraping
- Tip: Use
search parameter to find specific pages
- Workflow: Map → identify relevant URLs → Scrape each
firecrawl_search
- Best for: Web search with optional content extraction
- Alternative to: Perplexity search (but costs credits)
- Tip: Prefer Perplexity for pure search; Firecrawl for search+extract
firecrawl_extract
- Best for: Structured JSON extraction with custom schemas
- Cost: 5-20 credits per extraction
- Required: JSON schema defining expected output structure
- Tip: Only use when you need structured data, not just text
firecrawl_crawl
- Best for: Multi-page bulk extraction
- Cost: Variable (1 credit per page crawled)
- Warning: Can exceed token limits — set
limit and maxDiscoveryDepth
firecrawl_agent
- Cost: 100-1,500+ credits per task (UNPREDICTABLE)
- Use: ONLY as last resort when map+scrape fails
- Warning: Async — requires polling
firecrawl_agent_status
firecrawl_browser_*
- Best for: Interactive automation (forms, clicks, JavaScript)
- Workflow: browser_create → browser_execute → browser_delete
- Use: Only when scrape fails on highly interactive pages
Context7 MCP Tools
resolve-library-id
- Purpose: Map library name to Context7 ID
- Input: Library name (e.g., "react", "prisma", "next.js")
- Output: Library ID (e.g., "/facebook/react")
- Cache: 1hr (very fast on repeat calls)
query-docs
- Purpose: Fetch documentation for a resolved library
- Input: Library ID + specific question
- Output: Relevant docs, API reference, examples
- Cache: 30min for docs content
- Tip: Be specific — "useCallback hook" not just "React"
Chaining Strategies
Strategy 1: Knowledge → Extraction
- Perplexity Ask: "What's the best library for X? Give me the official URL"
- Firecrawl Scrape: Extract clean content from the official page
- Benefit: Perplexity finds the best source; Firecrawl gets clean content
Strategy 2: Docs → Knowledge → Validation
- Context7: Get official library docs for the framework
- Perplexity Ask: "Common patterns for using X with Y"
- Context7: Verify patterns against official docs
- Benefit: Official docs + community knowledge, validated
Strategy 3: Map → Scrape → Synthesize
- Firecrawl Map: Discover all pages on a documentation site
- Firecrawl Scrape: Extract content from relevant pages
- Perplexity Ask: Synthesize findings into actionable answer
- Benefit: Comprehensive coverage + clean synthesis
Strategy 4: Avoid Agent Costs
- Perplexity Research: Get comprehensive answer with sources
- Only use Firecrawl Agent if structured JSON from 5+ sources is required
- Benefit: Cut 90% of autonomous browsing costs
Mandatory Context7 Usage
Quality audits and planners MUST use Context7.
For Quality Audits
Before auditing code:
1. Identify libraries used in the code under review
2. Context7: resolve-library-id for each library
3. Context7: query-docs for current best practices
4. Compare code against official patterns
5. Flag deviations as audit findings with doc links
For Planning Agents
Before designing architecture:
1. List all proposed libraries/frameworks
2. Context7: verify API compatibility for each
3. Context7: check for breaking changes between versions
4. Context7: find recommended integration patterns
5. Include doc-backed justifications in plan
For Code Review
During review:
1. Identify library API calls in changed code
2. Context7: verify correct API usage
3. Context7: check for deprecated methods
4. Flag incorrect usage with links to official docs
Cost Budget Guidelines
For a typical research task:
| Approach |
Cost |
When to Use |
| Context7 only |
Free |
Library docs, API reference |
| Perplexity only |
~$0.02 |
Knowledge Q&A, current events |
| Context7 + Perplexity |
~$0.02 |
Library + broader context |
| Perplexity + Firecrawl Scrape |
~$0.03 |
Knowledge + extraction |
| Full chain (all 3) |
~$0.05 |
Comprehensive research |
| Firecrawl Agent |
$0.08-$1.20 |
AVOID — use chain instead |
Rule: Start cheap (Context7 → Perplexity → Firecrawl Scrape). Only escalate if cheaper tools don't have the answer.
1---2name: research-routing3description: Research Tool Routing4---5# Research Tool Routing67Optimal routing of research tasks across Perplexity MCP, Firecrawl MCP, and Context7 MCP.8Each tool has distinct strengths — use the right one for each job.910## Tool Strengths at a Glance1112| Tool | Best For | Cost | Speed |13|------|----------|------|-------|14| **Context7** | Library/framework docs, API reference | Free | Fast (cached <5ms) |15| **Perplexity Ask** | Knowledge Q&A, current events, fact-checking | ~$0.02/query | Fast |16| **Perplexity Research** | Deep investigations, comprehensive reports | ~$0.10/query | Slow |17| **Firecrawl Scrape** | Extract content from specific URL | 1 credit | Fast |18| **Firecrawl Map** | Discover all URLs on a site | 1 credit | Fast |19| **Firecrawl Extract** | Structured JSON from pages | 5-20 credits | Medium |20| **Firecrawl Agent** | Autonomous multi-page research | 100-1500+ credits | Slow |2122## Decision Tree2324```25What do you need to find out?2627├─ LIBRARY DOCS?28│ "How does React useEffect work?"29│ "What's the Prisma findMany API?"30│ "Next.js App Router conventions?"31│ └─→ Context7 (resolve-library-id → query-docs)32│ Free, current, version-specific, no hallucination33│34├─ GENERAL KNOWLEDGE?35│ "What is the latest in AI?"36│ "Explain event sourcing"37│ "Compare Redis vs Memcached"38│ └─→ Perplexity Ask (perplexity_ask)39│ Fast, cheap, citations included40│41├─ CURRENT EVENTS?42│ "What happened at AWS re:Invent?"43│ "Latest security vulnerability in Log4j?"44│ └─→ Perplexity Search (perplexity_search)45│ Real-time web search with ranked results46│47├─ DEEP RESEARCH?48│ "Comprehensive comparison of 5 auth solutions"49│ "Full analysis of microservice vs monolith tradeoffs"50│ └─→ Perplexity Research (perplexity_research)51│ Deep-Research model, thorough, multiple sources52│53├─ EXTRACT FROM KNOWN URL?54│ "Get the pricing from https://example.com/pricing"55│ "Extract the API reference from this page"56│ └─→ Firecrawl Scrape (firecrawl_scrape)57│ 1 credit, clean markdown or JSON output58│59├─ FIND PAGES ON A SITE?60│ "What docs pages exist on docs.example.com?"61│ "Find the webhook documentation page"62│ └─→ Firecrawl Map (firecrawl_map)63│ Discover URLs, then scrape the relevant ones64│65├─ STRUCTURED DATA EXTRACTION?66│ "Get all product prices as JSON from this catalog"67│ "Extract API endpoints with parameters"68│ └─→ Firecrawl Extract (firecrawl_extract)69│ Custom JSON schema extraction70│71└─ COMPLEX MULTI-SOURCE?72 "Research X across official docs, blogs, and forums"73 └─→ Chain: Context7 → Perplexity → Firecrawl74 1. Context7: Official library docs (free)75 2. Perplexity: Broader knowledge synthesis ($0.02)76 3. Firecrawl: Extract from specific URLs found (1 credit each)77```7879## Perplexity MCP Tools8081### perplexity_search82- **Best for**: Finding URLs, quick fact-checking, ranked results83- **Model**: Sonar (fast, cheap)84- **Output**: Search results with URLs, snippets, rankings8586### perplexity_ask87- **Best for**: Direct Q&A, conversational answers with citations88- **Model**: Sonar-Pro (balanced speed/quality)89- **Output**: Text answer + source citations90- **Context**: 128K tokens for comprehensive analysis9192### perplexity_research93- **Best for**: Deep investigations, detailed reports94- **Model**: Sonar-Deep-Research95- **Output**: Comprehensive analysis with multiple sources cited96- **Cost**: 3-5x more than perplexity_ask9798### perplexity_reason99- **Best for**: Logical analysis, structured problem-solving100- **Model**: Sonar-Reasoning-Pro101- **Output**: Step-by-step reasoning with conclusions102103## Firecrawl MCP Tools104105### firecrawl_scrape106- **Best for**: Single page content extraction107- **Cost**: 1 credit (cheapest Firecrawl operation)108- **Formats**: markdown, JSON, HTML, screenshot, branding109- **Tip**: Use `onlyMainContent: true` to skip headers/footers110- **Tip**: For JS-rendered pages, add `waitFor: 5000`111112### firecrawl_map113- **Best for**: Discovering URLs on a site before scraping114- **Tip**: Use `search` parameter to find specific pages115- **Workflow**: Map → identify relevant URLs → Scrape each116117### firecrawl_search118- **Best for**: Web search with optional content extraction119- **Alternative to**: Perplexity search (but costs credits)120- **Tip**: Prefer Perplexity for pure search; Firecrawl for search+extract121122### firecrawl_extract123- **Best for**: Structured JSON extraction with custom schemas124- **Cost**: 5-20 credits per extraction125- **Required**: JSON schema defining expected output structure126- **Tip**: Only use when you need structured data, not just text127128### firecrawl_crawl129- **Best for**: Multi-page bulk extraction130- **Cost**: Variable (1 credit per page crawled)131- **Warning**: Can exceed token limits — set `limit` and `maxDiscoveryDepth`132133### firecrawl_agent134- **Cost**: 100-1,500+ credits per task (UNPREDICTABLE)135- **Use**: ONLY as last resort when map+scrape fails136- **Warning**: Async — requires polling `firecrawl_agent_status`137138### firecrawl_browser_*139- **Best for**: Interactive automation (forms, clicks, JavaScript)140- **Workflow**: browser_create → browser_execute → browser_delete141- **Use**: Only when scrape fails on highly interactive pages142143## Context7 MCP Tools144145### resolve-library-id146- **Purpose**: Map library name to Context7 ID147- **Input**: Library name (e.g., "react", "prisma", "next.js")148- **Output**: Library ID (e.g., "/facebook/react")149- **Cache**: 1hr (very fast on repeat calls)150151### query-docs152- **Purpose**: Fetch documentation for a resolved library153- **Input**: Library ID + specific question154- **Output**: Relevant docs, API reference, examples155- **Cache**: 30min for docs content156- **Tip**: Be specific — "useCallback hook" not just "React"157158## Chaining Strategies159160### Strategy 1: Knowledge → Extraction1611. **Perplexity Ask**: "What's the best library for X? Give me the official URL"1622. **Firecrawl Scrape**: Extract clean content from the official page1633. **Benefit**: Perplexity finds the best source; Firecrawl gets clean content164165### Strategy 2: Docs → Knowledge → Validation1661. **Context7**: Get official library docs for the framework1672. **Perplexity Ask**: "Common patterns for using X with Y"1683. **Context7**: Verify patterns against official docs1694. **Benefit**: Official docs + community knowledge, validated170171### Strategy 3: Map → Scrape → Synthesize1721. **Firecrawl Map**: Discover all pages on a documentation site1732. **Firecrawl Scrape**: Extract content from relevant pages1743. **Perplexity Ask**: Synthesize findings into actionable answer1754. **Benefit**: Comprehensive coverage + clean synthesis176177### Strategy 4: Avoid Agent Costs1781. **Perplexity Research**: Get comprehensive answer with sources1792. **Only use Firecrawl Agent** if structured JSON from 5+ sources is required1803. **Benefit**: Cut 90% of autonomous browsing costs181182## Mandatory Context7 Usage183184**Quality audits and planners MUST use Context7.**185186### For Quality Audits187```188Before auditing code:189 1. Identify libraries used in the code under review190 2. Context7: resolve-library-id for each library191 3. Context7: query-docs for current best practices192 4. Compare code against official patterns193 5. Flag deviations as audit findings with doc links194```195196### For Planning Agents197```198Before designing architecture:199 1. List all proposed libraries/frameworks200 2. Context7: verify API compatibility for each201 3. Context7: check for breaking changes between versions202 4. Context7: find recommended integration patterns203 5. Include doc-backed justifications in plan204```205206### For Code Review207```208During review:209 1. Identify library API calls in changed code210 2. Context7: verify correct API usage211 3. Context7: check for deprecated methods212 4. Flag incorrect usage with links to official docs213```214215## Cost Budget Guidelines216217For a typical research task:218219| Approach | Cost | When to Use |220|----------|------|-------------|221| Context7 only | Free | Library docs, API reference |222| Perplexity only | ~$0.02 | Knowledge Q&A, current events |223| Context7 + Perplexity | ~$0.02 | Library + broader context |224| Perplexity + Firecrawl Scrape | ~$0.03 | Knowledge + extraction |225| Full chain (all 3) | ~$0.05 | Comprehensive research |226| Firecrawl Agent | $0.08-$1.20 | AVOID — use chain instead |227228**Rule**: Start cheap (Context7 → Perplexity → Firecrawl Scrape). Only escalate if cheaper tools don't have the answer.