listDatabases
Retrieve all database names from a CouchDB instance to manage data storage and access.
Instructions
List all CouchDB databases
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:285-307 (handler)The main handler for the 'listDatabases' tool. It invokes the listDatabases helper function from connection.ts, formats the result as JSON text content, and handles errors appropriately.private async handleListDatabases() { try { const databases = await listDatabases(); return { content: [ { type: 'text', text: JSON.stringify(databases, null, 2), }, ], }; } catch (error: any) { return { content: [ { type: 'text', text: `Error listing databases: ${error.message}`, }, ], isError: true, }; } }
- src/index.ts:69-75 (schema)Input schema definition for the 'listDatabases' tool, specifying an empty object (no parameters required).name: 'listDatabases', description: 'List all CouchDB databases', inputSchema: { type: 'object', properties: {}, }, },
- src/index.ts:232-233 (registration)Tool dispatch registration in the CallToolRequest handler's switch statement, routing calls to the handleListDatabases method.case 'listDatabases': return this.handleListDatabases();
- src/connection.ts:37-39 (helper)Core utility function that performs the actual database listing using the CouchDB nano client.export async function listDatabases(): Promise<string[]> { return couch.db.list(); }