Overview
Thelist_libraries_tool returns a dictionary of all available documentation libraries in the OpenGround database, along with their available versions. This tool should be called before performing searches to verify which libraries and versions are available.
Parameters
This tool takes no parameters.Return Format
Returns adict[str, list[str]] mapping library names to sorted lists of available versions.
Structure
Ordering
- Library names: Sorted alphabetically
- Versions: Sorted alphabetically (not semantically versioned)
Version sorting is alphabetical, not semantic. So “10.0.0” may appear before “2.0.0”. The actual version strings depend on how they were stored during library ingestion.
Response Fields
Array of version strings available for this library. Each version represents a complete snapshot of the documentation at that version.Example:
["0.104.0", "0.109.0", "latest"]Example Usage
Basic Call
Empty Database
If no libraries have been added yet:How It Works
Metadata Query
The tool executes an efficient database query:- Selects distinct
library_nameandversionpairs from the documents table - Groups results by library name
- Sorts versions within each library
- Caches the complete result set
Caching Strategy
Pre-loading during server startup:The MCP server pre-loads library metadata in a background thread during initialization. This means:
- First call may be instant (if pre-loading completed)
- Subsequent calls are always instant (served from cache)
- Cache persists for the server’s lifetime
Cache Location
The cache is in-memory only:- Module-level cache:
_metadata_cacheinquery.py - Lifetime: Entire server process
- Invalidation: Only on server restart
- Size: Negligible (typically < 10KB even for hundreds of libraries)
Integration Patterns
Verify Before Search
Present Version Selection
Suggest Library Addition
Typical Response Examples
Small Installation
Production Setup
Best Practices
Version Selection Strategy
When multiple versions exist:- Ask the user which version they’re using
- Default to “latest” if available
- Pick newest version string (be careful with alphabetical sorting)
- Match user’s environment if you know their setup
Error Handling
Performance Characteristics
First Call
- Cold start (no cache): 100-500ms depending on database size
- Warm start (pre-loaded): < 1ms
Subsequent Calls
- Always: < 1ms (served from memory)
Database Size Impact
| Document Count | Libraries | First Call (Cold) | Memory Usage |
|---|---|---|---|
| 1,000 | 5 | ~50ms | ~2KB |
| 10,000 | 25 | ~150ms | ~8KB |
| 100,000 | 100 | ~400ms | ~25KB |
| 1,000,000 | 500 | ~800ms | ~100KB |
Troubleshooting
Empty Results
Iflist_libraries_tool() returns {}:
- Check database exists: Verify
~/.local/share/openground/lancedb/contains data - Check table exists: Run
openground listin terminal - Add libraries: Run
openground add <library>to populate database - Check configuration: Verify
db_pathin~/.config/openground/config.json
Outdated Cache
If libraries don’t appear after adding them:- Restart MCP server: Cache invalidates only on restart
- Check server logs: Ensure library was added successfully
- Verify database: Run
openground listto confirm library exists
Missing Expected Libraries
If libraries you added don’t appear:- Check ingestion logs: Ensure
openground addcompleted successfully - Verify version: The exact version string must match
- Check database path: Ensure MCP server is using correct
db_path - Inspect table: Use LanceDB tools to directly query the table