@berthojoris/mcp-mysql-server 1.42.2 → 1.43.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 +9 -0
- package/DOCUMENTATIONS.md +41 -6
- package/README.md +3 -3
- package/dist/config/featureConfig.js +14 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.js +27 -0
- package/dist/mcp-server.js +130 -2
- package/dist/tools/analysisTools.d.ts +57 -0
- package/dist/tools/analysisTools.js +544 -13
- package/dist/tools/toolArgumentValidation.js +113 -1
- package/dist/tools/utilityTools.js +10 -1
- package/manifest.json +154 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,15 @@ 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.43.0] - 2026-05-25
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Added `find_tables_by_keyword`, `search_schema`, and `search_data_across_tables` to help agents answer natural-language schema discovery questions such as “which table stores survey data?”.
|
|
12
|
+
- Added keyword filtering and optional TABLE/COLUMN comments to `get_schema_rag_context`.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
- Updated analysis tool totals and version metadata to `1.43.0`.
|
|
16
|
+
|
|
8
17
|
## [1.42.2] - 2026-05-25
|
|
9
18
|
|
|
10
19
|
### Fixed
|
package/DOCUMENTATIONS.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# MySQL MCP Server - Documentation
|
|
2
2
|
|
|
3
|
-
**Last Updated:** 2026-05-
|
|
4
|
-
**Version:** 1.
|
|
5
|
-
**Total Tools:**
|
|
3
|
+
**Last Updated:** 2026-05-25 14:52:30
|
|
4
|
+
**Version:** 1.43.0
|
|
5
|
+
**Total Tools:** 88
|
|
6
6
|
|
|
7
7
|
Comprehensive documentation for the MySQL MCP Server. For quick start, see [README.md](README.md).
|
|
8
8
|
|
|
@@ -134,11 +134,14 @@ Tool enabled = (Has Permission) AND (Has Category OR No categories specified)
|
|
|
134
134
|
- `read_table_schema` - Get table structure
|
|
135
135
|
- `get_all_tables_relationships` - Get all FK relationships
|
|
136
136
|
|
|
137
|
-
### 2. Analysis (
|
|
137
|
+
### 2. Analysis (7 tools)
|
|
138
138
|
- `get_database_summary` - Database overview with statistics
|
|
139
139
|
- `get_schema_erd` - Generate Mermaid.js ER diagram
|
|
140
|
-
- `get_schema_rag_context` - Compact schema for LLM context
|
|
140
|
+
- `get_schema_rag_context` - Compact schema for LLM context, with optional comments and keyword filtering
|
|
141
141
|
- `get_column_statistics` - Column data profiling
|
|
142
|
+
- `find_tables_by_keyword` - Ranked schema keyword search across table names, column names, and comments
|
|
143
|
+
- `search_schema` - Unified discovery for “where is X?” questions using schema metadata and optional sample-data search
|
|
144
|
+
- `search_data_across_tables` - Guarded read-only keyword search across text-like data columns
|
|
142
145
|
|
|
143
146
|
### 3. Data Operations (7 tools)
|
|
144
147
|
- `create_record` - Insert single record
|
|
@@ -270,6 +273,35 @@ await mcp.call("get_database_summary", {
|
|
|
270
273
|
await mcp.call("get_schema_erd", {});
|
|
271
274
|
```
|
|
272
275
|
|
|
276
|
+
### Schema & Data Discovery
|
|
277
|
+
|
|
278
|
+
Use these tools when users ask natural-language questions like “which table stores survey data?” or “where is customer feedback saved?”:
|
|
279
|
+
|
|
280
|
+
```javascript
|
|
281
|
+
// Fast metadata search across table names, column names, and comments
|
|
282
|
+
await mcp.call("find_tables_by_keyword", {
|
|
283
|
+
keyword: "survey",
|
|
284
|
+
search_in: "all",
|
|
285
|
+
limit: 20
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
// Unified discovery with optional guarded sample-data scan
|
|
289
|
+
await mcp.call("search_schema", {
|
|
290
|
+
query: "survey",
|
|
291
|
+
modes: ["table_names", "column_names", "comments", "sample_data"],
|
|
292
|
+
max_results: 20
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
// Direct bounded data scan when the keyword may only exist in row values
|
|
296
|
+
await mcp.call("search_data_across_tables", {
|
|
297
|
+
keyword: "survey",
|
|
298
|
+
max_tables: 20,
|
|
299
|
+
limit_per_table: 3
|
|
300
|
+
});
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
`find_tables_by_keyword` requires `list`; `search_data_across_tables` requires `read`; `search_schema` uses `list` and requires `read` only when `sample_data` mode is enabled.
|
|
304
|
+
|
|
273
305
|
### Data Operations
|
|
274
306
|
|
|
275
307
|
Basic CRUD operations:
|
|
@@ -326,8 +358,11 @@ The server includes analysis tools for database insights:
|
|
|
326
358
|
|
|
327
359
|
- **Database Summary**: Provides readable overviews with statistics
|
|
328
360
|
- **ER Diagram Generation**: Automatic Mermaid.js diagrams
|
|
329
|
-
- **RAG Context**: Compact schema for LLM prompts
|
|
361
|
+
- **RAG Context**: Compact schema for LLM prompts, with optional `TABLE_COMMENT` / `COLUMN_COMMENT` inclusion and keyword filtering
|
|
330
362
|
- **Column Profiling**: Data quality and distribution analysis
|
|
363
|
+
- **Schema Keyword Discovery**: Ranked search for concepts across table names, column names, and metadata comments
|
|
364
|
+
- **Unified Search**: One entry point for schema and bounded sample-data discovery
|
|
365
|
+
- **Guarded Data Search**: Read-only LIKE scans across text-like columns with strict table/result limits
|
|
331
366
|
|
|
332
367
|
### Bulk Operations
|
|
333
368
|
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
**A production-ready Model Context Protocol (MCP) server for MySQL database integration with AI agents**
|
|
6
6
|
|
|
7
|
-
**Last Updated:** 2026-05-25
|
|
7
|
+
**Last Updated:** 2026-05-25 14:52:30
|
|
8
8
|
|
|
9
9
|
[](https://www.npmjs.com/package/@berthojoris/mcp-mysql-server)
|
|
10
10
|
[](https://www.npmjs.com/package/@berthojoris/mcp-mysql-server)
|
|
@@ -294,7 +294,7 @@ Use documentation categories to fine-tune which tools are exposed (Layer 2):
|
|
|
294
294
|
| `constraint_management` | Manage data integrity constraints | `add_check_constraint, add_foreign_key, add_unique_constraint, drop_constraint, drop_foreign_key, list_constraints, list_foreign_keys` |
|
|
295
295
|
| `table_maintenance` | Table optimization, repair, and maintenance | `analyze_table, check_table, flush_table, get_table_size, get_table_status, optimize_table, repair_table, truncate_table` |
|
|
296
296
|
| `query_optimization` | Analyze and optimize SQL queries | `analyze_query, get_optimization_hints` |
|
|
297
|
-
| `analysis` | Data analysis and reporting tools | `get_column_statistics, get_database_summary, get_schema_erd, get_schema_rag_context` |
|
|
297
|
+
| `analysis` | Data analysis, schema discovery, and reporting tools | `find_tables_by_keyword, get_column_statistics, get_database_summary, get_schema_erd, get_schema_rag_context, search_data_across_tables, search_schema` |
|
|
298
298
|
|
|
299
299
|
<details>
|
|
300
300
|
<summary>Copy/paste list (comma-separated, no spaces)</summary>
|
|
@@ -311,7 +311,7 @@ Full category → tool mapping (and examples) lives in **[DOCUMENTATIONS.md →
|
|
|
311
311
|
|
|
312
312
|
## Available Tools
|
|
313
313
|
|
|
314
|
-
The server exposes **
|
|
314
|
+
The server exposes **88 tools** organized into categories (CRUD, seed, schema, discovery, and utilities).
|
|
315
315
|
|
|
316
316
|
- Complete list of tools: **[DOCUMENTATIONS.md → Complete Tools Reference](DOCUMENTATIONS.md#🔧-complete-tools-reference)**
|
|
317
317
|
|
|
@@ -62,6 +62,13 @@ exports.toolCategoryMap = {
|
|
|
62
62
|
getSchemaErd: ToolCategory.LIST,
|
|
63
63
|
get_schema_erd: ToolCategory.LIST,
|
|
64
64
|
getSchemaRagContext: ToolCategory.LIST,
|
|
65
|
+
findTablesByKeyword: ToolCategory.LIST,
|
|
66
|
+
find_tables_by_keyword: ToolCategory.LIST,
|
|
67
|
+
searchSchema: ToolCategory.LIST,
|
|
68
|
+
search_schema: ToolCategory.LIST,
|
|
69
|
+
searchSchemaWithSampleData: ToolCategory.READ,
|
|
70
|
+
searchDataAcrossTables: ToolCategory.READ,
|
|
71
|
+
search_data_across_tables: ToolCategory.READ,
|
|
65
72
|
// CRUD tools
|
|
66
73
|
createRecord: ToolCategory.CREATE,
|
|
67
74
|
readRecords: ToolCategory.READ,
|
|
@@ -287,6 +294,13 @@ exports.toolDocCategoryMap = {
|
|
|
287
294
|
get_schema_erd: DocCategory.ANALYSIS,
|
|
288
295
|
getColumnStatistics: DocCategory.ANALYSIS,
|
|
289
296
|
getSchemaRagContext: DocCategory.ANALYSIS,
|
|
297
|
+
findTablesByKeyword: DocCategory.ANALYSIS,
|
|
298
|
+
find_tables_by_keyword: DocCategory.ANALYSIS,
|
|
299
|
+
searchSchema: DocCategory.ANALYSIS,
|
|
300
|
+
search_schema: DocCategory.ANALYSIS,
|
|
301
|
+
searchSchemaWithSampleData: DocCategory.ANALYSIS,
|
|
302
|
+
searchDataAcrossTables: DocCategory.ANALYSIS,
|
|
303
|
+
search_data_across_tables: DocCategory.ANALYSIS,
|
|
290
304
|
// Full-Text Search
|
|
291
305
|
createFulltextIndex: DocCategory.INDEX_MANAGEMENT,
|
|
292
306
|
fulltextSearch: DocCategory.INDEX_MANAGEMENT,
|
package/dist/index.d.ts
CHANGED
|
@@ -140,11 +140,49 @@ export declare class MySQLMCP {
|
|
|
140
140
|
data?: any;
|
|
141
141
|
error?: string;
|
|
142
142
|
}>;
|
|
143
|
+
findTablesByKeyword(params: {
|
|
144
|
+
keyword: string;
|
|
145
|
+
search_in?: "table_names" | "column_names" | "comments" | "all";
|
|
146
|
+
database?: string;
|
|
147
|
+
limit?: number;
|
|
148
|
+
}): Promise<{
|
|
149
|
+
status: string;
|
|
150
|
+
data?: any;
|
|
151
|
+
error?: string;
|
|
152
|
+
}>;
|
|
153
|
+
searchSchema(params: {
|
|
154
|
+
query: string;
|
|
155
|
+
modes?: Array<"table_names" | "column_names" | "comments" | "sample_data">;
|
|
156
|
+
max_results?: number;
|
|
157
|
+
database?: string;
|
|
158
|
+
tables?: string[];
|
|
159
|
+
columns?: string[];
|
|
160
|
+
max_tables?: number;
|
|
161
|
+
limit_per_table?: number;
|
|
162
|
+
}): Promise<{
|
|
163
|
+
status: string;
|
|
164
|
+
data?: any;
|
|
165
|
+
error?: string;
|
|
166
|
+
}>;
|
|
167
|
+
searchDataAcrossTables(params: {
|
|
168
|
+
keyword: string;
|
|
169
|
+
tables?: string[];
|
|
170
|
+
columns?: string[];
|
|
171
|
+
database?: string;
|
|
172
|
+
limit_per_table?: number;
|
|
173
|
+
max_tables?: number;
|
|
174
|
+
}): Promise<{
|
|
175
|
+
status: string;
|
|
176
|
+
data?: any;
|
|
177
|
+
error?: string;
|
|
178
|
+
}>;
|
|
143
179
|
getSchemaRagContext(params: {
|
|
144
180
|
database?: string;
|
|
145
181
|
max_tables?: number;
|
|
146
182
|
max_columns?: number;
|
|
147
183
|
include_relationships?: boolean;
|
|
184
|
+
include_comments?: boolean;
|
|
185
|
+
keyword_filter?: string;
|
|
148
186
|
}): Promise<{
|
|
149
187
|
status: string;
|
|
150
188
|
data?: any;
|
package/dist/index.js
CHANGED
|
@@ -169,6 +169,33 @@ class MySQLMCP {
|
|
|
169
169
|
}
|
|
170
170
|
return await this.analysisTools.getColumnStatistics(params);
|
|
171
171
|
}
|
|
172
|
+
async findTablesByKeyword(params) {
|
|
173
|
+
const check = this.checkToolEnabled("findTablesByKeyword");
|
|
174
|
+
if (!check.enabled) {
|
|
175
|
+
return { status: "error", error: check.error };
|
|
176
|
+
}
|
|
177
|
+
return await this.analysisTools.findTablesByKeyword(params);
|
|
178
|
+
}
|
|
179
|
+
async searchSchema(params) {
|
|
180
|
+
const check = this.checkToolEnabled("searchSchema");
|
|
181
|
+
if (!check.enabled) {
|
|
182
|
+
return { status: "error", error: check.error };
|
|
183
|
+
}
|
|
184
|
+
if (params?.modes?.includes("sample_data")) {
|
|
185
|
+
const readCheck = this.checkToolEnabled("searchSchemaWithSampleData");
|
|
186
|
+
if (!readCheck.enabled) {
|
|
187
|
+
return { status: "error", error: readCheck.error };
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return await this.analysisTools.searchSchema(params);
|
|
191
|
+
}
|
|
192
|
+
async searchDataAcrossTables(params) {
|
|
193
|
+
const check = this.checkToolEnabled("searchDataAcrossTables");
|
|
194
|
+
if (!check.enabled) {
|
|
195
|
+
return { status: "error", error: check.error };
|
|
196
|
+
}
|
|
197
|
+
return await this.analysisTools.searchDataAcrossTables(params);
|
|
198
|
+
}
|
|
172
199
|
async getSchemaRagContext(params) {
|
|
173
200
|
const check = this.checkToolEnabled("getSchemaRagContext");
|
|
174
201
|
if (!check.enabled) {
|
package/dist/mcp-server.js
CHANGED
|
@@ -18,7 +18,7 @@ const toolArgumentValidation_js_1 = require("./tools/toolArgumentValidation.js")
|
|
|
18
18
|
const permissions = process.env.MCP_PERMISSIONS || process.env.MCP_CONFIG || "";
|
|
19
19
|
const categories = process.env.MCP_CATEGORIES || "";
|
|
20
20
|
const SERVER_NAME = "mysql-mcp-server";
|
|
21
|
-
const SERVER_VERSION = "1.
|
|
21
|
+
const SERVER_VERSION = "1.43.0";
|
|
22
22
|
// Declare the MySQL MCP instance (will be initialized in main())
|
|
23
23
|
let mysqlMCP;
|
|
24
24
|
// Define all available tools with their schemas
|
|
@@ -80,7 +80,7 @@ const TOOLS = [
|
|
|
80
80
|
},
|
|
81
81
|
{
|
|
82
82
|
name: "get_schema_rag_context",
|
|
83
|
-
description: "🎯 AI-OPTIMIZED: Returns ultra-compact schema information (tables, columns, keys, relationships, row estimates) designed specifically for LLM context windows. Use
|
|
83
|
+
description: "🎯 AI-OPTIMIZED: Returns ultra-compact schema information (tables, columns, keys, relationships, comments, row estimates) designed specifically for LLM context windows. Use keyword_filter for concept-focused schema discovery.",
|
|
84
84
|
inputSchema: {
|
|
85
85
|
type: "object",
|
|
86
86
|
properties: {
|
|
@@ -100,7 +100,126 @@ const TOOLS = [
|
|
|
100
100
|
type: "boolean",
|
|
101
101
|
description: "Whether to include FK relationships section (default: true)",
|
|
102
102
|
},
|
|
103
|
+
include_comments: {
|
|
104
|
+
type: "boolean",
|
|
105
|
+
description: "Optional: include TABLE_COMMENT and COLUMN_COMMENT metadata (default: false)",
|
|
106
|
+
},
|
|
107
|
+
keyword_filter: {
|
|
108
|
+
type: "string",
|
|
109
|
+
description: "Optional: only include tables relevant to this keyword, ranked by table names, column names, and comments",
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: "find_tables_by_keyword",
|
|
116
|
+
description: "🔎 Schema discovery: finds candidate tables for a concept or keyword by searching table names, column names, TABLE_COMMENT, and COLUMN_COMMENT metadata. Use when users ask 'which table stores X?' before reading sample data.",
|
|
117
|
+
inputSchema: {
|
|
118
|
+
type: "object",
|
|
119
|
+
properties: {
|
|
120
|
+
keyword: {
|
|
121
|
+
type: "string",
|
|
122
|
+
description: "Concept or keyword to find, such as survey, invoice, feedback, or customer",
|
|
123
|
+
},
|
|
124
|
+
search_in: {
|
|
125
|
+
type: "string",
|
|
126
|
+
enum: ["table_names", "column_names", "comments", "all"],
|
|
127
|
+
description: "Where to search (default: all)",
|
|
128
|
+
},
|
|
129
|
+
database: {
|
|
130
|
+
type: "string",
|
|
131
|
+
description: "Optional: specific database name",
|
|
132
|
+
},
|
|
133
|
+
limit: {
|
|
134
|
+
type: "number",
|
|
135
|
+
description: "Optional: maximum number of ranked tables to return (default 20, max 100)",
|
|
136
|
+
},
|
|
103
137
|
},
|
|
138
|
+
required: ["keyword"],
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
name: "search_schema",
|
|
143
|
+
description: "🧭 Unified schema discovery for natural-language 'where is X?' questions. Searches schema metadata by default and can optionally perform a guarded sample-data scan when mode sample_data is requested.",
|
|
144
|
+
inputSchema: {
|
|
145
|
+
type: "object",
|
|
146
|
+
properties: {
|
|
147
|
+
query: {
|
|
148
|
+
type: "string",
|
|
149
|
+
description: "Concept or keyword to discover",
|
|
150
|
+
},
|
|
151
|
+
modes: {
|
|
152
|
+
type: "array",
|
|
153
|
+
items: {
|
|
154
|
+
type: "string",
|
|
155
|
+
enum: ["table_names", "column_names", "comments", "sample_data"],
|
|
156
|
+
},
|
|
157
|
+
description: "Discovery modes (default: table_names, column_names, comments). sample_data requires read permission.",
|
|
158
|
+
},
|
|
159
|
+
max_results: {
|
|
160
|
+
type: "number",
|
|
161
|
+
description: "Optional: maximum combined results to return (default 20, max 100)",
|
|
162
|
+
},
|
|
163
|
+
database: {
|
|
164
|
+
type: "string",
|
|
165
|
+
description: "Optional: specific database name",
|
|
166
|
+
},
|
|
167
|
+
tables: {
|
|
168
|
+
type: "array",
|
|
169
|
+
items: { type: "string" },
|
|
170
|
+
description: "Optional: restrict sample_data mode to these tables",
|
|
171
|
+
},
|
|
172
|
+
columns: {
|
|
173
|
+
type: "array",
|
|
174
|
+
items: { type: "string" },
|
|
175
|
+
description: "Optional: restrict sample_data mode to these columns",
|
|
176
|
+
},
|
|
177
|
+
max_tables: {
|
|
178
|
+
type: "number",
|
|
179
|
+
description: "Optional: max tables scanned in sample_data mode (default 20, max 100)",
|
|
180
|
+
},
|
|
181
|
+
limit_per_table: {
|
|
182
|
+
type: "number",
|
|
183
|
+
description: "Optional: max matching rows returned per table in sample_data mode (default 5, max 20)",
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
required: ["query"],
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
name: "search_data_across_tables",
|
|
191
|
+
description: "🔍 Guarded read-only keyword scan across text-like table data. Use only when schema metadata does not reveal where a concept is stored; enforces max table and per-table result limits.",
|
|
192
|
+
inputSchema: {
|
|
193
|
+
type: "object",
|
|
194
|
+
properties: {
|
|
195
|
+
keyword: {
|
|
196
|
+
type: "string",
|
|
197
|
+
description: "Keyword to search inside text-like column values",
|
|
198
|
+
},
|
|
199
|
+
tables: {
|
|
200
|
+
type: "array",
|
|
201
|
+
items: { type: "string" },
|
|
202
|
+
description: "Optional: restrict scan to these tables",
|
|
203
|
+
},
|
|
204
|
+
columns: {
|
|
205
|
+
type: "array",
|
|
206
|
+
items: { type: "string" },
|
|
207
|
+
description: "Optional: restrict scan to these column names",
|
|
208
|
+
},
|
|
209
|
+
database: {
|
|
210
|
+
type: "string",
|
|
211
|
+
description: "Optional: specific database name",
|
|
212
|
+
},
|
|
213
|
+
max_tables: {
|
|
214
|
+
type: "number",
|
|
215
|
+
description: "Optional: maximum tables to scan (default 20, max 100)",
|
|
216
|
+
},
|
|
217
|
+
limit_per_table: {
|
|
218
|
+
type: "number",
|
|
219
|
+
description: "Optional: maximum rows returned per table (default 5, max 20)",
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
required: ["keyword"],
|
|
104
223
|
},
|
|
105
224
|
},
|
|
106
225
|
{
|
|
@@ -2306,6 +2425,15 @@ server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
|
|
|
2306
2425
|
case "get_schema_rag_context":
|
|
2307
2426
|
result = await mysqlMCP.getSchemaRagContext((args || {}));
|
|
2308
2427
|
break;
|
|
2428
|
+
case "find_tables_by_keyword":
|
|
2429
|
+
result = await mysqlMCP.findTablesByKeyword((args || {}));
|
|
2430
|
+
break;
|
|
2431
|
+
case "search_schema":
|
|
2432
|
+
result = await mysqlMCP.searchSchema((args || {}));
|
|
2433
|
+
break;
|
|
2434
|
+
case "search_data_across_tables":
|
|
2435
|
+
result = await mysqlMCP.searchDataAcrossTables((args || {}));
|
|
2436
|
+
break;
|
|
2309
2437
|
case "get_column_statistics":
|
|
2310
2438
|
result = await mysqlMCP.getColumnStatistics((args || {}));
|
|
2311
2439
|
break;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { SecurityLayer } from "../security/securityLayer";
|
|
2
|
+
type SchemaSearchScope = "table_names" | "column_names" | "comments" | "all";
|
|
3
|
+
type SearchSchemaMode = "table_names" | "column_names" | "comments" | "sample_data";
|
|
2
4
|
export declare class AnalysisTools {
|
|
3
5
|
private db;
|
|
4
6
|
private security;
|
|
@@ -7,6 +9,13 @@ export declare class AnalysisTools {
|
|
|
7
9
|
* Validate database access - ensures only the connected database can be accessed
|
|
8
10
|
*/
|
|
9
11
|
private validateDatabaseAccess;
|
|
12
|
+
private clampNumber;
|
|
13
|
+
private escapeLikePattern;
|
|
14
|
+
private quoteIdentifier;
|
|
15
|
+
private truncateValue;
|
|
16
|
+
private getMatchScore;
|
|
17
|
+
private addMatchedField;
|
|
18
|
+
private getTablesByName;
|
|
10
19
|
/**
|
|
11
20
|
* Get statistics for a specific column
|
|
12
21
|
*/
|
|
@@ -19,6 +28,51 @@ export declare class AnalysisTools {
|
|
|
19
28
|
data?: any;
|
|
20
29
|
error?: string;
|
|
21
30
|
}>;
|
|
31
|
+
/**
|
|
32
|
+
* Find candidate tables by keyword across schema metadata.
|
|
33
|
+
*/
|
|
34
|
+
findTablesByKeyword(params: {
|
|
35
|
+
keyword: string;
|
|
36
|
+
search_in?: SchemaSearchScope;
|
|
37
|
+
database?: string;
|
|
38
|
+
limit?: number;
|
|
39
|
+
}): Promise<{
|
|
40
|
+
status: string;
|
|
41
|
+
data?: any;
|
|
42
|
+
error?: string;
|
|
43
|
+
}>;
|
|
44
|
+
/**
|
|
45
|
+
* Guarded read-only keyword search across text-like data columns.
|
|
46
|
+
*/
|
|
47
|
+
searchDataAcrossTables(params: {
|
|
48
|
+
keyword: string;
|
|
49
|
+
tables?: string[];
|
|
50
|
+
columns?: string[];
|
|
51
|
+
database?: string;
|
|
52
|
+
limit_per_table?: number;
|
|
53
|
+
max_tables?: number;
|
|
54
|
+
}): Promise<{
|
|
55
|
+
status: string;
|
|
56
|
+
data?: any;
|
|
57
|
+
error?: string;
|
|
58
|
+
}>;
|
|
59
|
+
/**
|
|
60
|
+
* Unified discovery entry point for "where is X?" questions.
|
|
61
|
+
*/
|
|
62
|
+
searchSchema(params: {
|
|
63
|
+
query: string;
|
|
64
|
+
modes?: SearchSchemaMode[];
|
|
65
|
+
max_results?: number;
|
|
66
|
+
database?: string;
|
|
67
|
+
tables?: string[];
|
|
68
|
+
columns?: string[];
|
|
69
|
+
max_tables?: number;
|
|
70
|
+
limit_per_table?: number;
|
|
71
|
+
}): Promise<{
|
|
72
|
+
status: string;
|
|
73
|
+
data?: any;
|
|
74
|
+
error?: string;
|
|
75
|
+
}>;
|
|
22
76
|
/**
|
|
23
77
|
* Build a compact, schema-aware context pack for RAG (tables, PK/FK, columns, row estimates)
|
|
24
78
|
*/
|
|
@@ -27,9 +81,12 @@ export declare class AnalysisTools {
|
|
|
27
81
|
max_tables?: number;
|
|
28
82
|
max_columns?: number;
|
|
29
83
|
include_relationships?: boolean;
|
|
84
|
+
include_comments?: boolean;
|
|
85
|
+
keyword_filter?: string;
|
|
30
86
|
}): Promise<{
|
|
31
87
|
status: string;
|
|
32
88
|
data?: any;
|
|
33
89
|
error?: string;
|
|
34
90
|
}>;
|
|
35
91
|
}
|
|
92
|
+
export {};
|