Skip to main content
Glama
HatriGt

HANA Cloud MCP Server

by HatriGt

hana_list_indexes

Retrieve all indexes for a specified table in SAP HANA Cloud Database to analyze database structure and optimize queries.

Instructions

List all indexes for a specific table

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
schema_nameNoName of the schema containing the table (optional)
table_nameYesName of the table to list indexes for

Implementation Reference

  • Main handler function for 'hana_list_indexes' tool. Handles input validation, schema defaulting, executes query to fetch indexes, groups and formats results, and returns formatted response.
    static async listIndexes(args) {
      logger.tool('hana_list_indexes', args);
      
      let { schema_name, table_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 required parameters
      const validation = Validators.validateRequired(args, ['table_name'], 'hana_list_indexes');
      if (!validation.valid) {
        return Formatters.createErrorResponse('Error: table_name parameter is required', validation.error);
      }
      
      // Validate schema and table names
      const schemaValidation = Validators.validateSchemaName(schema_name);
      if (!schemaValidation.valid) {
        return Formatters.createErrorResponse('Invalid schema name', schemaValidation.error);
      }
      
      const tableValidation = Validators.validateTableName(table_name);
      if (!tableValidation.valid) {
        return Formatters.createErrorResponse('Invalid table name', tableValidation.error);
      }
      
      try {
        const results = await QueryExecutor.getTableIndexes(schema_name, table_name);
        
        if (results.length === 0) {
          return Formatters.createResponse(`📋 No indexes found for table '${schema_name}.${table_name}'.`);
        }
        
        // Group by index name
        const indexMap = {};
        results.forEach(row => {
          if (!indexMap[row.INDEX_NAME]) {
            indexMap[row.INDEX_NAME] = {
              type: row.INDEX_TYPE,
              isUnique: row.IS_UNIQUE === 'TRUE',
              columns: []
            };
          }
          indexMap[row.INDEX_NAME].columns.push(row.COLUMN_NAME);
        });
        
        const formattedIndexes = Formatters.formatIndexList(indexMap, schema_name, table_name);
        
        return Formatters.createResponse(formattedIndexes);
      } catch (error) {
        logger.error('Error listing indexes:', error.message);
        return Formatters.createErrorResponse('Error listing indexes', error.message);
      }
    }
  • Tool implementation mapping where 'hana_list_indexes' is registered to IndexTools.listIndexes method.
    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
    };
  • Input schema definition for the 'hana_list_indexes' tool, specifying parameters and requirements.
    {
      name: "hana_list_indexes",
      description: "List all indexes for a specific table",
      inputSchema: {
        type: "object",
        properties: {
          schema_name: {
            type: "string",
            description: "Name of the schema containing the table (optional)"
          },
          table_name: {
            type: "string",
            description: "Name of the table to list indexes for"
          }
        },
        required: ["table_name"]
      }
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden for behavioral disclosure. It states it 'lists' indexes, implying a read-only operation, but doesn't clarify if this requires specific permissions, what format the output takes (e.g., list of names vs. detailed properties), or if there are limitations like pagination or performance considerations for large tables. The description adds minimal context beyond the basic action.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's front-loaded with the core action ('List all indexes'), making it easy to parse. Every word earns its place, with no redundancy or fluff.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete for a tool that likely returns structured data about indexes. It doesn't hint at what information is included in the listing (e.g., index names, types, columns) or any behavioral aspects like error handling. For a database tool with potential complexity, more context is needed to guide effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with both parameters ('schema_name' and 'table_name') clearly documented in the schema. The description mentions 'for a specific table', aligning with the 'table_name' parameter, but adds no additional meaning about parameter usage, defaults, or constraints beyond what the schema provides. This meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('List') and resource ('all indexes for a specific table'), making the purpose immediately understandable. It distinguishes from siblings like 'hana_describe_index' (which likely provides detailed metadata) and 'hana_list_tables' (which lists tables rather than indexes). However, it doesn't explicitly mention the database system (HANA) or differentiate from 'hana_describe_table', which might also include index information.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't specify if this is for quick overviews vs. detailed analysis, or mention prerequisites like connection requirements. Siblings like 'hana_describe_index' and 'hana_describe_table' could potentially overlap in functionality, but no comparison is offered.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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