hdbconnect-mcp 0.3.3

MCP server for SAP HANA database
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
//! Type definitions for MCP tools

use rmcp::handler::server::wrapper::Json;
use rmcp::{ErrorData, elicit_safe};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

/// Result type for MCP tool handlers returning structured JSON data
pub type ToolResult<T> = Result<Json<T>, ErrorData>;

/// Connection health check result
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct PingResult {
    /// Connection status: "ok" or "error"
    #[schemars(description = "Connection status: ok or error")]
    pub status: String,
    /// Query latency in milliseconds
    #[schemars(description = "Query latency in milliseconds")]
    pub latency_ms: u64,
}

/// HANA table information
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct TableInfo {
    /// Table name
    #[schemars(description = "Table name")]
    pub name: String,
    /// Table type (TABLE, VIEW, etc.)
    #[schemars(description = "Table type: TABLE, VIEW, SYNONYM, etc.")]
    pub table_type: String,
}

/// Table column information
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct ColumnInfo {
    /// Column name
    #[schemars(description = "Column name")]
    pub name: String,
    /// HANA data type (VARCHAR, INTEGER, DECIMAL, etc.)
    #[schemars(description = "HANA data type: VARCHAR, INTEGER, DECIMAL, TIMESTAMP, etc.")]
    pub data_type: String,
    /// Whether column accepts NULL values
    #[schemars(description = "Whether column accepts NULL values")]
    pub nullable: bool,
}

/// Table schema with columns
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct TableSchema {
    /// Table name
    #[schemars(description = "Table name")]
    pub table_name: String,
    /// List of columns
    #[schemars(description = "List of column definitions")]
    pub columns: Vec<ColumnInfo>,
}

/// SQL query execution result
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct QueryResult {
    /// Column names in result set
    #[schemars(description = "Column names in result set")]
    pub columns: Vec<String>,
    /// Result rows as JSON arrays
    #[schemars(description = "Result rows as JSON arrays")]
    pub rows: Vec<Vec<serde_json::Value>>,
    /// Number of rows returned
    #[schemars(description = "Number of rows returned")]
    pub row_count: usize,
}

/// Schema name for elicitation
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
#[schemars(description = "Schema name")]
pub struct SchemaName {
    /// Schema name
    #[schemars(description = "Name of the schema")]
    pub name: String,
}

elicit_safe!(SchemaName);

/// Parameters for listing tables
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct ListTablesParams {
    /// Optional schema name filter. If not provided, uses `CURRENT_SCHEMA`.
    #[serde(default)]
    #[schemars(
        description = "Schema name to filter tables. Leave empty to use CURRENT_SCHEMA (default behavior). Example: 'SYSTEM', 'MY_SCHEMA'"
    )]
    pub schema: Option<SchemaName>,
}

/// Parameters for describing a table
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct DescribeTableParams {
    /// Table name to describe. Ask the user which table they want to inspect.
    #[schemars(description = "Name of the table to describe. Example: 'EMPLOYEES', 'ORDERS'")]
    pub table: String,
    /// Optional schema name. If not provided, uses `CURRENT_SCHEMA`.
    #[serde(default)]
    #[schemars(
        description = "Schema name where the table is located. Leave empty to use CURRENT_SCHEMA. Example: 'SYSTEM', 'MY_SCHEMA'"
    )]
    pub schema: Option<SchemaName>,
}

/// Parameters for SQL query execution
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct ExecuteSqlParams {
    /// SQL query to execute (SELECT only in read-only mode)
    #[schemars(
        description = "SQL query to execute. In read-only mode, only SELECT, WITH, EXPLAIN, and CALL are allowed"
    )]
    pub sql: String,
    /// Optional row limit (overrides server default)
    #[serde(default)]
    #[schemars(description = "Optional row limit. Server may enforce maximum limit")]
    pub limit: Option<u32>,
}

/// Parameters for DML execution
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct ExecuteDmlParams {
    /// DML statement (INSERT, UPDATE, DELETE)
    #[schemars(description = "SQL DML statement. Allowed: INSERT, UPDATE, DELETE")]
    pub sql: String,

    /// Optional: schema context for the operation
    #[serde(default)]
    #[schemars(description = "Schema name. Leave empty to use CURRENT_SCHEMA")]
    pub schema: Option<SchemaName>,

    /// Force execution without confirmation (requires elevated permissions).
    #[serde(default)]
    #[schemars(description = "Skip confirmation prompt (use with caution)")]
    pub force: bool,
}

