list_databases
Retrieve all database names from a SQL Server instance to explore available data sources and manage connections.
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 on sys.databases to retrieve user databases (excluding system ones), formats and returns 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:20-22 (schema)Tool schema definition specifying no input parameters are required.name: 'list_databases', description: 'List all databases on the SQL Server instance', inputSchema: { type: 'object', properties: {} }
- index.js:256-259 (registration)Registration in the main tool dispatch switch statement, routing calls to the DatabaseToolsHandler's listDatabases method.case 'list_databases': return { content: await this.databaseTools.listDatabases() };