@berthojoris/mcp-mysql-server 1.0.2 → 1.2.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.
@@ -12,6 +12,38 @@ class StoredProcedureTools {
12
12
  this.db = connection_1.default.getInstance();
13
13
  this.security = security;
14
14
  }
15
+ /**
16
+ * Validate database access - ensures only the connected database can be accessed
17
+ */
18
+ validateDatabaseAccess(requestedDatabase) {
19
+ const connectedDatabase = config_1.dbConfig.database;
20
+ if (!connectedDatabase) {
21
+ return {
22
+ valid: false,
23
+ database: '',
24
+ error: 'No database specified in connection string. Cannot access any database.'
25
+ };
26
+ }
27
+ // If no database is requested, use the connected database
28
+ if (!requestedDatabase) {
29
+ return {
30
+ valid: true,
31
+ database: connectedDatabase
32
+ };
33
+ }
34
+ // If a specific database is requested, ensure it matches the connected database
35
+ if (requestedDatabase !== connectedDatabase) {
36
+ return {
37
+ valid: false,
38
+ database: '',
39
+ error: `Access denied. You can only access the connected database '${connectedDatabase}'. Requested database '${requestedDatabase}' is not allowed.`
40
+ };
41
+ }
42
+ return {
43
+ valid: true,
44
+ database: connectedDatabase
45
+ };
46
+ }
15
47
  /**
16
48
  * List all stored procedures in the current database
17
49
  */
@@ -24,13 +56,15 @@ class StoredProcedureTools {
24
56
  error: 'Invalid parameters: ' + JSON.stringify(schemas_1.validateListStoredProcedures.errors)
25
57
  };
26
58
  }
27
- const database = params.database || config_1.dbConfig.database;
28
- if (!database) {
59
+ // Validate database access
60
+ const dbValidation = this.validateDatabaseAccess(params.database);
61
+ if (!dbValidation.valid) {
29
62
  return {
30
63
  status: 'error',
31
- error: 'No database specified and no current database selected'
64
+ error: dbValidation.error
32
65
  };
33
66
  }
67
+ const database = dbValidation.database;
34
68
  const query = `
35
69
  SELECT
36
70
  ROUTINE_NAME as name,
@@ -72,14 +106,16 @@ class StoredProcedureTools {
72
106
  error: 'Invalid parameters: ' + JSON.stringify(schemas_1.validateGetStoredProcedureInfo.errors)
73
107
  };
74
108
  }
75
- const { procedure_name } = params;
76
- const database = params.database || config_1.dbConfig.database;
77
- if (!database) {
109
+ // Validate database access
110
+ const dbValidation = this.validateDatabaseAccess(params.database);
111
+ if (!dbValidation.valid) {
78
112
  return {
79
113
  status: 'error',
80
- error: 'No database specified and no current database selected'
114
+ error: dbValidation.error
81
115
  };
82
116
  }
117
+ const { procedure_name } = params;
118
+ const database = dbValidation.database;
83
119
  // Get procedure information
84
120
  const procedureQuery = `
85
121
  SELECT
@@ -148,14 +184,16 @@ class StoredProcedureTools {
148
184
  };
149
185
  }
