Skip to main content
Glama
TrueOleg

MCP Mac Apps Server

by TrueOleg

mongodb_create_database

Create a new database in MongoDB to organize and store data collections for your application.

Instructions

Создает новую базу данных в MongoDB

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
databaseNameYesИмя базы данных

Implementation Reference

  • The handler function that executes the mongodb_create_database tool logic. Connects to MongoDB using getMongoClient, selects the database, creates and drops a temporary collection to materialize the database, returns success response.
    private async mongodbCreateDatabase(databaseName: string) {
      const client = await this.getMongoClient();
      try {
        const db = client.db(databaseName);
        // Создаем коллекцию, чтобы база данных реально создалась
        await db.createCollection("_temp");
        await db.collection("_temp").drop();
        return {
          content: [
            {
              type: "text",
              text: `База данных "${databaseName}" успешно создана`,
            },
          ],
        };
      } catch (error) {
        throw new Error(
          `Ошибка создания базы данных: ${error instanceof Error ? error.message : String(error)}`
        );
      } finally {
        await client.close();
      }
    }
  • The input schema definition for the mongodb_create_database tool, specifying databaseName as a required string.
      name: "mongodb_create_database",
      description: "Создает новую базу данных в MongoDB",
      inputSchema: {
        type: "object",
        properties: {
          databaseName: {
            type: "string",
            description: "Имя базы данных",
          },
        },
        required: ["databaseName"],
      },
    },
  • src/index.ts:338-340 (registration)
    The switch case registration in the CallToolRequest handler that dispatches to the mongodbCreateDatabase method.
    case "mongodb_create_database":
      return await this.mongodbCreateDatabase(args?.databaseName as string);
  • Python handler function for mongodb_create_database tool with identical logic to create database via temporary collection.
    def mongodb_create_database(database_name: str) -> str:
        """Creates database in MongoDB"""
        client = MongoClient(MONGODB_URI)
        try:
            db = client[database_name]
            # Create temporary collection so database is actually created
            db.create_collection("_temp")
            db["_temp"].drop()
            return f'Database "{database_name}" successfully created'
        except Exception as e:
            raise Exception(f"Error creating database: {str(e)}")
        finally:
            client.close()
  • The input schema for the tool in the Python server's tool list.
        "name": "mongodb_create_database",
        "description": "Creates new database in MongoDB",
        "inputSchema": {
            "type": "object",
            "properties": {
                "databaseName": {
                    "type": "string",
                    "description": "Database name",
                },
            },
            "required": ["databaseName"],
        },
    },
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states 'creates' which implies a write/mutation operation, but doesn't disclose behavioral traits like required permissions, whether it's idempotent, what happens on duplicate names, or error conditions. This is inadequate for a mutation tool with zero annotation coverage.

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, clear sentence in Russian that directly states the tool's purpose without any unnecessary words. It's appropriately sized and front-loaded with the essential information.

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 database creation tool with no annotations and no output schema, the description is insufficient. It doesn't explain what the tool returns (e.g., success confirmation, error details), behavioral aspects like side effects, or usage context. Given the complexity of a write operation, more completeness 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% (the single parameter 'databaseName' has a description in the schema), so the baseline is 3. The tool description adds no additional parameter information beyond what the schema already provides about the database name parameter.

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 ('Создает' - creates) and the resource ('новую базу данных в MongoDB' - new database in MongoDB), making the purpose immediately understandable. It doesn't differentiate from sibling tools like 'mongodb_list_databases' or 'mongodb_create_collection', which would require a 5.

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., MongoDB connection), when not to use it (e.g., if database already exists), or compare it to siblings like 'mongodb_list_databases' for checking existing databases.

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