/// DML execution result
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct DmlResult {
    /// Operation performed
    #[schemars(description = "Operation type: INSERT, UPDATE, or DELETE")]
    pub operation: String,

    /// Number of rows affected
    #[schemars(description = "Number of rows inserted, updated, or deleted")]
    pub affected_rows: u64,

    /// Execution status
    #[schemars(description = "Status: success or error")]
    pub status: String,

    /// Optional message (e.g., warning about row limit)
    #[serde(skip_serializing_if = "Option::is_none")]
    #[schemars(description = "Additional message or warning")]
    pub message: Option<String>,
}

/// DML confirmation elicitation
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
#[schemars(description = "Confirm DML operation execution")]
pub struct DmlConfirmation {
    /// User's confirmation response
    #[schemars(description = "Type 'yes' or 'confirm' to proceed")]
    pub confirm: String,
}

elicit_safe!(DmlConfirmation);

impl DmlConfirmation {
    #[must_use]
    pub fn is_confirmed(&self) -> bool {
        let normalized = self.confirm.trim().to_lowercase();
        matches!(normalized.as_str(), "yes" | "y" | "confirm" | "ok" | "true")
    }
}

// Procedure-related types

/// Procedure parameter direction
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
#[serde(rename_all = "UPPERCASE")]
pub enum ParameterDirection {
    In,
    Out,
    InOut,
}

impl ParameterDirection {
    #[must_use]
    pub fn from_hana_str(s: &str) -> Option<Self> {
        match s.to_uppercase().as_str() {
            "IN" => Some(Self::In),
            "OUT" => Some(Self::Out),
            "INOUT" => Some(Self::InOut),
            _ => None,
        }
    }
}

/// Procedure parameter metadata
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct ProcedureParameter {
    /// Parameter name
    #[schemars(description = "Parameter name")]
    pub name: String,
    /// Parameter position (1-indexed)
    #[schemars(description = "Parameter position (1-indexed)")]
    pub position: u32,
    /// HANA data type (VARCHAR, INTEGER, DECIMAL, etc.)
    #[schemars(description = "HANA data type")]
    pub data_type: String,
    /// Parameter direction (IN, OUT, INOUT)
    #[schemars(description = "Parameter direction: IN, OUT, or INOUT")]
    pub direction: ParameterDirection,
    /// Length for string/binary types
    #[serde(skip_serializing_if = "Option::is_none")]
    #[schemars(description = "Length for string/binary types")]
    pub length: Option<u32>,
    /// Precision for numeric types
    #[serde(skip_serializing_if = "Option::is_none")]
    #[schemars(description = "Precision for numeric types")]
    pub precision: Option<u32>,
    /// Scale for numeric types
    #[serde(skip_serializing_if = "Option::is_none")]
    #[schemars(description = "Scale for numeric types")]
    pub scale: Option<u32>,
    /// Whether parameter has default value
    #[schemars(description = "Whether parameter has a default value")]
    pub has_default: bool,
}

/// Procedure metadata (for listing)
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct ProcedureInfo {
    /// Procedure name
    #[schemars(description = "Procedure name")]
    pub name: String,
    /// Schema containing the procedure
    #[schemars(description = "Schema name")]
    pub schema: String,
    /// Procedure type (PROCEDURE or FUNCTION)
    #[schemars(description = "Procedure type: PROCEDURE or FUNCTION")]
    pub procedure_type: String,
    /// Whether procedure is read-only
    #[schemars(description = "Whether procedure only reads data")]
    pub is_read_only: bool,
}

/// Procedure schema with parameters
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct ProcedureSchema {
    /// Procedure name
    #[schemars(description = "Procedure name")]
    pub name: String,
    /// Schema containing the procedure
    #[schemars(description = "Schema name")]
    pub schema: String,
    /// List of parameters
    #[schemars(description = "List of procedure parameters")]
    pub parameters: Vec<ProcedureParameter>,
    /// Number of expected result sets (if determinable)
    #[serde(skip_serializing_if = "Option::is_none")]
    #[schemars(description = "Number of result sets returned")]
    pub result_set_count: Option<u32>,
}

