← All procedures

mongo.collections.list

List all collections in the database

MCPCLI
Package
@procedures/mongo · README
Path
["mongo","collections","list"]
CLI
mark mongo collections list
MCP tool
mongo.collections.list on the dev-tools server
As data
{"$proc":["mongo","collections","list"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/mongo"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["mongo","collections","list"], {});
console.log(JSON.stringify(result));

From the command line

$ mark mongo collections list

As data, in a program

{ "$proc": ["mongo", "collections", "list"], "input": {} }

Input

FieldTypeRequiredDefaultDescription
collectionstringnoThe collection name. It takes the place of metadata.collection.
databasestringnoThe database name (default: the database of the connection)

Output

FieldTypeRequiredDefaultDescription
collectionsstring[]yesThe collection names of the database
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "collection": {
        "description": "The collection name. It takes the place of metadata.collection.",
        "type": "string",
        "minLength": 1
      },
      "database": {
        "description": "The database name (default: the database of the connection)",
        "type": "string",
        "minLength": 1
      }
    }
  },
  "output": {
    "type": "object",
    "properties": {
      "collections": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "The collection names of the database"
      }
    },
    "required": [
      "collections"
    ],
    "additionalProperties": {}
  }
}