Skip to main content
Glama

DeleteCollection

Remove a named collection from Astra DB using the MCP Server. Specify the collection name to delete it and manage database storage effectively.

Instructions

Delete a collection from the database

Input Schema

NameRequiredDescriptionDefault
collectionNameYesName of the collection to delete

Input Schema (JSON Schema)

{ "properties": { "collectionName": { "description": "Name of the collection to delete", "type": "string" } }, "required": [ "collectionName" ], "type": "object" }

Implementation Reference

  • The main handler function that executes the deletion of a collection using the database's dropCollection method if available, returning success or error messages.
    export async function DeleteCollection(params: { collectionName: string }) { const { collectionName } = params; try { // Try to use dropCollection if available if (typeof db.dropCollection === 'function') { await db.dropCollection(collectionName); } else { // If dropCollection is not available, log a warning console.warn(`No dropCollection method available for collection '${collectionName}'`); } return { success: true, message: `Collection '${collectionName}' deleted successfully`, }; } catch (error) { console.error(`Error deleting collection '${collectionName}':`, error); return { success: false, message: `Failed to delete collection '${collectionName}'`, }; } }
  • Defines the input schema and metadata for the DeleteCollection tool, specifying that 'collectionName' is a required string parameter.
    { name: "DeleteCollection", description: "Delete a collection from the database", inputSchema: { type: "object", properties: { collectionName: { type: "string", description: "Name of the collection to delete", }, }, required: ["collectionName"], }, },
  • index.ts:127-138 (registration)
    Registers the tool execution in the MCP server's CallToolRequestSchema handler by importing and calling DeleteCollection in the switch statement.
    case "DeleteCollection": const deleteResult = await DeleteCollection({ collectionName: args.collectionName as string, }); return { content: [ { type: "text", text: deleteResult.message, }, ], };

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/datastax/astra-db-mcp'

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