Skip to main content
Glama
MikelA92
by MikelA92

list_database_tables

Retrieve all tables from a specific database to identify available data before executing queries. This read-only operation helps users explore database structure.

Instructions

📑 [SAFE] List all tables in a specific database. Use this to see what tables are available before querying. Risk: None - read-only operation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
databaseIdYesThe ID of the database

Implementation Reference

  • The handler function that implements the list_database_tables tool logic, fetching database metadata and formatting the list of tables.
    /** * List database tables */ async listDatabaseTables(databaseId) { Validators.validateDatabaseId(databaseId); this.logger.debug('Listing database tables', { databaseId }); // Use metadata endpoint as /tables endpoint doesn't exist const metadata = await this.apiClient.makeRequest(`/api/database/${databaseId}/metadata`); const tables = metadata.tables || []; return { content: [ { type: 'text', text: `Tables in Database ${databaseId}: ${tables.map(t => `- ID: ${t.id} | Schema: ${t.schema} | Name: ${t.name}` ).join('\n')}`, }, ], }; }
  • The JSON schema definition for the tool, specifying the input parameters (databaseId).
    { name: 'list_database_tables', description: '📑 [SAFE] List all tables in a specific database. Use this to see what tables are available before querying. Risk: None - read-only operation.', inputSchema: { type: 'object', properties: { databaseId: { type: 'integer', description: 'The ID of the database', minimum: 1, }, }, required: ['databaseId'], }, },
  • The tool registration in the MCP server's executeTool switch statement, dispatching to the handler.
    case 'list_database_tables': return await this.databaseHandlers.listDatabaseTables(args.databaseId);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/MikelA92/metabase-mcp-mab'

If you have feedback or need assistance with the MCP directory API, please join our Discord server