Skip to main content
Glama
wrediam

Better Qdrant MCP Server

list_collections

Retrieve all available Qdrant collections for managing and organizing vector database content in the Better Qdrant MCP Server.

Instructions

List all available Qdrant collections

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The primary handler function for the 'list_collections' MCP tool. It invokes the Qdrant service to list collections, formats the result as JSON text response, and handles errors appropriately.
    private async handleListCollections() { try { const collections = await this.qdrantService.listCollections(); return { content: [ { type: 'text', text: JSON.stringify(collections, null, 2), }, ], }; } catch (error) { console.error('Error in handleListCollections:', error); let errorDetails = ''; if (error instanceof Error) { errorDetails = `${error.name}: ${error.message}\nStack: ${error.stack}`; } else { errorDetails = String(error); } return { content: [ { type: 'text', text: `Error listing collections: ${errorDetails}`, }, ], isError: true, }; } }
  • src/index.ts:108-116 (registration)
    Registration of the 'list_collections' tool in the MCP server, including name, description, and empty input schema (no parameters required).
    { name: 'list_collections', description: 'List all available Qdrant collections', inputSchema: { type: 'object', properties: {}, required: [], }, },
  • The core implementation of listing collections via direct HTTP fetch to Qdrant API /collections endpoint, extracting collection names.
    async listCollections(): Promise<string[]> { try { console.log('Attempting to connect to Qdrant server using direct fetch...'); // Use direct fetch instead of the client const collectionsUrl = `${this.url}/collections`; console.log(`Fetching from: ${collectionsUrl}`); const response = await fetch(collectionsUrl, { method: 'GET', headers: { 'Content-Type': 'application/json', ...(this.apiKey ? { 'api-key': this.apiKey } : {}) }, // @ts-ignore - node-fetch supports timeout timeout: 5000 // 5 second timeout }); if (!response.ok) { throw new Error(`HTTP error! Status: ${response.status}`); } const data = await response.json() as { result: { collections: Array<{ name: string }> } }; console.log('Successfully retrieved collections:', data); return data.result.collections.map(c => c.name); } catch (error) { console.error('Error in listCollections:', error); if (error instanceof Error) { console.error(`${error.name}: ${error.message}`); console.error('Stack:', error.stack); } throw error; } }
  • TypeScript interface definition for the listCollections method in QdrantService, specifying return type as Promise<string[]>.
    listCollections(): Promise<string[]>;

Other Tools

Related Tools

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/wrediam/better-qdrant-mcp-server'

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