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.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "list_databases"
}
}Input 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: {}, },