@berthojoris/mcp-mysql-server 1.9.2 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,53 @@ All notable changes to the MySQL MCP Server will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.10.0] - 2025-11-25
9
+
10
+ ### Added
11
+ - **Performance Monitoring** - Complete performance analysis toolkit with 10 new tools:
12
+ - `get_performance_metrics` - Comprehensive metrics (query performance, connections, buffer pool, InnoDB stats)
13
+ - `get_top_queries_by_time` - Identify slowest queries by execution time
14
+ - `get_top_queries_by_count` - Find most frequently executed queries
15
+ - `get_slow_queries` - Queries exceeding custom time thresholds
16
+ - `get_table_io_stats` - Monitor table I/O operations and identify hot tables
17
+ - `get_index_usage_stats` - Track index usage patterns
18
+ - `get_unused_indexes` - Identify unused indexes for optimization
19
+ - `get_connection_pool_stats` - Monitor connection pool health
20
+ - `get_database_health_check` - Comprehensive health assessment with status levels
21
+ - `reset_performance_stats` - Reset performance schema statistics
22
+ - Added comprehensive Performance Monitoring section to DOCUMENTATIONS.md
23
+ - Updated README.md tool count from 109 to 119 tools
24
+ - All performance tools require only `utility` permission (no special setup needed)
25
+
26
+ ### Fixed
27
+ - **test_connection Enhanced Diagnostics** - Significantly improved error reporting:
28
+ - Added error-specific troubleshooting steps for common issues
29
+ - Platform-specific guidance (Windows/Linux/Mac) for MySQL server management
30
+ - Shows current configuration (host, port, user, database) for verification
31
+ - Detects and diagnoses: ECONNREFUSED, ER_ACCESS_DENIED_ERROR, ER_BAD_DB_ERROR, ETIMEDOUT, ENOTFOUND
32
+ - Clear success messages with connection latency
33
+ - **run_query SHOW Support** - Fixed rejection of read-only information queries:
34
+ - Now supports: SHOW TABLES, SHOW DATABASES, SHOW COLUMNS, SHOW CREATE TABLE, etc.
35
+ - Added support for: DESCRIBE, DESC, EXPLAIN, HELP commands
36
+ - These queries work with `read` permission (no `execute` permission needed)
37
+ - **Performance Tools Registration** - Added all 10 performance monitoring tools to `featureConfig.ts`
38
+ - Ensures AI agents can discover and use performance tools correctly
39
+ - All mapped to `ToolCategory.UTILITY` permission
40
+
41
+ ### Changed
42
+ - Enhanced error handling in `test_connection` to return detailed diagnostic information
43
+ - Updated security layer to recognize SHOW, DESCRIBE, EXPLAIN as valid read-only queries
44
+ - Improved error messages throughout with clearer guidance
45
+
46
+ ### Documentation
47
+ - Added "Performance Monitoring" section to DOCUMENTATIONS.md with:
48
+ - Complete tool reference with examples
49
+ - Best practices for regular monitoring
50
+ - Query optimization workflows
51
+ - Common performance patterns and troubleshooting
52
+ - Updated README.md with Performance Monitoring category
53
+ - Updated roadmap to mark Performance Monitoring as completed
54
+
8
55
  ## [1.9.1] - 2025-11-24
9
56
 
10
57
  ### Added