150
186
  try {
151
- const { procedure_name, parameters = [] } = params;
152
- const database = params.database || config_1.dbConfig.database;
153
- if (!database) {
187
+ // Validate database access
188
+ const dbValidation = this.validateDatabaseAccess(params.database);
189
+ if (!dbValidation.valid) {
154
190
  return {
155
191
  status: 'error',
156
- error: 'No database specified and no current database selected'
192
+ error: dbValidation.error
157
193
  };
158
194
  }
195
+ const { procedure_name, parameters = [] } = params;
196
+ const database = dbValidation.database;
159
197
  // Validate procedure name
160
198
  const identifierValidation = this.security.validateIdentifier(procedure_name);
161
199
  if (!identifierValidation.valid) {
@@ -260,14 +298,16 @@ class StoredProcedureTools {
260
298
  };
261
299
  }
262
300
  try {
263
- const { procedure_name, parameters = [], body, comment } = params;
264
- const database = params.database || config_1.dbConfig.database;
265
- if (!database) {
301
+ // Validate database access
302
+ const dbValidation = this.validateDatabaseAccess(params.database);
303
+ if (!dbValidation.valid) {
266
304
  return {
267
305
  status: 'error',
268
- error: 'No database specified and no current database selected'
306
+ error: dbValidation.error
269
307
  };
270
308
  }
309
+ const { procedure_name, parameters = [], body, comment } = params;
310
+ const database = dbValidation.database;
271
311
  // Validate procedure name
272
312
  const identifierValidation = this.security.validateIdentifier(procedure_name);
273
313
  if (!identifierValidation.valid) {
@@ -327,14 +367,16 @@ class StoredProcedureTools {
327
367
  error: 'Invalid parameters: ' + JSON.stringify(schemas_1.validateDropStoredProcedure.errors)
328
368
  };
329
369
  }
330
- const { procedure_name, if_exists = false } = params;
331
- const database = params.database || config_1.dbConfig.database;
332
- if (!database) {
370
+ // Validate database access
371
+ const dbValidation = this.validateDatabaseAccess(params.database);
372
+ if (!dbValidation.valid) {
333
373
  return {
334
374
  status: 'error',
335
- error: 'No database specified and no current database selected'
375
+ error: dbValidation.error
336
376
  };
337
377
  }
378
+ const { procedure_name, if_exists = false } = params;
379
+ const database = dbValidation.database;
338
380
  // Validate procedure name
339
381
  const identifierValidation = this.security.validateIdentifier(procedure_name);
340
382
  if (!identifierValidation.valid) {
@@ -371,14 +413,16 @@ class StoredProcedureTools {
371
413
  error: 'Invalid parameters: ' + JSON.stringify(schemas_1.validateShowCreateProcedure.errors)
372
414
  };
373
415
  }
374
- const { procedure_name } = params;
375
- const database = params.database || config_1.dbConfig.database;
376
- if (!database) {
416
+ // Validate database access
417
+ const dbValidation = this.validateDatabaseAccess(params.database);
418
+ if (!dbValidation.valid) {
377
419
  return {
378
420
  status: 'error',
379
- error: 'No database specified and no current database selected'
421
+ error: dbValidation.error
380
422
  };
381
423
  }
424
+ const { procedure_name } = params;
425
+ const database = dbValidation.database;
382
426
  // Validate procedure name
383
427
  const identifierValidation = this.security.validateIdentifier(procedure_name);
384
428
  if (!identifierValidation.valid) {
@@ -71,33 +71,33 @@ class UtilityTools {
71
71
  try {
72
72
  const { table_name } = params;
73
73
  // Query to get foreign keys where this table is the parent
74
- const parentQuery = `
75
- SELECT
76
- TABLE_NAME as child_table,
77
- COLUMN_NAME as child_column,
78
- REFERENCED_TABLE_NAME as parent_table,
79
- REFERENCED_COLUMN_NAME as parent_column,
80
- CONSTRAINT_NAME as constraint_name
81
- FROM
82
- INFORMATION_SCHEMA.KEY_COLUMN_USAGE
83
- WHERE
84
- REFERENCED_TABLE_NAME = ?
85
- AND REFERENCED_TABLE_SCHEMA = DATABASE()
74
+ const parentQuery = `
75
+ SELECT
76
+ TABLE_NAME as child_table,
77
+ COLUMN_NAME as child_column,
78
+ REFERENCED_TABLE_NAME as parent_table,
79
+ REFERENCED_COLUMN_NAME as parent_column,
80
+ CONSTRAINT_NAME as constraint_name
81
+ FROM
82
+ INFORMATION_SCHEMA.KEY_COLUMN_USAGE
83
+ WHERE
84
+ REFERENCED_TABLE_NAME = ?
85
+ AND REFERENCED_TABLE_SCHEMA = DATABASE()
86
86
  `;
87
87
  // Query to get foreign keys where this table is the child
88
- const childQuery = `
89
- SELECT
90
- TABLE_NAME as child_table,
91
- COLUMN_NAME as child_column,
92
- REFERENCED_TABLE_NAME as parent_table,
93
- REFERENCED_COLUMN_NAME as parent_column,
94
- CONSTRAINT_NAME as constraint_name
95
- FROM
96
- INFORMATION_SCHEMA.KEY_COLUMN_USAGE
97
- WHERE
98
- TABLE_NAME = ?
99
- AND REFERENCED_TABLE_NAME IS NOT NULL
100
- AND TABLE_SCHEMA = DATABASE()
88
+ const childQuery = `
89
+ SELECT
90
+ TABLE_NAME as child_table,
91
+ COLUMN_NAME as child_column,
92
+ REFERENCED_TABLE_NAME as parent_table,
93
+ REFERENCED_COLUMN_NAME as parent_column,
94
+ CONSTRAINT_NAME as constraint_name
95
+ FROM
96
+ INFORMATION_SCHEMA.KEY_COLUMN_USAGE
97
+ WHERE
98
+ TABLE_NAME = ?
99
+ AND REFERENCED_TABLE_NAME IS NOT NULL
100
+ AND TABLE_SCHEMA = DATABASE()
101
101
  `;
102
102
  // Execute both queries
103
103
  const parentRelationships = await this.db.query(parentQuery, [table_name]);
@@ -187,6 +187,152 @@ export declare const runQuerySchema: {
187
187
  };
188
188
  additionalProperties: boolean;
189
189
  };
190
+ export declare const executeSqlSchema: {
191
+ type: string;
192
+ required: string[];
193
+ properties: {
194
+ query: {
195
+ type: string;
196
+ };
197
+ params: {
198
+ type: string;
199
+ items: {};
200
+ nullable: boolean;
201
+ };
202
+ };
203
+ additionalProperties: boolean;
204
+ };
205
+ export declare const createTableSchema: {
206
+ type: string;
207
+ required: string[];
208
+ properties: {
209
+ table_name: {
210
+ type: string;
211
+ };
212
+ columns: {
213
+ type: string;
214
+ items: {
215
+ type: string;
216
+ required: string[];
217
+ properties: {
218
+ name: {
219
+ type: string;
220
+ };
221
+ type: {
222
+ type: string;
223
+ };
224
+ nullable: {
225
+ type: string;
226
+ };
227
+ primary_key: {
228
+ type: string;
229
+ };
230
+ auto_increment: {
231
+ type: string;
232
+ };
233
+ default: {
234
+ type: string;
235
+ };
236
+ };
237
+ };
238
+ };
239
+ indexes: {
240
+ type: string;
241
+ items: {
242
+ type: string;
243
+ properties: {
244
+ name: {
245
+ type: string;
246
+ };
247
+ columns: {
248
+ type: string;
249
+ items: {
250
+ type: string;
251
+ };
252
+ };
253
+ unique: {
254
+ type: string;
255
+ };
256
+ };
257
+ };
258
+ nullable: boolean;
259
+ };
260
+ };
261
+ additionalProperties: boolean;
262
+ };
263
+ export declare const alterTableSchema: {
264
+ type: string;
265
+ required: string[];
266
+ properties: {
267
+ table_name: {
268
+ type: string;
269
+ };
270
+ operations: {
271
+ type: string;
272
+ items: {
273
+ type: string;
274
+ required: string[];
275
+ properties: {
276
+ type: {
277
+ type: string;
278
+ enum: string[];
279
+ };
280
+ column_name: {
281
+ type: string;
282
+ };
283
+ new_column_name: {
284
+ type: string;
285
+ };
286
+ column_type: {
287
+ type: string;
288
+ };
289
+ nullable: {
290
+ type: string;
291
+ };
292
+ default: {
293
+ type: string;
294
+ };
295
+ index_name: {
296
+ type: string;
297
+ };
298
+ index_columns: {
299
+ type: string;
300
+ items: {
301
+ type: string;
302
+ };
303
+ };
304
+ unique: {
305
+ type: string;
306
+ };
307
+ };
308
+ };
309
+ };
310
+ };
311
+ additionalProperties: boolean;
312
+ };
313
+ export declare const dropTableSchema: {
314
+ type: string;
315
+ required: string[];
316
+ properties: {
317
+ table_name: {
318
+ type: string;
319
+ };
320
+ if_exists: {
321
+ type: string;
322
+ };
323
+ };
324
+ additionalProperties: boolean;
325
+ };
326
+ export declare const executeDdlSchema: {
327
+ type: string;
328
+ required: string[];
329
+ properties: {
330
+ query: {
331
+ type: string;
332
+ };
333
+ };
334
+ additionalProperties: boolean;
335
+ };
190
336
  export declare const getTableRelationshipsSchema: {
191
337
  type: string;
192
338
  required: string[];
@@ -384,10 +530,31 @@ export declare const validateUpdateRecord: import("ajv").ValidateFunction<{
384
530
  export declare const validateDeleteRecord: import("ajv").ValidateFunction<{
385
531
  [x: string]: {};
386
532
  }>;
533
+ export declare const validateBulkInsert: import("ajv").ValidateFunction<{
534
+ [x: string]: {};
535
+ }>;
536
+ export declare const validateBulkUpdate: import("ajv").ValidateFunction<{
537
+ [x: string]: {};
538
+ }>;
539
+ export declare const validateBulkDelete: import("ajv").ValidateFunction<{
540
+ [x: string]: {};
541
+ }>;
387
542
  export declare const validateRunQuery: import("ajv").ValidateFunction<{
388
543
  [x: string]: {};
389
544
  }>;
390
- export declare const validateGetTableRelationships: import("ajv").ValidateFunction<{
545
+ export declare const validateExecuteSql: import("ajv").ValidateFunction<{
546
+ [x: string]: {};
547
+ }>;
548
+ export declare const validateCreateTable: import("ajv").ValidateFunction<{
549
+ [x: string]: {};
550
+ }>;
551
+ export declare const validateAlterTable: import("ajv").ValidateFunction<{
552
+ [x: string]: {};
553
+ }>;
554
+ export declare const validateDropTable: import("ajv").ValidateFunction<{
555
+ [x: string]: {};
556
+ }>;
557
+ export declare const validateExecuteDdl: import("ajv").ValidateFunction<{
391
558
  [x: string]: {};
392
559
  }>;
393
560
  export declare const validateBeginTransaction: import("ajv").ValidateFunction<{
@@ -399,7 +566,6 @@ export declare const validateCommitTransaction: import("ajv").ValidateFunction<{
399
566
  export declare const validateRollbackTransaction: import("ajv").ValidateFunction<{
400
567
  [x: string]: {};
401
568
  }>;
402
- export declare const validateGetTransactionStatus: import("ajv").ValidateFunction<{} & {}>;
403
569
  export declare const validateExecuteInTransaction: import("ajv").ValidateFunction<{
404
570
  [x: string]: {};
405
571
  }>;
@@ -409,10 +575,10 @@ export declare const validateListStoredProcedures: import("ajv").ValidateFunctio
409
575
  export declare const validateGetStoredProcedureInfo: import("ajv").ValidateFunction<{
410
576
  [x: string]: {};
411
577
  }>;
412
- export declare const validateStoredProcedureExecution: import("ajv").ValidateFunction<{
578
+ export declare const validateExecuteStoredProcedure: import("ajv").ValidateFunction<{
413
579
  [x: string]: {};
414
580
  }>;
415
- export declare const validateStoredProcedureCreation: import("ajv").ValidateFunction<{
581
+ export declare const validateCreateStoredProcedure: import("ajv").ValidateFunction<{
416
582
  [x: string]: {};
417
583
  }>;
418
584
  export declare const validateDropStoredProcedure: import("ajv").ValidateFunction<{
@@ -421,3 +587,12 @@ export declare const validateDropStoredProcedure: import("ajv").ValidateFunction
421
587
  export declare const validateShowCreateProcedure: import("ajv").ValidateFunction<{
422
588
  [x: string]: {};
423
589
  }>;
590
+ export declare const validateStoredProcedureExecution: import("ajv").ValidateFunction<{
591
+ [x: string]: {};
592
+ }>;
593
+ export declare const validateStoredProcedureCreation: import("ajv").ValidateFunction<{
594
+ [x: string]: {};
595
+ }>;
596
+ export declare const validateGetTableRelationships: import("ajv").ValidateFunction<{
597
+ [x: string]: {};
598
+ }>;
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.validateShowCreateProcedure = exports.validateDropStoredProcedure = exports.validateStoredProcedureCreation = exports.validateStoredProcedureExecution = exports.validateGetStoredProcedureInfo = exports.validateListStoredProcedures = exports.validateExecuteInTransaction = exports.validateGetTransactionStatus = exports.validateRollbackTransaction = exports.validateCommitTransaction = exports.validateBeginTransaction = exports.validateGetTableRelationships = exports.validateRunQuery = exports.validateDeleteRecord = exports.validateUpdateRecord = exports.validateReadRecords = exports.validateCreateRecord = exports.validateReadTableSchema = exports.validateListTables = exports.showCreateProcedureSchema = exports.dropStoredProcedureSchema = exports.createStoredProcedureSchema = exports.executeStoredProcedureSchema = exports.getStoredProcedureInfoSchema = exports.listStoredProceduresSchema = exports.executeInTransactionSchema = exports.getTransactionStatusSchema = exports.rollbackTransactionSchema = exports.commitTransactionSchema = exports.beginTransactionSchema = exports.getTableRelationshipsSchema = exports.runQuerySchema = exports.deleteRecordSchema = exports.updateRecordSchema = exports.readRecordsSchema = exports.createRecordSchema = exports.readTableSchemaSchema = exports.listTablesSchema = void 0;
6
+ exports.validateStoredProcedureExecution = exports.validateShowCreateProcedure = exports.validateDropStoredProcedure = exports.validateCreateStoredProcedure = exports.validateExecuteStoredProcedure = exports.validateGetStoredProcedureInfo = exports.validateListStoredProcedures = exports.validateExecuteInTransaction = exports.validateRollbackTransaction = exports.validateCommitTransaction = exports.validateBeginTransaction = exports.validateExecuteDdl = exports.validateDropTable = exports.validateAlterTable = exports.validateCreateTable = exports.validateExecuteSql = exports.validateRunQuery = exports.validateBulkDelete = exports.validateBulkUpdate = exports.validateBulkInsert = exports.validateDeleteRecord = exports.validateUpdateRecord = exports.validateReadRecords = exports.validateCreateRecord = exports.validateReadTableSchema = exports.validateListTables = exports.showCreateProcedureSchema = exports.dropStoredProcedureSchema = exports.createStoredProcedureSchema = exports.executeStoredProcedureSchema = exports.getStoredProcedureInfoSchema = exports.listStoredProceduresSchema = exports.executeInTransactionSchema = exports.getTransactionStatusSchema = exports.rollbackTransactionSchema = exports.commitTransactionSchema = exports.beginTransactionSchema = exports.getTableRelationshipsSchema = exports.executeDdlSchema = exports.dropTableSchema = exports.alterTableSchema = exports.createTableSchema = exports.executeSqlSchema = exports.runQuerySchema = exports.deleteRecordSchema = exports.updateRecordSchema = exports.readRecordsSchema = exports.createRecordSchema = exports.readTableSchemaSchema = exports.listTablesSchema = void 0;
7
+ exports.validateGetTableRelationships = exports.validateStoredProcedureCreation = void 0;
7
8
  const ajv_1 = __importDefault(require("ajv"));
8
9
  const ajv = new ajv_1.default();
9
10
  // Schema definitions
@@ -126,6 +127,20 @@ exports.deleteRecordSchema = {
126
127
  },
127
128
  additionalProperties: false
128
129
  };
130
+ // Filter condition schema for reuse
131
+ const filterConditionSchema = {
132
+ type: 'object',
133
+ required: ['field', 'operator', 'value'],
134
+ properties: {
135
+ field: { type: 'string' },
136
+ operator: {
137
+ type: 'string',
138
+ enum: ['eq', 'neq', 'gt', 'gte', 'lt', 'lte', 'like', 'in']
139
+ },
140
+ value: {}
141
+ },
142
+ additionalProperties: false
143
+ };
129
144
  exports.runQuerySchema = {
130
145
  type: 'object',
131
146
  required: ['query'],
@@ -139,6 +154,102 @@ exports.runQuerySchema = {
139
154
  },
140
155
  additionalProperties: false
141
156
  };
157
+ // SQL execution schema
158
+ exports.executeSqlSchema = {
159
+ type: 'object',
160
+ required: ['query'],
161
+ properties: {
162
+ query: { type: 'string' },
163
+ params: {
164
+ type: 'array',
165
+ items: {},
166
+ nullable: true
167
+ }
168
+ },
169
+ additionalProperties: false
170
+ };
171
+ // DDL schemas
172
+ exports.createTableSchema = {
173
+ type: 'object',
174
+ required: ['table_name', 'columns'],
175
+ properties: {
176
+ table_name: { type: 'string' },
177
+ columns: {
178
+ type: 'array',
179
+ items: {
180
+ type: 'object',
181
+ required: ['name', 'type'],
182
+ properties: {
183
+ name: { type: 'string' },
184
+ type: { type: 'string' },
185
+ nullable: { type: 'boolean' },
186
+ primary_key: { type: 'boolean' },
187
+ auto_increment: { type: 'boolean' },
188
+ default: { type: 'string' }
189
+ }
190
+ }
191
+ },
192
+ indexes: {
193
+ type: 'array',
194
+ items: {
195
+ type: 'object',
196
+ properties: {
197
+ name: { type: 'string' },
198
+ columns: { type: 'array', items: { type: 'string' } },
199
+ unique: { type: 'boolean' }
200
+ }
201
+ },
202
+ nullable: true
203
+ }
204
+ },
205
+ additionalProperties: false
206
+ };
207
+ exports.alterTableSchema = {
208
+ type: 'object',
209
+ required: ['table_name', 'operations'],
210
+ properties: {
211
+ table_name: { type: 'string' },
212
+ operations: {
213
+ type: 'array',
214
+ items: {
215
+ type: 'object',
216
+ required: ['type'],
217
+ properties: {
218
+ type: {
219
+ type: 'string',
220
+ enum: ['add_column', 'drop_column', 'modify_column', 'rename_column', 'add_index', 'drop_index']
221
+ },
222
+ column_name: { type: 'string' },
223
+ new_column_name: { type: 'string' },
224
+ column_type: { type: 'string' },
225
+ nullable: { type: 'boolean' },
226
+ default: { type: 'string' },
227
+ index_name: { type: 'string' },
228
+ index_columns: { type: 'array', items: { type: 'string' } },
229
+ unique: { type: 'boolean' }
230
+ }
231
+ }
232
+ }
233
+ },
234
+ additionalProperties: false
235
+ };
236
+ exports.dropTableSchema = {
237
+ type: 'object',
238
+ required: ['table_name'],
239
+ properties: {
240
+ table_name: { type: 'string' },
241
+ if_exists: { type: 'boolean' }
242
+ },
243
+ additionalProperties: false
244
+ };
245
+ exports.executeDdlSchema = {
246
+ type: 'object',
247
+ required: ['query'],
248
+ properties: {
249
+ query: { type: 'string' }
250
+ },
251
+ additionalProperties: false
252
+ };
142
253
  exports.getTableRelationshipsSchema = {
143
254
  type: 'object',
144
255
  required: ['table_name'],
@@ -264,6 +375,73 @@ exports.showCreateProcedureSchema = {
264
375
  },
265
376
  additionalProperties: false
266
377
  };
378
+ // Bulk Insert Schema
379
+ const bulkInsertSchema = {
380
+ type: 'object',
381
+ properties: {
382
+ table_name: { type: 'string', minLength: 1 },
383
+ data: {
384
+ type: 'array',
385
+ minItems: 1,
386
+ items: {
387
+ type: 'object',
388
+ additionalProperties: true
389
+ }
390
+ },
391
+ batch_size: { type: 'number', minimum: 1, maximum: 10000 }
392
+ },
393
+ required: ['table_name', 'data'],
394
+ additionalProperties: false
395
+ };
396
+ // Bulk Update Schema
397
+ const bulkUpdateSchema = {
398
+ type: 'object',
399
+ properties: {
400
+ table_name: { type: 'string', minLength: 1 },
401
+ updates: {
402
+ type: 'array',
403
+ minItems: 1,
404
+ items: {
405
+ type: 'object',
406
+ properties: {
407
+ data: {
408
+ type: 'object',
409
+ additionalProperties: true
410
+ },
411
+ conditions: {
412
+ type: 'array',
413
+ minItems: 1,
414
+ items: filterConditionSchema
415
+ }
416
+ },
417
+ required: ['data', 'conditions'],
418
+ additionalProperties: false
419
+ }
420
+ },
421
+ batch_size: { type: 'number', minimum: 1, maximum: 1000 }
422
+ },
423
+ required: ['table_name', 'updates'],
424
+ additionalProperties: false
425
+ };
426
+ // Bulk Delete Schema
427
+ const bulkDeleteSchema = {
428
+ type: 'object',
429
+ properties: {
430
+ table_name: { type: 'string', minLength: 1 },
431
+ condition_sets: {
432
+ type: 'array',
433
+ minItems: 1,
434
+ items: {
435
+ type: 'array',
436
+ minItems: 1,
437
+ items: filterConditionSchema
438
+ }
439
+ },
440
+ batch_size: { type: 'number', minimum: 1, maximum: 1000 }
441
+ },
442
+ required: ['table_name', 'condition_sets'],
443
+ additionalProperties: false
444
+ };
267
445
  // Compile validators
268
446
  exports.validateListTables = ajv.compile(exports.listTablesSchema);
269
447
  exports.validateReadTableSchema = ajv.compile(exports.readTableSchemaSchema);
@@ -271,17 +449,25 @@ exports.validateCreateRecord = ajv.compile(exports.createRecordSchema);
271
449
  exports.validateReadRecords = ajv.compile(exports.readRecordsSchema);
272
450
  exports.validateUpdateRecord = ajv.compile(exports.updateRecordSchema);
273
451
  exports.validateDeleteRecord = ajv.compile(exports.deleteRecordSchema);
452
+ exports.validateBulkInsert = ajv.compile(bulkInsertSchema);
453
+ exports.validateBulkUpdate = ajv.compile(bulkUpdateSchema);
454
+ exports.validateBulkDelete = ajv.compile(bulkDeleteSchema);
274
455
  exports.validateRunQuery = ajv.compile(exports.runQuerySchema);
275
- exports.validateGetTableRelationships = ajv.compile(exports.getTableRelationshipsSchema);
456
+ exports.validateExecuteSql = ajv.compile(exports.executeSqlSchema);
457
+ exports.validateCreateTable = ajv.compile(exports.createTableSchema);
458
+ exports.validateAlterTable = ajv.compile(exports.alterTableSchema);
459
+ exports.validateDropTable = ajv.compile(exports.dropTableSchema);
460
+ exports.validateExecuteDdl = ajv.compile(exports.executeDdlSchema);
276
461
  exports.validateBeginTransaction = ajv.compile(exports.beginTransactionSchema);
277
462
  exports.validateCommitTransaction = ajv.compile(exports.commitTransactionSchema);
278
463
  exports.validateRollbackTransaction = ajv.compile(exports.rollbackTransactionSchema);
279
- exports.validateGetTransactionStatus = ajv.compile(exports.getTransactionStatusSchema);
280
464
  exports.validateExecuteInTransaction = ajv.compile(exports.executeInTransactionSchema);
281
- // Stored procedure validators
282
465
  exports.validateListStoredProcedures = ajv.compile(exports.listStoredProceduresSchema);
283
466
  exports.validateGetStoredProcedureInfo = ajv.compile(exports.getStoredProcedureInfoSchema);
284
- exports.validateStoredProcedureExecution = ajv.compile(exports.executeStoredProcedureSchema);
285
- exports.validateStoredProcedureCreation = ajv.compile(exports.createStoredProcedureSchema);
467
+ exports.validateExecuteStoredProcedure = ajv.compile(exports.executeStoredProcedureSchema);
468
+ exports.validateCreateStoredProcedure = ajv.compile(exports.createStoredProcedureSchema);
286
469
  exports.validateDropStoredProcedure = ajv.compile(exports.dropStoredProcedureSchema);
287
470
  exports.validateShowCreateProcedure = ajv.compile(exports.showCreateProcedureSchema);
471
+ exports.validateStoredProcedureExecution = ajv.compile(exports.executeStoredProcedureSchema);
472
+ exports.validateStoredProcedureCreation = ajv.compile(exports.createStoredProcedureSchema);
473
+ exports.validateGetTableRelationships = ajv.compile(exports.getTableRelationshipsSchema);