/// Parameters for listing procedures
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct ListProceduresParams {
    /// Optional schema name filter
    #[serde(default)]
    #[schemars(description = "Schema name to filter procedures. Leave empty for CURRENT_SCHEMA")]
    pub schema: Option<SchemaName>,
    /// Filter by procedure name pattern (SQL LIKE syntax)
    #[serde(default)]
    #[schemars(description = "Filter by procedure name pattern (SQL LIKE syntax, e.g., 'GET_%')")]
    pub name_pattern: Option<String>,
}

/// Parameters for describing a procedure
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct DescribeProcedureParams {
    /// Procedure name
    #[schemars(description = "Procedure name to describe")]
    pub procedure: String,
    /// Optional schema name
    #[serde(default)]
    #[schemars(description = "Schema name. Leave empty for CURRENT_SCHEMA")]
    pub schema: Option<SchemaName>,
}

/// Parameters for calling a stored procedure
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct CallProcedureParams {
    /// Procedure name (can be schema.procedure or just procedure)
    #[schemars(description = "Procedure name. Format: SCHEMA.PROCEDURE or PROCEDURE")]
    pub procedure: String,
    /// Input parameters as key-value pairs
    #[serde(default)]
    #[schemars(description = "Input parameters as JSON object")]
    pub parameters: Option<serde_json::Map<String, serde_json::Value>>,
    /// Schema context (optional, used if procedure name doesn't include schema)
    #[serde(default)]
    #[schemars(description = "Schema name. Leave empty to use CURRENT_SCHEMA")]
    pub schema: Option<SchemaName>,
    /// Use explicit transaction control (disable auto-commit)
    #[serde(default)]
    #[schemars(description = "Use explicit transaction control")]
    pub explicit_transaction: bool,
    /// Skip confirmation prompt
    #[serde(default)]
    #[schemars(description = "Skip confirmation prompt (use with caution)")]
    pub force: bool,
}

/// Single result set from procedure
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct ProcedureResultSet {
    /// Result set index (0-based)
    #[schemars(description = "Result set index (0-based)")]
    pub index: usize,
    /// Column names
    #[schemars(description = "Column names in result set")]
    pub columns: Vec<String>,
    /// Rows as JSON arrays
    #[schemars(description = "Result rows as JSON arrays")]
    pub rows: Vec<Vec<serde_json::Value>>,
    /// Number of rows in this result set
    #[schemars(description = "Number of rows returned")]
    pub row_count: usize,
    /// Whether rows were truncated due to limit
    #[serde(default)]
    #[schemars(description = "Whether result was truncated due to row limit")]
    pub truncated: bool,
}

/// Output parameter value from procedure
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct OutputParameter {
    /// Parameter name
    #[schemars(description = "Parameter name")]
    pub name: String,
    /// Parameter value (JSON)
    #[schemars(description = "Output parameter value")]
    pub value: serde_json::Value,
    /// HANA data type
    #[schemars(description = "HANA data type")]
    pub data_type: String,
}

/// Procedure execution result
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct ProcedureResult {
    /// Procedure name that was executed
    #[schemars(description = "Executed procedure name")]
    pub procedure: String,
    /// Execution status
    #[schemars(description = "Status: success or error")]
    pub status: String,
    /// Result sets returned by procedure
    #[schemars(description = "Result sets from procedure")]
    pub result_sets: Vec<ProcedureResultSet>,
    /// Output parameters (OUT and INOUT)
    #[schemars(description = "Output parameter values")]
    pub output_parameters: Vec<OutputParameter>,
    /// Affected rows count (for procedures with DML)
    #[serde(skip_serializing_if = "Option::is_none")]
    #[schemars(description = "Number of rows affected by DML operations")]
    pub affected_rows: Option<u64>,
    /// Execution message
    #[serde(skip_serializing_if = "Option::is_none")]
    #[schemars(description = "Additional execution message")]
    pub message: Option<String>,
}

