Skip to main content
Glama

list-tables

Retrieve a list of all user tables in a Firebird database. Simplify database navigation and analysis by identifying available tables for querying or management tasks.

Instructions

Lists all user tables in the current Firebird database.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the "list-tables" MCP tool. It calls the underlying listTables() function, handles logging and errors, and returns a formatted response with the list of tables.
    handler: async () => { logger.info("Listing tables in the database"); try { const tables = await listTables(); logger.info(`Found ${tables.length} tables`); return { content: [{ type: "text", text: formatForClaude({ tables }) }] }; } catch (error) { const errorResponse = wrapError(error); logger.error(`Error listando tablas: ${errorResponse.error} [${errorResponse.errorType || 'UNKNOWN'}]`); return { content: [{ type: "text", text: formatForClaude(errorResponse) }] }; } }
  • Zod input schema definition for the "list-tables" tool, which requires no arguments.
    export const ListTablesArgsSchema = z.object({}); // No arguments
  • Registration of the "list-tables" tool within the setupDatabaseTools() function, defining name, description, schema, and handler.
    tools.set("list-tables", { name: "list-tables", description: "Lists all user tables in the current Firebird database.", inputSchema: ListTablesArgsSchema, handler: async () => { logger.info("Listing tables in the database"); try { const tables = await listTables(); logger.info(`Found ${tables.length} tables`); return { content: [{ type: "text", text: formatForClaude({ tables }) }] }; } catch (error) { const errorResponse = wrapError(error); logger.error(`Error listando tablas: ${errorResponse.error} [${errorResponse.errorType || 'UNKNOWN'}]`); return { content: [{ type: "text", text: formatForClaude(errorResponse) }] }; } } });
  • Core helper function listTables() that executes a SQL query on Firebird's RDB$RELATIONS system table to retrieve names of all user tables (excluding system tables and views).
    export const listTables = async (config = DEFAULT_CONFIG): Promise<string[]> => { // Try to load config from global variable first const globalConfig = getGlobalConfig(); if (globalConfig && globalConfig.database) { logger.info(`Using global configuration for listTables: ${globalConfig.database}`); config = globalConfig; } try { logger.info('Obteniendo lista de tablas de usuario'); const sql = ` SELECT RDB$RELATION_NAME FROM RDB$RELATIONS WHERE RDB$SYSTEM_FLAG = 0 AND RDB$VIEW_SOURCE IS NULL ORDER BY RDB$RELATION_NAME `; const tables = await executeQuery(sql, [], config); // Firebird puede devolver nombres con espacios al final, así que hacemos trim const tableNames = tables.map((table: any) => table.RDB$RELATION_NAME.trim()); logger.info(`Se encontraron ${tableNames.length} tablas de usuario`); return tableNames; } catch (error: any) { // Propagar el error si ya es un FirebirdError if (error instanceof FirebirdError) { throw error; } const errorMessage = `Error al listar tablas: ${error.message || error}`; logger.error(errorMessage); throw new FirebirdError(errorMessage, 'TABLE_LIST_ERROR', error); } };

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/PuroDelphi/mcpFirebird'

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