get-tables
Retrieve a comprehensive list of all tables within a Microsoft SQL Server database using the MCP server, enabling efficient database exploration and management.
Instructions
Get a list of all tables in the database
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/schema.ts:64-74 (handler)Implements the core logic for the 'get-tables' tool by querying INFORMATION_SCHEMA.TABLES to retrieve and return a list of base tables in the database.async getTables() { const tables = await database.query(` SELECT TABLE_NAME, TABLE_TYPE FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' `); if (!tables.length) return this.toResult("No tables found in the database."); return this.toResult(`Tables found in the database:\n${JSON.stringify(tables)}`); }
- src/tools/schema.ts:10-14 (registration)Registers the 'get-tables' tool with the MCP server, providing its name, description, and binding it to the getTables handler method.server.tool( "get-tables", "Get a list of all tables in the database", tools.getTables.bind(tools) );