Skip to main content
Glama

list_cached_repositories

Retrieve all GitHub repositories with documentation currently stored in cache for quick access to repository information through natural language queries.

Instructions

List all repositories currently cached

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler for the 'list_cached_repositories' tool call. It invokes cacheManager.listRepositories() and returns the result as JSON-formatted text content.
    case 'list_cached_repositories': { const repos = await cacheManager.listRepositories(); return { content: [ { type: 'text', text: JSON.stringify(repos, null, 2), }, ], }; }
  • src/server.ts:100-107 (registration)
    Registration of the 'list_cached_repositories' tool in the ListTools response, including name, description, and input schema.
    { name: 'list_cached_repositories', description: 'List all repositories currently cached', inputSchema: { type: 'object', properties: {}, }, },
  • Input schema for the 'list_cached_repositories' tool, which requires no parameters.
    inputSchema: { type: 'object', properties: {}, },
  • Core implementation of listing cached repositories. Scans memory cache and disk cache files, filters by TTL, collects repo info, cleans expired entries, and sorts by lastUpdated.
    async listRepositories(): Promise<Array<{ owner: string; repo: string; lastUpdated: Date; size: number }>> { const repositories: Array<{ owner: string; repo: string; lastUpdated: Date; size: number }> = []; // Check memory cache for (const [key, entry] of this.memoryCache.entries()) { if (Date.now() - entry.timestamp < entry.ttl) { const [owner, repo] = key.split('/'); if (owner && repo) { repositories.push({ owner, repo, lastUpdated: entry.docs.lastUpdated, size: entry.docs.metadata.size, }); } } } // Check disk cache try { const files = await fs.readdir(this.cacheDir); for (const file of files) { if (file.endsWith('.json')) { try { const filePath = path.join(this.cacheDir, file); const data = await fs.readFile(filePath, 'utf-8'); const entry: CacheEntry = JSON.parse(data); if (Date.now() - entry.timestamp < entry.ttl) { const [owner, repo] = file.replace('.json', '').split('_'); if (owner && repo) { repositories.push({ owner, repo, lastUpdated: entry.docs.lastUpdated, size: entry.docs.metadata.size, }); } } else { // Expired, remove it await fs.unlink(filePath).catch(() => {}); } } catch { // Skip corrupted cache files } } } } catch { // Cache directory doesn't exist or can't be read } return repositories.sort((a, b) => b.lastUpdated.getTime() - a.lastUpdated.getTime()); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cbuntingde/codewiki-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server