Skip to main content
Glama
HatriGt

HANA Cloud MCP Server

by HatriGt

hana_list_tables

List all tables in a specific schema within SAP HANA Cloud Database to manage database structure and access data efficiently.

Instructions

List all tables in a specific schema

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
schema_nameNoName of the schema to list tables from (optional)

Implementation Reference

  • The main handler function for the 'hana_list_tables' tool. It handles optional schema_name (defaults from config), validates it, queries tables using QueryExecutor.getTables, formats the result, and returns a formatted response or error.
    static async listTables(args) {
      logger.tool('hana_list_tables', args);
      
      let { schema_name } = args || {};
      
      // Use default schema if not provided
      if (!schema_name) {
        if (config.hasDefaultSchema()) {
          schema_name = config.getDefaultSchema();
          logger.info(`Using default schema: ${schema_name}`);
        } else {
          return Formatters.createErrorResponse(
            'Schema name is required', 
            'Please provide schema_name parameter or set HANA_SCHEMA environment variable'
          );
        }
      }
      
      // Validate schema name
      const schemaValidation = Validators.validateSchemaName(schema_name);
      if (!schemaValidation.valid) {
        return Formatters.createErrorResponse('Invalid schema name', schemaValidation.error);
      }
      
      try {
        const tables = await QueryExecutor.getTables(schema_name);
        const formattedTables = Formatters.formatTableList(tables, schema_name);
        
        return Formatters.createResponse(formattedTables);
      } catch (error) {
        logger.error('Error listing tables:', error.message);
        return Formatters.createErrorResponse('Error listing tables', error.message);
      }
    }
  • The input schema definition for the 'hana_list_tables' tool, defining schema_name as an optional string parameter.
      name: "hana_list_tables",
      description: "List all tables in a specific schema",
      inputSchema: {
        type: "object",
        properties: {
          schema_name: {
            type: "string",
            description: "Name of the schema to list tables from (optional)"
          }
        },
        required: []
      }
    },
  • The TOOL_IMPLEMENTATIONS object registers 'hana_list_tables' mapping to TableTools.listTables, used by ToolRegistry.executeTool to dispatch tool calls.
    const TOOL_IMPLEMENTATIONS = {
      hana_show_config: ConfigTools.showConfig,
      hana_test_connection: ConfigTools.testConnection,
      hana_show_env_vars: ConfigTools.showEnvVars,
      hana_list_schemas: SchemaTools.listSchemas,
      hana_list_tables: TableTools.listTables,
      hana_describe_table: TableTools.describeTable,
      hana_list_indexes: IndexTools.listIndexes,
      hana_describe_index: IndexTools.describeIndex,
      hana_execute_query: QueryTools.executeQuery
    };

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/HatriGt/hana-mcp-server'

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