Skip to content

Add contextual documentation retrieval tool #70

@mattpodwysocki

Description

@mattpodwysocki

Context

Add a smart documentation tool that retrieves relevant Mapbox documentation based on the user's current context (what they're working on, code snippets, error messages).

Motivation

Going beyond simple search, contextual documentation helps AI assistants:

  • Understand what the user is trying to accomplish
  • Provide relevant documentation without explicit queries
  • Help debug issues by matching error patterns
  • Suggest related documentation proactively

Proposed Implementation

Create a new tool: get_contextual_docs_tool

Input Schema:

  • context (string, required) - Description of what user is working on
  • codeSnippet (string, optional) - Relevant code being worked with
  • errorMessage (string, optional) - Error message to help diagnose
  • technology (string, optional) - Specific SDK/API being used

Output:

  • Ranked list of relevant documentation sections
  • Suggested next steps or related topics
  • Links to full documentation

Implementation approach:

  1. Leverage search functionality from Add Documentation Search Tool for AI-powered doc discovery #68
  2. Parse context and extract key concepts
  3. Match against documentation corpus
  4. Rank by relevance to context
  5. Include related/suggested topics

Example usage:

{
  "context": "trying to add custom markers with popups to a map",
  "codeSnippet": "map.addLayer({type: 'symbol', ...})",
  "technology": "mapbox-gl-js"
}

Returns: Marker API docs, popup examples, addLayer reference, related patterns

Acceptance Criteria

  • get_contextual_docs_tool implemented
  • Context parsing and keyword extraction
  • Integration with search functionality
  • Relevance ranking algorithm
  • Tests (unit and integration)
  • Updates CHANGELOG.md
  • Documentation in README.md

Related

Part of enhanced documentation discovery initiative

Depends on: #68 (Documentation Search Tool)

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions