hana_test_connection
Test connectivity to HANA Cloud databases to verify network access and authentication before performing operations.
Instructions
Test connection to HANA database
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/config-tools.js:26-52 (handler)The main handler function that tests the HANA connection using connectionManager.testConnection(), handles configuration checks, formats success/error responses using Formatters.static async testConnection(args) { logger.tool('hana_test_connection'); if (!config.isHanaConfigured()) { const missingConfig = config.getDisplayConfig(); const errorMessage = Formatters.formatConnectionTest(missingConfig, false, 'Missing required configuration'); return Formatters.createErrorResponse('Connection test failed!', errorMessage); } try { const testResult = await connectionManager.testConnection(); const displayConfig = config.getDisplayConfig(); if (testResult.success) { const successMessage = Formatters.formatConnectionTest(displayConfig, true, null, testResult.result); return Formatters.createResponse(successMessage); } else { const errorMessage = Formatters.formatConnectionTest(displayConfig, false, testResult.error); return Formatters.createErrorResponse('Connection test failed!', errorMessage); } } catch (error) { logger.error('Connection test error:', error.message); const displayConfig = config.getDisplayConfig(); const errorMessage = Formatters.formatConnectionTest(displayConfig, false, error.message); return Formatters.createErrorResponse('Connection test failed!', errorMessage); } }
- Defines the tool metadata including name, description, and input schema (no parameters required).{ name: "hana_test_connection", description: "Test connection to HANA database", inputSchema: { type: "object", properties: {}, required: [] } },
- src/tools/index.js:14-24 (registration)Maps the tool name 'hana_test_connection' to its implementation ConfigTools.testConnection 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 };