Skip to main content
Glama
TrueOleg

MCP Mac Apps Server

by TrueOleg

mongodb_list_collections

Retrieve all collections from a specified MongoDB database to view available data structures and manage database organization.

Instructions

Получает список коллекций в указанной базе данных

Input Schema

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

Implementation Reference

  • Python implementation of the mongodb_list_collections tool handler using pymongo to list collections in a specified database.
    def mongodb_list_collections(database_name: str) -> str:
        """Gets list of collections"""
        client = MongoClient(MONGODB_URI)
        try:
            db = client[database_name]
            collections = list(db.list_collection_names())
            result = f'Collections in database "{database_name}":\n' + (
                "\n".join(collections) if collections else "No collections found"
            )
            return result
        except Exception as e:
            raise Exception(f"Error getting list of collections: {str(e)}")
        finally:
            client.close()
  • TypeScript implementation of the mongodbListCollections tool handler using MongoDB Node.js driver to list collections in a specified database.
    private async mongodbListCollections(databaseName: string) {
      const client = await this.getMongoClient();
      try {
        const db = client.db(databaseName);
        const collections = await db.listCollections().toArray();
        const collectionNames = collections.map((col) => col.name);
        
        return {
          content: [
            {
              type: "text",
              text: `Коллекции в базе данных "${databaseName}":\n${
                collectionNames.length > 0
                  ? collectionNames.join("\n")
                  : "Коллекции не найдены"
              }`,
            },
          ],
        };
      } catch (error) {
        throw new Error(
          `Ошибка получения списка коллекций: ${error instanceof Error ? error.message : String(error)}`
        );
      } finally {
        await client.close();
      }
  • Input schema definition for the mongodb_list_collections tool in the Python MCP server.
    {
        "name": "mongodb_list_collections",
        "description": "Gets list of collections in specified database",
        "inputSchema": {
            "type": "object",
            "properties": {
                "databaseName": {
                    "type": "string",
                    "description": "Database name",
                },
            },
            "required": ["databaseName"],
        },
    },
  • Input schema definition for the mongodb_list_collections tool in the TypeScript MCP server.
    {
      name: "mongodb_list_collections",
      description: "Получает список коллекций в указанной базе данных",
      inputSchema: {
        type: "object",
        properties: {
          databaseName: {
            type: "string",
            description: "Имя базы данных",
          },
        },
        required: ["databaseName"],
      },
  • src/index.ts:350-351 (registration)
    Registration of the mongodb_list_collections handler in the tool call switch statement in TypeScript MCP server.
    case "mongodb_list_collections":
      return await this.mongodbListCollections(args?.databaseName as string);
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. While 'Получает' implies a read-only operation, it doesn't explicitly state whether this requires authentication, what permissions are needed, whether it's safe to call, what happens with non-existent databases, or what the return format looks like. For a database tool with zero annotation coverage, this is a significant gap.

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, efficient sentence with zero wasted words. It's appropriately sized for a simple listing operation and front-loads the core functionality. Every word earns its place in conveying the essential purpose.

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 listing tool with no annotations and no output schema, the description is insufficient. It doesn't explain what the return value contains (collection names, metadata, etc.), doesn't mention error handling for non-existent databases, and provides no context about authentication requirements or typical usage patterns. The description should do more given the complexity of database operations.

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%, so the schema already documents the single parameter (databaseName). The description adds no additional parameter information beyond what's in the schema - it mentions 'указанной базе данных' (specified database) which is already covered by the parameter description. Baseline 3 is appropriate 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 verb ('Получает' - gets/retrieves) and resource ('список коллекций' - list of collections) with scope ('в указанной базе данных' - in the specified database). It distinguishes from siblings like mongodb_list_databases (which lists databases rather than collections) and mongodb_create_collection (which creates rather than lists). However, it doesn't explicitly differentiate from other read operations like mongodb_find_documents.

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 when to use mongodb_list_collections versus mongodb_list_databases, or when this tool is appropriate versus other MongoDB operations. There's no mention of prerequisites, error conditions, or typical use cases.

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