Skip to main content
Glama

MongoDB MCP Server

Official
by mongodb-js
dropDatabase.ts1.39 kB
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js"; import { DbOperationArgs, MongoDBToolBase } from "../mongodbTool.js"; import type { ToolArgs, OperationType } from "../../tool.js"; export class DropDatabaseTool extends MongoDBToolBase { public name = "drop-database"; protected description = "Removes the specified database, deleting the associated data files"; protected argsShape = { database: DbOperationArgs.database, }; public operationType: OperationType = "delete"; protected async execute({ database }: ToolArgs<typeof this.argsShape>): Promise<CallToolResult> { const provider = await this.ensureConnected(); const result = await provider.dropDatabase(database); return { content: [ { text: `${result.ok ? "Successfully dropped" : "Failed to drop"} database "${database}"`, type: "text", }, ], }; } protected getConfirmationMessage({ database }: ToolArgs<typeof this.argsShape>): string { return ( `You are about to drop the \`${database}\` database:\n\n` + "This operation will permanently remove the database and ALL its collections, documents, and indexes.\n\n" + "**Do you confirm the execution of the action?**" ); } }

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/mongodb-js/mongodb-mcp-server'

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