/// Procedure confirmation elicitation
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
#[schemars(description = "Confirm stored procedure execution")]
pub struct ProcedureConfirmation {
    /// User's confirmation response
    #[schemars(description = "Type 'yes' or 'confirm' to proceed")]
    pub confirm: String,
}

elicit_safe!(ProcedureConfirmation);

impl ProcedureConfirmation {
    #[must_use]
    pub fn is_confirmed(&self) -> bool {
        let normalized = self.confirm.trim().to_lowercase();
        matches!(normalized.as_str(), "yes" | "y" | "confirm" | "ok" | "true")
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_dml_confirmation_is_confirmed() {
        assert!(
            DmlConfirmation {
                confirm: "yes".to_string()
            }
            .is_confirmed()
        );
        assert!(
            DmlConfirmation {
                confirm: "YES".to_string()
            }
            .is_confirmed()
        );
        assert!(
            DmlConfirmation {
                confirm: "y".to_string()
            }
            .is_confirmed()
        );
        assert!(
            DmlConfirmation {
                confirm: "Y".to_string()
            }
            .is_confirmed()
        );
        assert!(
            DmlConfirmation {
                confirm: "confirm".to_string()
            }
            .is_confirmed()
        );
        assert!(
            DmlConfirmation {
                confirm: "CONFIRM".to_string()
            }
            .is_confirmed()
        );
        assert!(
            DmlConfirmation {
                confirm: "ok".to_string()
            }
            .is_confirmed()
        );
        assert!(
            DmlConfirmation {
                confirm: "OK".to_string()
            }
            .is_confirmed()
        );
        assert!(
            DmlConfirmation {
                confirm: "true".to_string()
            }
            .is_confirmed()
        );
        assert!(
            DmlConfirmation {
                confirm: "  yes  ".to_string()
            }
            .is_confirmed()
        );
    }

    #[test]
    fn test_dml_confirmation_not_confirmed() {
        assert!(
            !DmlConfirmation {
                confirm: "no".to_string()
            }
            .is_confirmed()
        );
        assert!(
            !DmlConfirmation {
                confirm: "false".to_string()
            }
            .is_confirmed()
        );
        assert!(
            !DmlConfirmation {
                confirm: "cancel".to_string()
            }
            .is_confirmed()
        );
        assert!(
            !DmlConfirmation {
                confirm: "".to_string()
            }
            .is_confirmed()
        );
        assert!(
            !DmlConfirmation {
                confirm: "n".to_string()
            }
            .is_confirmed()
        );
    }

    #[test]
    fn test_dml_result_serialization() {
        let result = DmlResult {
            operation: "INSERT".to_string(),
            affected_rows: 5,
            status: "success".to_string(),
            message: None,
        };

        let json = serde_json::to_string(&result).unwrap();
        assert!(json.contains("INSERT"));
        assert!(json.contains("5"));
        assert!(json.contains("success"));
        assert!(!json.contains("message"));

        let result_with_message = DmlResult {
            operation: "DELETE".to_string(),
            affected_rows: 100,
            status: "success".to_string(),
            message: Some("Deleted old records".to_string()),
        };

        let json = serde_json::to_string(&result_with_message).unwrap();
        assert!(json.contains("message"));
        assert!(json.contains("Deleted old records"));
    }

    #[test]
    fn test_execute_dml_params_deserialization() {
        let json = r#"{
            "sql": "INSERT INTO users VALUES (1, 'test')",
            "schema": {"name": "APP"}
        }"#;

        let params: ExecuteDmlParams = serde_json::from_str(json).unwrap();
        assert_eq!(params.sql, "INSERT INTO users VALUES (1, 'test')");
        assert!(params.schema.is_some());
        assert_eq!(params.schema.unwrap().name, "APP");
        assert!(!params.force);
    }

    #[test]
    fn test_execute_dml_params_with_force() {
        let json = r#"{
            "sql": "DELETE FROM logs WHERE created_at < '2024-01-01'",
            "force": true
        }"#;

