Skip to main content
Glama
TrueOleg

MCP Mac Apps Server

by TrueOleg

mongodb_delete_collection

Delete a MongoDB collection from a specified database to remove unwanted data or clean up storage space.

Instructions

Удаляет коллекцию из базы данных

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
databaseNameYesИмя базы данных
collectionNameYesИмя коллекции для удаления

Implementation Reference

  • TypeScript handler function that connects to MongoDB, drops the specified collection, and returns a success or error message.
    private async mongodbDeleteCollection(
      databaseName: string,
      collectionName: string
    ) {
      const client = await this.getMongoClient();
      try {
        const db = client.db(databaseName);
        await db.collection(collectionName).drop();
        return {
          content: [
            {
              type: "text",
              text: `Коллекция "${collectionName}" успешно удалена из базы данных "${databaseName}"`,
            },
          ],
        };
      } catch (error) {
        throw new Error(
          `Ошибка удаления коллекции: ${error instanceof Error ? error.message : String(error)}`
        );
      } finally {
        await client.close();
      }
    }
  • Python handler function that connects to MongoDB using PyMongo, drops the specified collection, and returns a success or error message.
    def mongodb_delete_collection(database_name: str, collection_name: str) -> str:
        """Deletes collection"""
        client = MongoClient(MONGODB_URI)
        try:
            db = client[database_name]
            db[collection_name].drop()
            return (
                f'Collection "{collection_name}" successfully deleted '
                f'from database "{database_name}"'
            )
        except Exception as e:
            raise Exception(f"Error deleting collection: {str(e)}")
        finally:
            client.close()
  • Input schema definition for the mongodb_delete_collection tool in the TypeScript MCP server.
    name: "mongodb_delete_collection",
    description: "Удаляет коллекцию из базы данных",
    inputSchema: {
      type: "object",
      properties: {
        databaseName: {
          type: "string",
          description: "Имя базы данных",
        },
        collectionName: {
          type: "string",
          description: "Имя коллекции для удаления",
        },
      },
      required: ["databaseName", "collectionName"],
    },
  • Input schema definition for the mongodb_delete_collection tool in the Python MCP server.
    "name": "mongodb_delete_collection",
    "description": "Deletes collection from database",
    "inputSchema": {
        "type": "object",
        "properties": {
            "databaseName": {
                "type": "string",
                "description": "Database name",
            },
            "collectionName": {
                "type": "string",
                "description": "Collection name to delete",
            },
        },
        "required": ["databaseName", "collectionName"],
    },
  • src/index.ts:353-357 (registration)
    Dispatch/registration case in the TypeScript tools/call handler that invokes the mongodbDeleteCollection method.
    case "mongodb_delete_collection":
      return await this.mongodbDeleteCollection(
        args?.databaseName as string,
        args?.collectionName as string
      );
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. While 'Удаляет' clearly indicates a destructive mutation, the description lacks critical details: it doesn't specify if deletion is permanent, what permissions are required, whether it affects associated data (e.g., indexes), or what happens on success/failure (e.g., error if collection doesn't exist). This is a significant gap for a destructive tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, direct sentence with zero wasted words. It front-loads the key action ('Удаляет') and resource, making it immediately scannable and efficient. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a destructive mutation tool with no annotations and no output schema, the description is incomplete. It fails to address critical context: the irreversible nature of deletion, required permissions, error conditions (e.g., non-existent collection), or what is returned (e.g., success confirmation or error). Given the complexity and risk, more behavioral transparency is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with both parameters ('databaseName' and 'collectionName') clearly documented in the schema. The description adds no additional parameter semantics beyond implying these two inputs are needed for deletion. This meets the baseline of 3 when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Удаляет' - deletes) and the resource ('коллекцию из базы данных' - collection from the database), making the purpose immediately understandable. It doesn't explicitly differentiate from sibling tools like 'mongodb_delete_document' or 'mongodb_list_collections', but the verb 'deletes' versus 'list' or 'find' provides implicit distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., the collection must exist), exclusions (e.g., cannot delete system collections), or compare to siblings like 'mongodb_delete_document' (which deletes documents within a collection) or 'mongodb_list_collections' (which lists collections without deletion).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/TrueOleg/MCP-expirements'

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