FinWiz Context7 Integration
Key Principle: Proactively use Context7 MCP tools to fetch current library documentation. Don't wait for explicit requests - if you're implementing something with an external library, automatically get the docs.
When to Use Context7
Use Context7 tools automatically for:
- Code generation involving external libraries (CrewAI, Pydantic, pytest, etc.)
- Setup and configuration steps for dependencies
- Library/API documentation lookups for accurate implementation
- Version-specific features to ensure compatibility
- Best practices for library usage patterns
Context7 Workflow
Step 1: Resolve Library ID
// Use MCP tool to find the correct library
mcp_context7_resolve_library_id("crewai")
// Returns: "/joaomdmoura/crewai"
Step 2: Get Library Documentation
// Fetch relevant documentation
mcp_context7_get_library_docs(
"/joaomdmoura/crewai",
topic="flow state management",
tokens=5000
)
Step 3: Implement Using Current Patterns
Use the fetched documentation to implement code with:
- Current API methods (not deprecated ones)
- Proper parameter names and types
- Best practices from the library maintainers
- Version-compatible features
FinWiz-Specific Libraries
Common libraries that benefit from Context7 lookup:
| Library | Context7 ID | Common Topics |
|---|---|---|
| CrewAI | /joaomdmoura/crewai |
flow, agents, tasks, crews |
| Pydantic | /pydantic/pydantic |
validation, strict mode, v2 |
| pytest | /pytest-dev/pytest |
fixtures, markers, parametrize |
| pytest-mock | /pytest-dev/pytest-mock |
mocker fixture, patching |
| httpx | /encode/httpx |
async client, authentication |
| pandas | /pandas-dev/pandas |
dataframes, operations |
| FastAPI | /tiangolo/fastapi |
endpoints, dependencies |
Example Usage Patterns
CrewAI Flow Implementation
// 1. Resolve library
mcp_context7_resolve_library_id("crewai")
// 2. Get Flow documentation
mcp_context7_get_library_docs(
"/joaomdmoura/crewai",
topic="flow state management pydantic models",
tokens=7000
)
// 3. Implement using current patterns
Pydantic Model Validation
// Get current Pydantic v2 patterns
mcp_context7_get_library_docs(
"/pydantic/pydantic",
topic="strict mode validation extra forbid",
tokens=4000
)
Testing with pytest-mock
// Get current pytest-mock patterns (unittest.mock is BANNED)
mcp_context7_get_library_docs(
"/pytest-dev/pytest-mock",
topic="mocker fixture patching best practices",
tokens=3000
)
Benefits
Accuracy
- Current APIs: Use latest library methods, not deprecated ones
- Correct Parameters: Get proper parameter names and types
- Version Compatibility: Ensure code works with installed versions
Efficiency
- Avoid Errors: Prevent using outdated or incorrect patterns
- Best Practices: Follow library maintainer recommendations
- Faster Development: Get accurate info immediately
Compliance
- Library Standards: Follow official library patterns
- FinWiz Standards: Combine with existing FinWiz steering rules
- Quality Assurance: Reduce bugs from incorrect usage
Integration with FinWiz Standards
Context7 documentation should be used in conjunction with FinWiz steering rules:
- Validate patterns against
finwiz-crewaiskill - Ensure testing follows
finwiz-testingskill - Apply validation per
finwiz-validationskill - Maintain quality per
finwiz-developmentskill
Proactive Usage Examples
When You See These Patterns, Use Context7:
# Implementing CrewAI Flow → Get CrewAI docs
class MyFlow(Flow[StateModel]):
# Auto-fetch CrewAI Flow documentation
# Creating Pydantic models → Get Pydantic docs
class MyModel(BaseModel):
# Auto-fetch Pydantic v2 documentation
# Writing tests with mocker → Get pytest-mock docs
def test_example(mocker):
# Auto-fetch pytest-mock documentation
# Making HTTP requests → Get httpx docs
async with httpx.AsyncClient() as client:
# Auto-fetch httpx documentation
Token Management
Adjust token limits based on complexity:
- Simple lookups: 3000 tokens
- Standard usage: 5000 tokens (default)
- Complex implementations: 7000-10000 tokens
- Comprehensive guides: 15000+ tokens
Error Handling
If Context7 lookup fails:
- Continue with existing knowledge but note the limitation
- Use FinWiz steering rules as fallback guidance
- Document the assumption in code comments
- Suggest manual verification if critical
Quality Assurance
After using Context7:
- Verify patterns match FinWiz standards
- Test implementation thoroughly
- Document any deviations from standard patterns
- Update FinWiz skills if new patterns emerge
Remember: Context7 provides the what (current library APIs), FinWiz skills provide the how (project-specific patterns and standards).