Overview
Thesearch_documents_tool performs hybrid semantic search (combining vector embeddings and BM25) against the OpenGround documentation database to find relevant content from official library documentation.
Always call
list_libraries_tool first to verify which libraries and versions are available before searching.Parameters
The search query text. This will be used for both semantic (embedding-based) and keyword (BM25) search.Example: “How do I configure async timeout settings?”
The name of the library to search within. Must match exactly (case-sensitive) with available libraries.Example: “fastapi”, “django”, “react”
The version of the library documentation to search. Must be an exact match with available versions.Example: “3.11.0”, “latest”, “v4.5.2”
Return Format
Returns a formatted string containing search results. The format varies based on whether matches are found:Successful Search
No Matches
Library Not Found
Version Not Found
Response Fields
Each search result includes:The title of the documentation page or section
The full text content of the matching chunk (not truncated)
The source URL of the documentation page
The version of the documentation
The relevance score from the hybrid search algorithm (lower is more relevant for distance-based metrics)
A JSON object with parameters for calling
get_full_content_tool to retrieve the complete page contentExample Usage
Basic Search
Invalid Library
How It Works
Hybrid Search Algorithm
The tool uses a two-pronged search approach:- Semantic Search: Generates embeddings for the query using
BAAI/bge-small-en-v1.5(384 dimensions) and performs vector similarity search - BM25 Keyword Search: Performs traditional keyword matching using BM25 algorithm
- Fusion: Combines results from both approaches to provide more accurate results
Caching Behavior
- Library metadata: Cached after first call to
list_libraries_with_versions - Embedding model: Pre-loaded in background thread during server startup
- Database connection: Connection pooling for efficient query execution
Query Configuration
The number of results returned is controlled by thetop_k configuration:
- Default: 5 results
- Configurable via
~/.config/openground/config.jsonunderquery.top_k - Maximum recommended: 20 results for optimal performance
Best Practices
Effective Query Writing
- Be specific: “JWT token validation” instead of “security”
- Use technical terms: “async/await” instead of “asynchronous code”
- Include context: “React hooks useState” instead of just “hooks”
- Avoid over-qualification: Don’t include the library name in the query (it’s already filtered)
Following Up on Results
When you need more context from a search result:- Use the embedded
tool_hintJSON object - Call
get_full_content_toolwith the providedurlandversion - This retrieves the complete documentation page (all chunks reassembled)
Troubleshooting
Empty Results
If you getFound 0 matches:
- Try broader search terms
- Check if you’re searching the correct library version
- Verify the documentation actually covers that topic
- Try searching related terms or concepts
Slow Performance
If searches are taking too long:- Wait for background initialization to complete (check server logs)
- Reduce
top_kin configuration - Ensure database is on SSD storage
- Check if embedding model is cached (first query pre-loads it)
Accuracy Issues
If results aren’t relevant:- Refine your query to be more specific
- Try using exact technical terminology from the documentation
- Increase
top_kto see more results - Consider that the content might not exist in that version’s documentation