hana_describe_index
Retrieve the structure of a specific index in SAP HANA Cloud to understand its columns, organization, and properties for database optimization and query performance analysis.
Instructions
Describe the structure of a specific index
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| schema_name | No | Name of the schema containing the table (optional) | |
| table_name | Yes | Name of the table containing the index | |
| index_name | Yes | Name of the index to describe |
Implementation Reference
- src/tools/index-tools.js:82-132 (handler)The handler function IndexTools.describeIndex that implements the core logic for the hana_describe_index tool: validates parameters, fetches index details via QueryExecutor, formats output, and handles errors.static async describeIndex(args) { logger.tool('hana_describe_index', args); let { schema_name, table_name, index_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', 'index_name'], 'hana_describe_index'); if (!validation.valid) { return Formatters.createErrorResponse('Error: table_name and index_name parameters are required', validation.error); } // Validate schema, table, and index 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); } const indexValidation = Validators.validateIndexName(index_name); if (!indexValidation.valid) { return Formatters.createErrorResponse('Invalid index name', indexValidation.error); } try { const results = await QueryExecutor.getIndexDetails(schema_name, table_name, index_name); const formattedDetails = Formatters.formatIndexDetails(results, schema_name, table_name, index_name); return Formatters.createResponse(formattedDetails); } catch (error) { logger.error('Error describing index:', error.message); return Formatters.createErrorResponse('Error describing index', error.message); } }
- The input schema definition for hana_describe_index, specifying properties and required fields: table_name and index_name.name: "hana_describe_index", description: "Describe the structure of a specific index", 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 containing the index" }, index_name: { type: "string", description: "Name of the index to describe" } }, required: ["table_name", "index_name"] } },
- src/tools/index.js:14-24 (registration)Tool registration mapping 'hana_describe_index' to IndexTools.describeIndex in the TOOL_IMPLEMENTATIONS object used by ToolRegistry.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 };