list_databases
Retrieve a list of all databases available on the MongoDB MCP Server to facilitate direct querying and data analysis for AI assistants.
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 the 'list_databases' tool. Connects to the MongoDB admin database and calls listDatabases() to retrieve all databases, returning the result as JSON-formatted text.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)Registration of the 'list_databases' tool in the ListToolsRequestSchema handler, including name, description, and input schema (no required parameters).{ name: 'list_databases', description: 'List all databases in the MongoDB server.', inputSchema: { type: 'object', properties: {}, }, },
- src/index.ts:315-318 (schema)Input schema for 'list_databases' tool: empty object (no parameters required).inputSchema: { type: 'object', properties: {}, },