feat: Add contextual documentation retrieval tool#78
Open
mattpodwysocki wants to merge 3 commits intomainfrom
Open
feat: Add contextual documentation retrieval tool#78mattpodwysocki wants to merge 3 commits intomainfrom
mattpodwysocki wants to merge 3 commits intomainfrom
Conversation
Implements get_contextual_docs_tool for intelligent documentation retrieval based on user context, code snippets, and error messages. Features: - Context-aware keyword extraction from text, code, and errors - Intelligent relevance scoring with match explanations - Troubleshooting tips for error messages - Technology-specific filtering (mapbox-gl-js, iOS SDK, Android SDK) - Suggested related topics - Ranked results with excerpts and direct documentation links - 1-hour caching for performance Smarter than simple search - understands full context and provides actionable, targeted documentation guidance. Addresses: #70 Changes: - Add GetContextualDocsTool implementation - Register in toolRegistry.ts - Add comprehensive test coverage (13 tests) - Update CHANGELOG.md with feature details - Update README.md with tool documentation and examples - All 549 tests passing Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Improvements: - Add curated high-value documentation pages for common topics (markers, popups, layers, etc.) - Implement three-stage crawling: index → main pages → linked pages - Add HTML parsing and content extraction from docs pages - Implement singular/plural keyword matching for better curated page discovery - Add linkedom dependency for HTML parsing This allows the tool to return specific, actionable documentation for queries like "adding markers with popups" instead of generic plugin pages. Claude Desktop no longer needs to supplement with web search for common Mapbox questions. All 549 tests passing. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Add Docusaurus-specific selectors (article, [id*="docs-content"], .markdown) - Extract meta descriptions as fallback - Add paragraph/list/code extraction when headings are sparse - Support H4 headings - Add content length limits (2000 chars for paragraph extraction) - Better fallback chain: headings → paragraphs → meta description This fixes content extraction from Mapbox example pages which use Docusaurus and don't have many section headings. Now queries like "popup on hover" work without needing web search fallback. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements
get_contextual_docs_toolfor intelligent documentation retrieval based on user context, code snippets, and error messages.New in this iteration: Multi-stage crawling and curated high-value pages ensure specific, actionable results without requiring web search fallback.
Key Features
🎯 Curated Documentation Pages (NEW)
🔍 Multi-Stage Crawling (NEW)
🧠 Context-Aware Analysis
📊 Intelligent Relevance Scoring
💡 Helpful Extras
Before & After
Before (Original Implementation)
After (With Curated Pages)
Use Cases
Implementation Details
Architecture
linkedomfor fast, lightweight DOM parsingCurated Topics (Expandable)
Dependencies
Testing
✅ 13 comprehensive tests covering:
✅ All 549 project tests passing
Example Usage
In MCP Inspector
{ "context": "adding custom markers with popups to Mapbox GL JS map", "technology": "mapbox-gl-js", "limit": 5 }In Claude Desktop (Natural Language)
Result: Claude receives specific marker/popup documentation and provides direct guidance without web search.
Documentation
Future Enhancements
Addresses
Closes #70
🤖 Generated with Claude Code