        let params: ExecuteDmlParams = serde_json::from_str(json).unwrap();
        assert!(params.force);
        assert!(params.schema.is_none());
    }

    // Procedure type tests
    #[test]
    fn test_parameter_direction_from_hana_str() {
        assert_eq!(
            ParameterDirection::from_hana_str("IN"),
            Some(ParameterDirection::In)
        );
        assert_eq!(
            ParameterDirection::from_hana_str("OUT"),
            Some(ParameterDirection::Out)
        );
        assert_eq!(
            ParameterDirection::from_hana_str("INOUT"),
            Some(ParameterDirection::InOut)
        );
        assert_eq!(
            ParameterDirection::from_hana_str("in"),
            Some(ParameterDirection::In)
        );
        assert_eq!(ParameterDirection::from_hana_str("INVALID"), None);
    }

    #[test]
    fn test_parameter_direction_serialization() {
        assert_eq!(
            serde_json::to_string(&ParameterDirection::In).unwrap(),
            r#""IN""#
        );
        assert_eq!(
            serde_json::to_string(&ParameterDirection::Out).unwrap(),
            r#""OUT""#
        );
        assert_eq!(
            serde_json::to_string(&ParameterDirection::InOut).unwrap(),
            r#""INOUT""#
        );
    }

    #[test]
    fn test_procedure_confirmation_is_confirmed() {
        assert!(
            ProcedureConfirmation {
                confirm: "yes".to_string()
            }
            .is_confirmed()
        );
        assert!(
            ProcedureConfirmation {
                confirm: "YES".to_string()
            }
            .is_confirmed()
        );
        assert!(
            ProcedureConfirmation {
                confirm: "y".to_string()
            }
            .is_confirmed()
        );
        assert!(
            ProcedureConfirmation {
                confirm: "confirm".to_string()
            }
            .is_confirmed()
        );
        assert!(
            ProcedureConfirmation {
                confirm: "  ok  ".to_string()
            }
            .is_confirmed()
        );
    }

    #[test]
    fn test_procedure_confirmation_not_confirmed() {
        assert!(
            !ProcedureConfirmation {
                confirm: "no".to_string()
            }
            .is_confirmed()
        );
        assert!(
            !ProcedureConfirmation {
                confirm: "cancel".to_string()
            }
            .is_confirmed()
        );
        assert!(
            !ProcedureConfirmation {
                confirm: "".to_string()
            }
            .is_confirmed()
        );
    }

    #[test]
    fn test_call_procedure_params_deserialization() {
        let json = r#"{
            "procedure": "GET_USER",
            "parameters": {"USER_ID": 123},
            "schema": {"name": "APP"}
        }"#;

        let params: CallProcedureParams = serde_json::from_str(json).unwrap();
        assert_eq!(params.procedure, "GET_USER");
        assert!(params.parameters.is_some());
        let params_map = params.parameters.unwrap();
        assert_eq!(params_map.get("USER_ID").unwrap(), &serde_json::json!(123));
        assert_eq!(params.schema.unwrap().name, "APP");
        assert!(!params.explicit_transaction);
        assert!(!params.force);
    }

    #[test]
    fn test_procedure_result_serialization() {
        let result = ProcedureResult {
            procedure: "GET_USER".to_string(),
            status: "success".to_string(),
            result_sets: vec![ProcedureResultSet {
                index: 0,
                columns: vec!["ID".to_string(), "NAME".to_string()],
                rows: vec![vec![serde_json::json!(1), serde_json::json!("Alice")]],
                row_count: 1,
                truncated: false,
            }],
            output_parameters: vec![],
            affected_rows: None,
            message: None,
        };

        let json = serde_json::to_string(&result).unwrap();
        assert!(json.contains("GET_USER"));
        assert!(json.contains("success"));
        assert!(json.contains("Alice"));
        assert!(!json.contains("affected_rows"));
        assert!(!json.contains("message"));
    }

    #[test]
    fn test_procedure_info_serialization() {
        let info = ProcedureInfo {
            name: "MY_PROC".to_string(),
            schema: "APP".to_string(),
            procedure_type: "PROCEDURE".to_string(),
            is_read_only: true,
        };

        let json = serde_json::to_string(&info).unwrap();
        assert!(json.contains("MY_PROC"));
        assert!(json.contains("APP"));
        assert!(json.contains("PROCEDURE"));
        assert!(json.contains("true"));
    }
}