Fetch library and framework documentation via context7-mcp and fetch-mcp for comprehensive documentation research with version-specific content.
The doc-fetcher skill provides comprehensive capabilities for fetching library and framework documentation from multiple sources using MCP integrations. This skill helps the Documentation Researcher agent retrieve up-to-date, version-specific documentation that enables informed implementation decisions and adherence to library best practices.
This skill emphasizes:
The doc-fetcher skill ensures that implementation guidance is based on authoritative, current documentation from official sources.
This skill auto-activates when the agent describes:
What it provides:
Context7 Workflow:
# Step 1: Resolve library name to context7 ID
library_id = invoke_mcp(
"context7-mcp",
tool="resolve-library-id",
params={
"libraryName": "fastapi" # or "react", "django", etc.
}
)
# Step 2: Fetch comprehensive documentation
docs = invoke_mcp(
"context7-mcp",
tool="get-library-docs",
params={
"context7CompatibleLibraryID": library_id["library_id"], # e.g., "/tiangolo/fastapi"
"topic": "API routing and dependency injection", # Focus area
"tokens": 3000 # Amount of documentation to retrieve
}
)
# Result contains:
# - documentation: Markdown-formatted docs
# - version: Library version
# - examples: Code examples
# - metadata: Additional context
Context7 Best Practices:
What it provides:
Fetch-MCP Workflow:
# Fetch official documentation page
official_docs = invoke_mcp(
"fetch-mcp",
tool="fetch",
params={
"url": "https://fastapi.tiangolo.com/tutorial/first-steps/",
"prompt": "Extract quick start guide, installation steps, and first API example"
}
)
# Fetch GitHub README
github_readme = invoke_mcp(
"fetch-mcp",
tool="fetch",
params={
"url": "https://github.com/tiangolo/fastapi/blob/master/README.md",
"prompt": "Extract key features, installation, and basic usage examples"
}
)
# Result contains:
# - Extracted content focused on the prompt
# - Markdown-formatted for easy parsing
# - Cleaned and processed for relevance
Fetch-MCP Best Practices:
What it provides:
Multi-Source Workflow:
documentation_sources = {
"primary": {
# Context7: Deep, comprehensive docs
"context7": fetch_via_context7(library_name, topic),
# Official docs: Quick start and guides
"official": fetch_via_fetch_mcp(official_docs_url),
},
"supplementary": {
# GitHub: Latest examples and README
"github": fetch_via_fetch_mcp(github_url),
# Migration guides (if version upgrade)
"migration": fetch_via_fetch_mcp(migration_guide_url) if needs_migration else None,
}
}
# Synthesize documentation from multiple sources
synthesized_docs = synthesize_documentation(documentation_sources)
Source Prioritization:
What it provides:
Version Handling:
# Specify version in context7 (if supported)
docs_v2 = invoke_mcp(
"context7-mcp",
tool="get-library-docs",
params={
"context7CompatibleLibraryID": "/tiangolo/fastapi/v0.100.0", # Version-specific
"topic": "API routing",
"tokens": 2000
}
)
# Fetch version-specific changelog
changelog = invoke_mcp(
"fetch-mcp",
tool="fetch",
params={
"url": "https://github.com/tiangolo/fastapi/blob/master/CHANGELOG.md",
"prompt": "Extract changes between version 0.95.0 and 0.100.0, focusing on breaking changes"
}
)
# Compare versions and identify migration needs
migration_notes = analyze_version_changes(changelog)
What it provides:
Example Extraction:
# Extract examples from context7 docs
examples = []
for code_block in docs["examples"]:
examples.append({
"code": code_block["code"],
"language": code_block["language"],
"description": code_block["description"],
"category": categorize_example(code_block)
})
# Extract examples from official docs
official_examples = extract_code_blocks(official_docs["content"], language="python")
# Combine and deduplicate
all_examples = deduplicate_examples(examples + official_examples)
What it provides:
Caching Strategy:
# Check cache before fetching
cache_key = f"{library_name}:{version}:{topic_hash}"
if cache_key in documentation_cache:
return documentation_cache[cache_key]
# Fetch and cache
docs = fetch_documentation(library_name, version, topic)
documentation_cache[cache_key] = docs
documentation_cache[cache_key]["cached_at"] = datetime.utcnow()
return docs
Cache Invalidation:
Analysis doc → Extract libraries → Identify topics → Prioritize sources
Library name → context7 resolve-library-id → Library ID
Library ID + Topic → get-library-docs → Comprehensive docs
URLs + Prompts → fetch → Supplementary docs
Documentation → Code blocks → Categorized examples
Multiple sources → Prioritize → Combine → Structured output
Use Context7 for Depth
Use Fetch-MCP for Breadth
Focus Documentation Retrieval
Version Awareness
Token Optimization
Source Validation
Curated list of documentation sources:
Documentation fetching strategies:
"Fetch documentation for FastAPI framework focusing on API routing, dependency injection, and Pydantic integration."
# Comprehensive documentation retrieval
# 1. Context7 Documentation
fastapi_docs = {
"library_id": "/tiangolo/fastapi",
"version": "0.100.0",
"documentation": """
# FastAPI API Routing
FastAPI provides a powerful routing system based on Python type hints...
## Dependency Injection
FastAPI's dependency injection system allows you to declare dependencies...
## Pydantic Integration
FastAPI uses Pydantic models for request validation...
""",
"examples": [
{
"title": "Basic API with dependency injection",
"code": """
from fastapi import FastAPI, Depends
app = FastAPI()
def get_query_param(q: str = None):
return {"q": q}
@app.get("/items/")
async def read_items(commons: dict = Depends(get_query_param)):
return commons
""",
"language": "python"
}
]
}
# 2. Official Documentation (fetch-mcp)
official_docs = {
"url": "https://fastapi.tiangolo.com/tutorial/",
"content": """
# First Steps
Create a file `main.py` with:
```python
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
async def root():
return {"message": "Hello World"}
```
Run the server with: `uvicorn main:app --reload`
"""
}
# 3. GitHub README (fetch-mcp)
github_readme = {
"url": "https://github.com/tiangolo/fastapi",
"content": """
# FastAPI
FastAPI framework, high performance, easy to learn, fast to code, ready for production
## Key features:
- Fast: Very high performance, on par with NodeJS and Go
- Fast to code: Increase the speed to develop features by about 200% to 300%
- Fewer bugs: Reduce about 40% of human errors
- Intuitive: Great editor support
- Easy: Designed to be easy to use and learn
- Short: Minimize code duplication
- Robust: Get production-ready code
- Standards-based: Based on OpenAPI and JSON Schema
"""
}
# 4. Synthesized Output
{
"library": "fastapi",
"version": "0.100.0",
"sources": {
"context7": "Primary documentation source",
"official": "Quick start and tutorials",
"github": "Overview and features"
},
"api_routing": {
"overview": "FastAPI provides decorator-based routing...",
"examples": [...],
"best_practices": [...]
},
"dependency_injection": {
"overview": "Dependency injection via Depends()...",
"examples": [...],
"best_practices": [...]
},
"pydantic_integration": {
"overview": "Pydantic models for validation...",
"examples": [...],
"best_practices": [...]
},
"version_notes": "Compatible with Pydantic v2.x"
}
Version: 2.0.0 Auto-Activation: Yes Phase: 2 - Design & Planning Created: 2025-10-29