list_databases
Retrieve a list of all databases available in the MongoDB server to identify data sources for querying and analysis.
Instructions
List all databases in the MongoDB server.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:1011-1022 (handler)Handler for list_databases tool: connects to admin database and calls listDatabases() to retrieve all databases.case 'list_databases': { const adminDb = client.db('admin'); const result = await adminDb.admin().listDatabases(); return { content: [ { type: 'text', text: JSON.stringify(result.databases, null, 2), }, ], }; }
- src/index.ts:312-319 (registration)Tool registration in ListToolsRequestSchema handler, defining name, description, and input schema.{ name: 'list_databases', description: 'List all databases in the MongoDB server.', inputSchema: { type: 'object', properties: {}, }, },
- src/index.ts:315-318 (schema)Input schema definition for list_databases: empty object (no input parameters required).inputSchema: { type: 'object', properties: {}, },