package/DOCUMENTATIONS.md CHANGED
@@ -20,7 +20,8 @@ This file contains detailed documentation for all features of the MySQL MCP Serv
20
20
  12. [Constraint Management](#🔗-constraint-management)
21
21
  13. [Table Maintenance](#🔧-table-maintenance)
22
22
  14. [Process & Server Management](#📊-process--server-management)
23
- 15. [Usage Examples](#📋-usage-examples)
23
+ 15. [Performance Monitoring](#📈-performance-monitoring) - NEW!
24
+ 16. [Usage Examples](#📋-usage-examples)
24
25
  16. [Query Logging & Automatic SQL Display](#📝-query-logging--automatic-sql-display)
25
26
  17. [Security Features](#🔒-security-features)
26
27
  18. [Query Result Caching](#💾-query-result-caching)
@@ -1985,6 +1986,477 @@ Monitor and manage MySQL server processes and configuration.
1985
1986
 
1986
1987
  ---
1987
1988
 
1989
+ ## 📈 Performance Monitoring
1990
+
1991
+ Monitor database performance, identify bottlenecks, and optimize query execution.
1992
+
1993
+ ### Performance Monitoring Tools Overview
1994
+
1995
+ - **`get_performance_metrics`** - Get comprehensive performance metrics
1996
+ - **`get_top_queries_by_time`** - Find slowest queries by execution time
1997
+ - **`get_top_queries_by_count`** - Find most frequently executed queries
1998
+ - **`get_slow_queries`** - Identify queries exceeding time threshold
1999
+ - **`get_table_io_stats`** - Monitor table I/O operations
2000
+ - **`get_index_usage_stats`** - Track index usage statistics
2001
+ - **`get_unused_indexes`** - Identify unused indexes
2002
+ - **`get_connection_pool_stats`** - Monitor connection pool health
2003
+ - **`get_database_health_check`** - Comprehensive health assessment
2004
+ - **`reset_performance_stats`** - Reset performance schema statistics
2005
+
2006
+ **Requirements:**
2007
+ - MySQL Performance Schema must be enabled
2008
+ - Tools use standard `utility` permission
2009
+ - No special permissions required
2010
+
2011
+ ### Get Performance Metrics
2012
+
2013
+ Get comprehensive performance metrics including query performance, connections, buffer pool, and InnoDB statistics.
2014
+
2015
+ **User:** *"Show me the database performance metrics"*
2016
+
2017
+ ```json
2018
+ {
2019
+ "tool": "get_performance_metrics",
2020
+ "arguments": {}
2021
+ }
2022
+ ```
2023
+
2024
+ **Returns:**
2025
+ ```json
2026
+ {
2027
+ "status": "success",
2028
+ "data": {
2029
+ "query_performance": {
2030
+ "total_execution_time_sec": 123.45,
2031
+ "total_lock_time_sec": 2.34,
2032
+ "total_rows_examined": 1000000,
2033
+ "total_rows_sent": 50000,
2034
+ "full_table_scans": 10,
2035
+ "queries_without_indexes": 5
2036
+ },
2037
+ "connections": {
2038
+ "threads_connected": 10,
2039
+ "threads_running": 2,
2040
+ "max_used_connections": 50,
2041
+ "connections": 1000,
2042
+ "aborted_connects": 5
2043
+ },
2044
+ "innodb": {
2045
+ "buffer_pool_hit_ratio": "99.95%",
2046
+ "innodb_rows_read": 500000,
2047
+ "innodb_rows_inserted": 10000
2048
+ },
2049
+ "slow_queries": {
2050
+ "slow_queries": 100,
2051
+ "questions": 100000,
2052
+ "slow_query_percentage": "0.1000%"
2053
+ }
2054
+ }
2055
+ }
2056
+ ```
2057
+
2058
+ ### Get Top Queries by Execution Time
2059
+
2060
+ Identify the slowest queries consuming the most time.
2061
+
2062
+ **User:** *"Show me the top 5 slowest queries"*
2063
+
2064
+ ```json
2065
+ {
2066
+ "tool": "get_top_queries_by_time",
2067
+ "arguments": {
2068
+ "limit": 5
2069
+ }
2070
+ }
2071
+ ```
2072
+
2073
+ **Returns:**
2074
+ ```json
2075
+ {
2076
+ "status": "success",
2077
+ "data": [
2078
+ {
2079
+ "query_pattern": "SELECT * FROM orders WHERE user_id = ?",
2080
+ "execution_count": 1000,
2081
+ "avg_execution_time_sec": 2.5,
2082
+ "max_execution_time_sec": 10.2,
2083
+ "total_execution_time_sec": 2500.0,
2084
+ "rows_examined": 50000,
2085
+ "rows_sent": 1000
2086
+ }
2087
+ ]
2088
+ }
2089
+ ```
2090
+
2091
+ ### Get Top Queries by Execution Count
2092
+
2093
+ Find the most frequently executed queries.
2094
+
2095
+ **User:** *"What queries are executed most often?"*
2096
+
2097
+ ```json
2098
+ {
2099
+ "tool": "get_top_queries_by_count",
2100
+ "arguments": {
2101
+ "limit": 10
2102
+ }
2103
+ }
2104
+ ```
2105
+
2106
+ ### Get Slow Queries
2107
+
2108
+ Find queries exceeding a specific execution time threshold.
2109
+
2110
+ **User:** *"Show me queries taking longer than 2 seconds"*
2111
+
2112
+ ```json
2113
+ {
2114
+ "tool": "get_slow_queries",
2115
+ "arguments": {
2116
+ "limit": 20,
2117
+ "threshold_seconds": 2
2118
+ }
2119
+ }
2120
+ ```
2121
+
2122
+ **Response includes:**
2123
+ - Query pattern (with `?` for parameters)
2124
+ - Execution count and timing statistics
2125
+ - Lock time and rows examined
2126
+ - Number of times executed without indexes
2127
+
2128
+ ### Get Table I/O Statistics
2129
+
2130
+ Monitor read/write operations on tables to identify hot tables.
2131
+
2132
+ **User:** *"Show me table I/O statistics"*
2133
+
2134
+ ```json
2135
+ {
2136
+ "tool": "get_table_io_stats",
2137
+ "arguments": {
2138
+ "limit": 20,
2139
+ "table_schema": "myapp"
2140
+ }
2141
+ }
2142
+ ```
2143
+
2144
+ **Returns:**
2145
+ ```json
2146
+ {
2147
+ "status": "success",
2148
+ "data": [
2149
+ {
2150
+ "table_schema": "myapp",
2151
+ "table_name": "orders",
2152
+ "read_operations": 10000,
2153
+ "write_operations": 5000,
2154
+ "fetch_operations": 8000,
2155
+ "insert_operations": 2000,
2156
+ "update_operations": 2500,
2157
+ "delete_operations": 500,
2158
+ "total_read_time_sec": 45.2,
2159
+ "total_write_time_sec": 23.1
2160
+ }
2161
+ ]
2162
+ }
2163
+ ```
2164
+
2165
+ ### Get Index Usage Statistics
2166
+
2167
+ Track how often indexes are being used.
2168
+
2169
+ **User:** *"Show me index usage statistics"*
2170
+
2171
+ ```json
2172
+ {
2173
+ "tool": "get_index_usage_stats",
2174
+ "arguments": {
2175
+ "limit": 20,
2176
+ "table_schema": "myapp"
2177
+ }
2178
+ }
2179
+ ```
2180
+
2181
+ **Use cases:**
2182
+ - Identify most-used indexes
2183
+ - Verify new indexes are being utilized
2184
+ - Monitor index efficiency
2185
+
2186
+ ### Get Unused Indexes
2187
+
2188
+ Identify indexes that are never used - candidates for removal.
2189
+
2190
+ **User:** *"Find indexes that are not being used"*
2191
+
2192
+ ```json
2193
+ {
2194
+ "tool": "get_unused_indexes",
2195
+ "arguments": {
2196
+ "table_schema": "myapp"
2197
+ }
2198
+ }
2199
+ ```
2200
+
2201
+ **Returns:**
2202
+ ```json
2203
+ {
2204
+ "status": "success",
2205
+ "data": [
2206
+ {
2207
+ "table_schema": "myapp",
2208
+ "table_name": "users",
2209
+ "index_name": "idx_old_field",
2210
+ "column_name": "old_field",
2211
+ "is_non_unique": 1
2212
+ }
2213
+ ]
2214
+ }
2215
+ ```
2216
+
2217
+ **Benefits:**
2218
+ - Unused indexes slow down INSERT/UPDATE/DELETE operations
2219
+ - Removing unused indexes saves storage space
2220
+ - Improves write performance
2221
+
2222
+ ### Get Connection Pool Statistics
2223
+
2224
+ Monitor connection pool health and usage.
2225
+
2226
+ **User:** *"Check connection pool statistics"*
2227
+
2228
+ ```json
2229
+ {
2230
+ "tool": "get_connection_pool_stats",
2231
+ "arguments": {}
2232
+ }
2233
+ ```
2234
+
2235
+ **Returns:**
2236
+ ```json
2237
+ {
2238
+ "status": "success",
2239
+ "data": {
2240
+ "current_status": {
2241
+ "threads_connected": 25,
2242
+ "threads_running": 5,
2243
+ "max_used_connections": 100,
2244
+ "connections": 50000,
2245
+ "aborted_connects": 10
2246
+ },
2247
+ "configuration": {
2248
+ "max_connections": 200,
2249
+ "thread_cache_size": 8,
2250
+ "wait_timeout": 28800
2251
+ },
2252
+ "health_indicators": {
2253
+ "connection_usage_percentage": "12.50%",
2254
+ "max_usage_percentage": "50.00%",
2255
+ "available_connections": 175,
2256
+ "aborted_connection_percentage": "0.0200%",
2257
+ "thread_cache_hit_rate": "95.50%"
2258
+ }
2259
+ }
2260
+ }
2261
+ ```
2262
+
2263
+ ### Get Database Health Check
2264
+
2265
+ Perform a comprehensive health assessment.
2266
+
2267
+ **User:** *"Perform a database health check"*
2268
+
2269
+ ```json
2270
+ {
2271
+ "tool": "get_database_health_check",
2272
+ "arguments": {}
2273
+ }
2274
+ ```
2275
+
2276
+ **Returns:**
2277
+ ```json
2278
+ {
2279
+ "status": "success",
2280
+ "data": {
2281
+ "overall_status": "healthy",
2282
+ "checks": [
2283
+ {
2284
+ "name": "Connection Usage",
2285
+ "status": "healthy",
2286
+ "current": 25,
2287
+ "max": 200,
2288
+ "usage_percentage": "12.50%"
2289
+ },
2290
+ {
2291
+ "name": "Buffer Pool Hit Ratio",
2292
+ "status": "healthy",
2293
+ "hit_ratio": "99.85%"
2294
+ },
2295
+ {
2296
+ "name": "Aborted Connections",
2297
+ "status": "healthy",
2298
+ "aborted": 10,
2299
+ "total": 50000,
2300
+ "abort_rate": "0.0200%"
2301
+ },
2302
+ {
2303
+ "name": "Slow Queries",
2304
+ "status": "healthy",
2305
+ "slow_queries": 50,
2306
+ "total_queries": 100000,
2307
+ "slow_query_rate": "0.0500%"
2308
+ }
2309
+ ],
2310
+ "warnings": [],
2311
+ "errors": []
2312
+ }
2313
+ }
2314
+ ```
2315
+
2316
+ **Status Levels:**
2317
+ - `healthy` - All metrics within acceptable ranges
2318
+ - `warning` - Some metrics need attention
2319
+ - `critical` - Immediate action required
2320
+
2321
+ **Health Checks Include:**
2322
+ - Connection usage (warning >80%, critical >90%)
2323
+ - Buffer pool hit ratio (warning <95%, critical <85%)
2324
+ - Aborted connection rate (warning >1%, critical >5%)
2325
+ - Slow query percentage (warning >1%, critical >5%)
2326
+
2327
+ ### Reset Performance Statistics
2328
+
2329
+ Reset Performance Schema statistics to start fresh monitoring.
2330
+
2331
+ **User:** *"Reset performance statistics"*
2332
+
2333
+ ```json
2334
+ {
2335
+ "tool": "reset_performance_stats",
2336
+ "arguments": {}
2337
+ }
2338
+ ```
2339
+
2340
+ **What gets reset:**
2341
+ - Query digest statistics
2342
+ - Table I/O wait statistics
2343
+ - Index usage statistics
2344
+ - All performance_schema summary tables
2345
+
2346
+ **Use cases:**
2347
+ - Start monitoring from a clean slate
2348
+ - After major application changes
2349
+ - For specific performance testing periods
2350
+
2351
+ ### Performance Monitoring Best Practices
2352
+
2353
+ **Regular Monitoring:**
2354
+ ```json
2355
+ // Daily health check
2356
+ { "tool": "get_database_health_check" }
2357
+
2358
+ // Weekly deep dive
2359
+ { "tool": "get_performance_metrics" }
2360
+ { "tool": "get_top_queries_by_time", "arguments": { "limit": 20 } }
2361
+ { "tool": "get_unused_indexes" }
2362
+ ```
2363
+
2364
+ **Query Optimization Workflow:**
2365
+ 1. Identify slow queries with `get_slow_queries`
2366
+ 2. Analyze execution plan with `explain_query`
2367
+ 3. Check index usage with `get_index_usage_stats`
2368
+ 4. Find unused indexes with `get_unused_indexes`
2369
+ 5. Monitor improvements with `get_performance_metrics`
2370
+
2371
+ **Connection Pool Monitoring:**
2372
+ ```json
2373
+ // Check connection health
2374
+ { "tool": "get_connection_pool_stats" }
2375
+
2376
+ // If issues found, check active processes
2377
+ { "tool": "show_process_list", "arguments": { "full": true } }
2378
+ ```
2379
+
2380
+ **Table I/O Analysis:**
2381
+ ```json
2382
+ // Find hot tables
2383
+ { "tool": "get_table_io_stats", "arguments": { "limit": 10 } }
2384
+
2385
+ // Check specific table indexes
2386
+ { "tool": "get_index_usage_stats", "arguments": { "table_schema": "myapp" } }
2387
+ ```
2388
+
2389
+ ### Common Performance Patterns
2390
+
2391
+ #### Finding Query Bottlenecks
2392
+ ```json
2393
+ // Step 1: Get top slow queries
2394
+ {
2395
+ "tool": "get_top_queries_by_time",
2396
+ "arguments": { "limit": 10 }
2397
+ }
2398
+
2399
+ // Step 2: Check if indexes are being used
2400
+ {
2401
+ "tool": "get_slow_queries",
2402
+ "arguments": {
2403
+ "threshold_seconds": 1,
2404
+ "limit": 20
2405
+ }
2406
+ }
2407
+
2408
+ // Step 3: Review query execution plans
2409
+ {
2410
+ "tool": "explain_query",
2411
+ "arguments": {
2412
+ "query": "SELECT * FROM orders WHERE user_id = 5",
2413
+ "format": "JSON"
2414
+ }
2415
+ }
2416
+ ```
2417
+
2418
+ #### Optimizing Indexes
2419
+ ```json
2420
+ // Step 1: Find unused indexes
2421
+ {
2422
+ "tool": "get_unused_indexes",
2423
+ "arguments": { "table_schema": "myapp" }
2424
+ }
2425
+
2426
+ // Step 2: Check current index usage
2427
+ {
2428
+ "tool": "get_index_usage_stats",
2429
+ "arguments": { "table_schema": "myapp", "limit": 50 }
2430
+ }
2431
+
2432
+ // Step 3: Drop unused indexes (requires DDL permission)
2433
+ {
2434
+ "tool": "drop_index",
2435
+ "arguments": {
2436
+ "table_name": "users",
2437
+ "index_name": "idx_unused"
2438
+ }
2439
+ }
2440
+ ```
2441
+
2442
+ #### Monitoring After Changes
2443
+ ```json
2444
+ // Reset stats before deployment
2445
+ { "tool": "reset_performance_stats" }
2446
+
2447
+ // After deployment, check metrics
2448
+ { "tool": "get_performance_metrics" }
2449
+ { "tool": "get_database_health_check" }
2450
+
2451
+ // Monitor specific queries
2452
+ {
2453
+ "tool": "get_top_queries_by_count",
2454
+ "arguments": { "limit": 10 }
2455
+ }
2456
+ ```
2457
+
2458
+ ---
2459
+
1988
2460
  ## 📋 Usage Examples
1989
2461
 
1990
2462
  ### Example 1: Read Data
@@ -3095,9 +3567,9 @@ MIT License - see [LICENSE](LICENSE) file for details.
3095
3567
 
3096
3568
  #### **Phase 1: Performance & Monitoring** 🚀
3097
3569
  - ✅ **Query result caching** - Dramatically improve response times for repeated queries - **COMPLETED!**
3098
- - [ ] **Performance metrics** - Track query execution times and database performance
3099
- - [ ] **Connection pool monitoring** - Monitor database connection health and usage
3100
- - [ ] **Database health checks** - Comprehensive system health monitoring
3570
+ - **Performance metrics** - Track query execution times and database performance - **COMPLETED!**
3571
+ - **Connection pool monitoring** - Monitor database connection health and usage - **COMPLETED!**
3572
+ - **Database health checks** - Comprehensive system health monitoring - **COMPLETED!**
3101
3573
 
3102
3574
  #### **Phase 2: Data Management** 📊
3103
3575
  - ✅ **Database backup and restore tools** - Essential for production data safety - **COMPLETED!**
@@ -3134,7 +3606,7 @@ MIT License - see [LICENSE](LICENSE) file for details.
3134
3606
  | Data Export/Import (JSON, SQL) | High | Medium | 11 | ✅ COMPLETED |
3135
3607
  | Data Migration | High | High | 12 | ✅ COMPLETED |
3136
3608
  | Schema Versioning | Medium | Medium | 13 | ✅ COMPLETED |
3137
- | Performance Monitoring | High | Medium | 14 | Pending |
3609
+ | Performance Monitoring | High | Medium | 14 | COMPLETED |
3138
3610
  | PostgreSQL Adapter | High | High | 15 | Pending |
3139
3611
  | Audit Logging | Medium | Low | 16 | Pending |
3140
3612
 
package/README.md CHANGED
@@ -439,7 +439,7 @@ Each project can have different permissions - specify as the second argument aft
439
439
 
440
440
  ## Available Tools
441
441
 
442
- The MCP server provides **98 powerful tools** organized into categories:
442
+ The MCP server provides **119 powerful tools** organized into categories:
443
443
 
444
444
  ### Quick Reference
445
445
 
@@ -459,6 +459,7 @@ The MCP server provides **98 powerful tools** organized into categories:
459
459
  | [Constraints](#constraint-management) | 7 | `add_foreign_key`, `add_unique_constraint` |
460
460
  | [Table Maintenance](#table-maintenance) | 8 | `analyze_table`, `optimize_table`, `repair_table` |
461
461
  | [Server Management](#process--server-management) | 9 | `show_process_list`, `explain_query` |
462
+ | [Performance Monitoring](#performance-monitoring) | 10 | `get_performance_metrics`, `get_database_health_check` |
462
463
  | [Cache](#cache-management) | 5 | `get_cache_stats`, `clear_cache` |
463
464
  | [Query Optimization](#query-optimization) | 2 | `analyze_query`, `get_optimization_hints` |
464
465
  | [Backup & Restore](#database-backup--restore) | 5 | `backup_database`, `restore_from_sql` |
@@ -622,6 +623,21 @@ The MCP server provides **98 powerful tools** organized into categories:
622
623
  | `show_binary_logs` | Show binary log files | `utility` |
623
624
  | `show_replication_status` | Show replication status | `utility` |
624
625
 
626
+ ### Performance Monitoring
627
+
628
+ | Tool | Description | Requires |
629
+ |------|-------------|----------|
630
+ | `get_performance_metrics` | Get comprehensive performance metrics | `utility` |
631
+ | `get_top_queries_by_time` | Find slowest queries by execution time | `utility` |
632
+ | `get_top_queries_by_count` | Find most frequently executed queries | `utility` |
633
+ | `get_slow_queries` | Identify queries exceeding time threshold | `utility` |
634
+ | `get_table_io_stats` | Monitor table I/O operations | `utility` |
635
+ | `get_index_usage_stats` | Track index usage statistics | `utility` |
636
+ | `get_unused_indexes` | Identify unused indexes | `utility` |
637
+ | `get_connection_pool_stats` | Monitor connection pool health | `utility` |
638
+ | `get_database_health_check` | Comprehensive health assessment | `utility` |
639
+ | `reset_performance_stats` | Reset performance schema statistics | `utility` |
640
+
625
641
  ### Cache Management
626
642
 
627
643
  | Tool | Description |
@@ -157,6 +157,17 @@ exports.toolCategoryMap = {
157
157
  validateMigrations: ToolCategory.LIST,
158
158
  resetFailedMigration: ToolCategory.DDL,
159
159
  generateMigrationFromDiff: ToolCategory.DDL,
160
+ // Performance monitoring tools
161
+ getPerformanceMetrics: ToolCategory.UTILITY,
162
+ getTopQueriesByTime: ToolCategory.UTILITY,
163
+ getTopQueriesByCount: ToolCategory.UTILITY,
164
+ getSlowQueries: ToolCategory.UTILITY,
165
+ getTableIOStats: ToolCategory.UTILITY,
166
+ getIndexUsageStats: ToolCategory.UTILITY,
167
+ getUnusedIndexes: ToolCategory.UTILITY,
168
+ getConnectionPoolStats: ToolCategory.UTILITY,
169
+ getDatabaseHealthCheck: ToolCategory.UTILITY,
170
+ resetPerformanceStats: ToolCategory.UTILITY,
160
171
  };
161
172
  /**
162
173
  * Class to manage feature configuration based on runtime or environment variables
@@ -15,6 +15,8 @@ declare class DatabaseConnection {
15
15
  testConnection(): Promise<{
16
16
  connected: boolean;
17
17
  latency: number;
18
+ error?: string;
19
+ errorCode?: string;
18
20
  }>;
19
21
  closePool(): Promise<void>;
20
22
  beginTransaction(transactionId: string): Promise<void>;
@@ -93,7 +93,13 @@ class DatabaseConnection {
93
93
  return { connected: true, latency: endTime - startTime };
94
94
  }
95
95
  catch (error) {
96
- return { connected: false, latency: -1 };
96
+ // Return detailed error information for diagnostics
97
+ return {
98
+ connected: false,
99
+ latency: -1,
100
+ error: error?.message || "Unknown connection error",
101
+ errorCode: error?.code || error?.errno || "UNKNOWN",
102
+ };
97
103
  }
98
104
  }
99
105
  async closePool() {