@berthojoris/mcp-mysql-server 1.15.0 → 1.16.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.
@@ -0,0 +1,94 @@
1
+ import { SecurityLayer } from "../security/securityLayer";
2
+ /**
3
+ * Intelligent Query Assistant
4
+ * Converts natural language to optimized SQL with context-aware query generation
5
+ */
6
+ export declare class IntelligentQueryTools {
7
+ private db;
8
+ private security;
9
+ constructor(security: SecurityLayer);
10
+ /**
11
+ * Validate database access - ensures only the connected database can be accessed
12
+ */
13
+ private validateDatabaseAccess;
14
+ /**
15
+ * Build a natural language query based on intent and context
16
+ * This is the core "Intelligent Query Assistant" feature
17
+ */
18
+ buildQueryFromIntent(params: {
19
+ natural_language: string;
20
+ context?: "analytics" | "reporting" | "data_entry" | "schema_exploration";
21
+ max_complexity?: "simple" | "medium" | "complex";
22
+ safety_level?: "strict" | "moderate" | "permissive";
23
+ database?: string;
24
+ }): Promise<{
25
+ status: string;
26
+ data?: {
27
+ generated_sql: string;
28
+ explanation: string;
29
+ tables_involved: string[];
30
+ columns_involved: string[];
31
+ estimated_complexity: string;
32
+ safety_notes: string[];
33
+ optimization_hints: string[];
34
+ alternatives?: string[];
35
+ };
36
+ error?: string;
37
+ }>;
38
+ /**
39
+ * Get database schema context for query generation
40
+ */
41
+ private getSchemaContext;
42
+ /**
43
+ * Analyze natural language intent
44
+ */
45
+ private analyzeIntent;
46
+ /**
47
+ * Check if a word is a common stop word
48
+ */
49
+ private isStopWord;
50
+ /**
51
+ * Match intent entities to actual schema objects
52
+ */
53
+ private matchEntitiesToSchema;
54
+ /**
55
+ * Calculate similarity score between two strings (simple Jaccard-like)
56
+ */
57
+ private similarityScore;
58
+ /**
59
+ * Generate SQL based on analysis
60
+ */
61
+ private generateSQL;
62
+ /**
63
+ * Estimate query complexity
64
+ */
65
+ private estimateComplexity;
66
+ /**
67
+ * Generate optimization hints
68
+ */
69
+ private generateOptimizationHints;
70
+ /**
71
+ * Generate safety notes
72
+ */
73
+ private generateSafetyNotes;
74
+ /**
75
+ * Suggest query improvements
76
+ */
77
+ suggestQueryImprovements(params: {
78
+ query: string;
79
+ optimization_goal?: "speed" | "memory" | "readability";
80
+ database?: string;
81
+ }): Promise<{
82
+ status: string;
83
+ data?: {
84
+ original_query: string;
85
+ suggestions: Array<{
86
+ type: string;
87
+ description: string;
88
+ improved_query?: string;
89
+ }>;
90
+ estimated_improvement: string;
91
+ };
92
+ error?: string;
93
+ }>;
94
+ }