Skip to main content
Glama

docs-mcp-server

ListLibrariesTool.ts1.77 kB
import type { IDocumentManagement } from "../store/trpc/interfaces"; import type { VersionStatus, VersionSummary } from "../store/types"; // Define the structure for the tool's output, using the detailed version info export interface LibraryInfo { name: string; versions: Array<{ version: string; documentCount: number; uniqueUrlCount: number; indexedAt: string | null; status: VersionStatus; // Progress is omitted for COMPLETED versions to reduce noise progress?: { pages: number; maxPages: number }; sourceUrl?: string | null; }>; } export interface ListLibrariesResult { libraries: LibraryInfo[]; } /** * Tool for listing all available libraries and their indexed versions in the store. */ export class ListLibrariesTool { private docService: IDocumentManagement; constructor(docService: IDocumentManagement) { this.docService = docService; } async execute(_options?: Record<string, never>): Promise<ListLibrariesResult> { // docService.listLibraries() now returns the detailed structure directly const rawLibraries = await this.docService.listLibraries(); // The structure returned by listLibraries already matches LibraryInfo[] // No complex mapping is needed here anymore, just ensure the names match const libraries: LibraryInfo[] = rawLibraries.map(({ library, versions }) => ({ name: library, versions: versions.map((v: VersionSummary) => ({ version: v.ref.version, documentCount: v.counts.documents, uniqueUrlCount: v.counts.uniqueUrls, indexedAt: v.indexedAt, status: v.status, ...(v.progress ? { progress: v.progress } : undefined), sourceUrl: v.sourceUrl, })), })); return { libraries }; } }

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/arabold/docs-mcp-server'

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