list_databases
Retrieve a complete list of all databases available on the connected SQL Server instance for database exploration and management.
Instructions
List all databases on the SQL Server instance
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- Core handler function that executes a SQL query against sys.databases to list user databases, excluding system databases, and formats the results.async listDatabases() { const query = ` SELECT name as database_name, database_id, create_date, collation_name, state_desc as state FROM sys.databases WHERE name NOT IN ('master', 'tempdb', 'model', 'msdb') ORDER BY name `; const result = await this.executeQuery(query, 'list_databases'); return this.formatResults(result); }
- lib/tools/tool-registry.js:19-23 (registration)Tool registration definition including name, description, and empty input schema (no parameters required). Used by MCP server to list available tools.{ name: 'list_databases', description: 'List all databases on the SQL Server instance', inputSchema: { type: 'object', properties: {} } },
- lib/tools/tool-registry.js:22-22 (schema)Input schema definition: empty object since list_databases takes no parameters.inputSchema: { type: 'object', properties: {} }
- index.js:256-259 (handler)MCP tool dispatch handler that delegates list_databases calls to the DatabaseToolsHandler instance.case 'list_databases': return { content: await this.databaseTools.listDatabases() };