| 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
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166 | 1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
12×
12×
12×
12×
1×
12×
12×
1×
12×
1×
1×
1×
13×
13×
308×
11×
56×
13×
1×
10×
10×
10×
2×
8×
8×
8×
8×
8×
8×
4×
8×
1×
94×
94×
94×
261×
94×
94×
94×
94×
3×
91×
91×
20×
10×
5×
4×
5×
3×
4×
40×
20×
10×
5×
4×
5×
3×
4×
40×
6×
6×
6×
6×
4×
2×
36×
36×
36×
36×
36×
3×
33×
1×
12×
12×
1×
1×
12×
12×
1×
213624×
1×
76×
1×
18×
1×
33×
1×
33×
33×
1×
20×
1×
19×
19×
19×
1×
18×
18×
17×
17×
17×
17×
4×
17×
1×
17×
2×
2×
2×
1×
17×
1×
1×
10×
1×
9×
9×
9×
1×
8×
8×
8×
8×
8×
8×
8×
611×
611×
622×
622×
622×
622×
9×
622×
1×
622×
9×
622×
1×
622×
611×
8×
1×
5×
5×
5×
1×
4×
4×
4×
1×
4×
1×
3×
3×
1×
2×
1×
5×
1×
4×
4×
2×
2×
1×
3×
3×
1×
2×
1×
4×
5×
3×
1×
1×
34×
5×
2×
1×
1×
2×
2×
1×
1×
1×
1×
1×
2×
1×
1×
1×
2×
1×
1×
2×
2×
2×
1×
1×
2×
2×
2×
2×
2×
2×
2×
1×
1×
1×
| var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
/* istanbul ignore next */
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
/* istanbul ignore next */
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
define(["require", "exports", "../common/index", "./command-executor", "../../workbook/common/index", "../../workbook/index", "@syncfusion/ej2-base"], function (require, exports, index_1, command_executor_1, index_2, index_3, ej2_base_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var webMcpTools = [
{
name: 'getCellData',
annotations: {
readOnlyHint: true
},
description: 'Returns the value, formula, display text, and optional format of a single cell. Use when you need data from one specific cell; use getRangeData for multiple cells.',
inputSchema: {
type: 'object',
properties: {
sheetName: { type: 'string', description: 'Sheet name. Defaults to the active sheet.' },
address: { type: 'string', description: 'Cell address in A1 notation, e.g. "B3".' },
includeFormat: { type: 'boolean', description: 'When true, include number format info.' }
},
required: ['address']
},
outputSchema: {
type: 'object',
properties: {
sheetName: { type: 'string', description: 'Name of the sheet the cell belongs to.' },
address: { type: 'string', description: 'Cell address in A1 notation.' },
value: { description: 'Raw cell value (string, number, boolean, or null).' },
displayText: { type: 'string', description: 'Formatted display text as shown in the cell.' },
formula: { type: 'string', description: 'Cell formula (e.g. "=SUM(A1:A5)"). Present only when the cell contains a formula.' },
format: { type: 'string', description: 'Number format code. Present only when includeFormat is true and a format is set.' },
style: { type: 'object', description: 'Cell style object. Present only when includeFormat is true and a style is set.' }
},
required: ['sheetName', 'address', 'displayText']
}
},
{
name: 'getRangeData',
annotations: {
readOnlyHint: true
},
description: 'Returns an array of cell values, formulas, and display text for a rectangular range (capped at 200 rows). Use when reading multiple cells at once; do not call getCellData repeatedly per cell.',
inputSchema: {
type: 'object',
properties: {
sheetName: { type: 'string', description: 'Sheet name. Defaults to the active sheet.' },
range: { type: 'string', description: 'Range in A1:B10 notation. Max 200 rows returned.' },
includeFormat: { type: 'boolean' }
},
required: ['range']
},
outputSchema: {
type: 'object',
properties: {
sheetName: { type: 'string', description: 'Name of the sheet.' },
range: { type: 'string', description: 'Requested range in A1 notation.' },
rowCount: { type: 'number', description: 'Number of rows returned (may be less than requested if truncated).' },
colCount: { type: 'number', description: 'Number of columns in the range.' },
truncated: { type: 'boolean', description: 'True when the range exceeded 200 rows and was capped.' },
cells: {
type: 'array',
description: 'Row-major 2-D array of cell objects.',
items: {
type: 'array',
items: {
type: 'object',
properties: {
value: { description: 'Raw cell value.' },
displayText: { type: 'string' },
formula: { type: 'string', description: 'Present only when cell contains a formula.' },
format: { type: 'string', description: 'Present only when includeFormat is true.' },
style: { type: 'object', description: 'Present only when includeFormat is true.' }
},
required: ['displayText']
}
}
}
},
required: ['sheetName', 'range', 'rowCount', 'colCount', 'truncated', 'cells']
}
},
{
name: 'getSheetInfo',
annotations: {
readOnlyHint: true
},
description: 'Returns structural metadata of a sheet including row count, column count, and cell data. Use when you need an overview of the whole sheet; use getRangeData when you only need values from a specific range.',
inputSchema: {
type: 'object',
properties: {
sheetName: { type: 'string', description: 'Sheet name. Defaults to active sheet.' },
keys: {
type: 'array',
items: { type: 'string' },
description: 'Optional subset of sheet keys, e.g. ["rows"], ["columns"], ["rows","cells"].'
}
}
},
outputSchema: {
type: 'object',
properties: {
sheetName: { type: 'string' },
sheetIndex: { type: 'number', description: '0-based index of the sheet.' },
rowCount: { type: 'number', description: 'Total row count of the sheet.' },
colCount: { type: 'number', description: 'Total column count of the sheet.' },
usedRange: { type: 'object', description: 'Bounding box of the populated data region.' },
rows: { type: 'array', description: 'Row model array. Present when "rows" is in keys.' },
columns: { type: 'array', description: 'Column model array. Present when "columns" is in keys.' },
cells: { type: 'object', description: 'Flat cell map. Present when "cells" is in keys.' }
},
required: ['sheetName', 'sheetIndex']
}
},
{
name: 'sheetList',
annotations: {
readOnlyHint: true
},
description: 'Returns the names of all sheets in the workbook. Use to discover available sheet names before calling getSheetInfo, getRangeData, or getCellData.',
inputSchema: {
type: 'object',
properties: {}
},
outputSchema: {
type: 'object',
properties: {
sheets: {
type: 'array',
items: { type: 'string' },
description: 'Ordered list of sheet names in the workbook.'
}
},
required: ['sheets']
}
},
{
name: 'evaluateFormula',
annotations: {
readOnlyHint: true
},
description: 'Computes a formula string and returns its result without writing to any cell. Use when the user asks for a calculated value without modifying the sheet; use editCell if the result must be stored.',
inputSchema: {
type: 'object',
properties: {
formula: { type: 'string', description: 'Formula string, e.g. "=SUM(A1:A5)".' }
},
required: ['formula']
},
outputSchema: {
type: 'object',
properties: {
formula: { type: 'string', description: 'The formula string that was evaluated.' },
value: { description: 'Computed result — string or number.' }
},
required: ['formula', 'value']
}
},
{
name: 'find',
annotations: {
readOnlyHint: true
},
description: 'Search a sheet or range for a value and return the matching cell addresses. Use this first to locate the address of a cell when answering a general query, then call getCellData or getRangeData to read the value.',
inputSchema: {
type: 'object',
properties: {
findValue: { type: 'string', description: 'Term to search for. Prefer a value taken from the user query (e.g. a product name, header label, or ID).' },
sheetName: { type: 'string', description: 'Sheet name. Defaults to the active sheet.' },
range: { type: 'string', description: 'Optional range in A1:B10 notation. If omitted, searches the used range of the sheet.' },
caseSensitive: { type: 'boolean', description: 'Match exact case. Defaults to false.' },
exactMatch: { type: 'boolean', description: 'Match entire cell content. Defaults to false.' }
},
required: ['findValue']
},
outputSchema: {
type: 'object',
properties: {
action: { type: 'string', description: 'Echoes "find".' },
message: { type: 'string', description: 'Summary, e.g. "Found 3 match(es) for "Shoes" in sheet Price Details."' },
addresses: {
type: 'array',
items: { type: 'string', description: 'Fully-qualified address, e.g. "Price Details!B4".' },
description: 'All cell addresses where the search term was found. Empty array when no matches.'
}
},
required: ['action', 'message', 'addresses']
}
},
{
name: 'editCell',
annotations: {
readOnlyHint: false
},
description: 'Writes a value or formula into a single cell, mutating the spreadsheet. Prefix formulas with "=". Use for targeted single-cell edits; use formatCells if you only need to change appearance without altering the value.',
inputSchema: {
type: 'object',
properties: {
address: { type: 'string', description: 'A1 notation cell address.' },
value: { description: 'New cell value or formula string. Any range reference must specify both start and end cells using A1 notation, for example: SheetName!A2:A10, SheetName!B5:D20. Do not use unbounded column or row references such as SheetName!A:A, A:A, SheetName!1:1, or 1:1.' }
},
required: ['address', 'value']
},
outputSchema: {
type: 'object',
properties: {
action: { type: 'string', description: 'Echoes "edit".' },
cancelled: { type: 'boolean', description: 'True when the user explicitly denied the action. Do not retry if this is true.' },
message: { type: 'string', description: 'Human-readable confirmation, e.g. "Updated A1 to 1000."' }
},
required: ['action', 'message']
}
},
{
name: 'formatCells',
annotations: {
readOnlyHint: false
},
description: 'Applies visual formatting (bold, italic, font, color, background) to a range without changing cell values. Use for appearance changes only; use setNumberFormat when the requirement is a numeric display pattern like currency or percentage.',
inputSchema: {
type: 'object',
properties: {
range: { type: 'string' },
formatting: {
type: 'object',
properties: {
bold: { type: 'boolean' },
italic: { type: 'boolean' },
underline: { type: 'boolean' },
strikethrough: { type: 'boolean' },
fontSize: { type: 'number' },
fontFamily: { type: 'string' },
color: { type: 'string', description: 'Hex color, e.g. "#FF0000".' },
backgroundColor: { type: 'string' }
}
}
},
required: ['range', 'formatting']
},
outputSchema: {
type: 'object',
properties: {
action: { type: 'string', description: 'Echoes "cellFormat".' },
cancelled: { type: 'boolean', description: 'True when the user explicitly denied the action. Do not retry if this is true.' },
message: { type: 'string', description: 'Confirmation of formatting applied.' }
},
required: ['action', 'message']
}
},
{
name: 'setNumberFormat',
annotations: {
readOnlyHint: false
},
description: 'Applies a named number format (Currency, Percentage, Date, etc.) to a range. Use when the user specifies how numbers should be displayed; use formatCells for font or color changes.',
inputSchema: {
type: 'object',
properties: {
range: { type: 'string' },
format: {
type: 'string',
enum: ['General', 'Number', 'Currency', 'Accounting', 'ShortDate', 'LongDate',
'Time', 'Percentage', 'Fraction', 'Scientific', 'Text']
}
},
required: ['range', 'format']
},
outputSchema: {
type: 'object',
properties: {
action: { type: 'string', description: 'Echoes "numberFormat".' },
cancelled: { type: 'boolean', description: 'True when the user explicitly denied the action. Do not retry if this is true.' },
message: { type: 'string', description: 'Confirmation, e.g. "Applied Currency format to A1:A10."' }
},
required: ['action', 'message']
}
},
{
name: 'addConditionalFormat',
annotations: {
readOnlyHint: false
},
description: 'Adds a rule-based conditional formatting highlight to a range that updates dynamically as values change. Use when the user wants cells to change color based on a condition; use formatCells for static formatting.',
inputSchema: {
type: 'object',
properties: {
range: { type: 'string' },
type: {
type: 'string',
enum: ['GreaterThan', 'LessThan', 'Between', 'EqualTo', 'ContainsText',
'DateOccur', 'Duplicate', 'Unique', 'Top10Items', 'Bottom10Items',
'Top10Percentage', 'Bottom10Percentage', 'AboveAverage', 'BelowAverage']
},
value: { type: 'string', description: 'Threshold value. For Between use "min,max".' },
cFColor: { type: 'string', enum: ['RedFT', 'YellowFT', 'GreenFT'] }
},
required: ['range', 'type']
},
outputSchema: {
type: 'object',
properties: {
action: { type: 'string', description: 'Echoes "conditionalFormat".' },
cancelled: { type: 'boolean', description: 'True when the user explicitly denied the action. Do not retry if this is true.' },
message: { type: 'string' }
},
required: ['action', 'message']
}
},
{
name: 'mergeCells',
annotations: {
readOnlyHint: false
},
description: 'Merges a group of cells into one spanning cell. Use only when explicitly asked to merge; merging destroys data in all cells except the top-left.',
inputSchema: {
type: 'object',
properties: {
range: { type: 'string' },
direction: { type: 'string', enum: ['All', 'Vertically', 'Horizontally'] }
},
required: ['range']
},
outputSchema: {
type: 'object',
properties: {
action: { type: 'string', description: 'Echoes "merge".' },
cancelled: { type: 'boolean', description: 'True when the user explicitly denied the action. Do not retry if this is true.' },
message: { type: 'string' }
},
required: ['action', 'message']
}
},
{
name: 'toggleWrap',
annotations: {
readOnlyHint: false
},
description: 'Enables or disables text wrapping within cells of a range so long text shows on multiple lines. Use for wrap-related requests only; do not call this as part of general formatting unless wrap is specifically requested.',
inputSchema: {
type: 'object',
properties: {
range: { type: 'string' },
wrap: { type: 'boolean' }
},
required: ['range', 'wrap']
},
outputSchema: {
type: 'object',
properties: {
action: { type: 'string', description: 'Echoes "wrap".' },
cancelled: { type: 'boolean', description: 'True when the user explicitly denied the action. Do not retry if this is true.' },
message: { type: 'string' }
},
required: ['action', 'message']
}
},
{
name: 'cut',
annotations: {
readOnlyHint: false
},
description: 'Cuts a range to the internal clipboard, ready for paste. Use copy instead if the source data must be preserved.',
inputSchema: {
type: 'object',
properties: { range: { type: 'string' } },
required: ['range']
},
outputSchema: {
type: 'object',
properties: {
action: { type: 'string', description: 'Echoes "cut".' },
cancelled: { type: 'boolean', description: 'True when the user explicitly denied the action. Do not retry if this is true.' },
message: { type: 'string' }
},
required: ['action', 'message']
}
},
{
name: 'copy',
annotations: {
readOnlyHint: false
},
description: 'Copies a range to the internal clipboard without removing source data. Use cut if the intent is to move data rather than duplicate it.',
inputSchema: {
type: 'object',
properties: { range: { type: 'string' } },
required: ['range']
},
outputSchema: {
type: 'object',
properties: {
action: { type: 'string', description: 'Echoes "copy".' },
cancelled: { type: 'boolean', description: 'True when the user explicitly denied the action. Do not retry if this is true.' },
message: { type: 'string' }
},
required: ['action', 'message']
}
},
{
name: 'paste',
annotations: {
readOnlyHint: false
},
description: 'Pastes the current clipboard content into the specified destination range.',
inputSchema: {
type: 'object',
properties: { range: { type: 'string', description: 'Paste destination.' } },
required: ['range']
},
outputSchema: {
type: 'object',
properties: {
action: { type: 'string', description: 'Echoes "paste".' },
cancelled: { type: 'boolean', description: 'True when the user explicitly denied the action. Do not retry if this is true.' },
message: { type: 'string' }
},
required: ['action', 'message']
}
},
{
name: 'insertChart',
annotations: {
readOnlyHint: false
},
description: 'Creates and inserts a chart bound to a data range into the active sheet. Use when the user asks to visualize data; pass space-separated ranges like "A1:A11 E1:E11" for discontinuous series.',
inputSchema: {
type: 'object',
properties: {
range: {
type: 'string',
description: 'Use a single contiguous range (e.g. "A1:H11") or space-separated discontinuous ranges (e.g. "A1:A11 E1:E11 H1:H11") to plot non-adjacent columns.'
},
chartType: {
type: 'string',
enum: ['Column', 'Bar', 'Line', 'Area', 'Pie', 'Doughnut', 'Scatter',
'StackingColumn', 'StackingColumn100', 'StackingBar', 'StackingBar100',
'StackingLine', 'StackingLine100', 'StackingArea', 'StackingArea100']
},
title: { type: 'string' },
theme: { type: 'string', enum: ['Material', 'Bootstrap', 'Fabric', 'Office365', 'Tailwind'] },
isSeriesInRows: { type: 'boolean' },
height: { type: 'number' },
width: { type: 'number' }
},
required: ['range', 'chartType']
},
outputSchema: {
type: 'object',
properties: {
action: { type: 'string', description: 'Echoes "chart".' },
cancelled: { type: 'boolean', description: 'True when the user explicitly denied the action. Do not retry if this is true.' },
message: { type: 'string', description: 'Confirmation, e.g. "Inserted Column chart for range A1:H11."' }
},
required: ['action', 'message']
}
},
{
name: 'addDataValidation',
annotations: {
readOnlyHint: false
},
description: 'Attaches an input validation rule to a range that restricts what values can be entered. Use when the user wants to enforce data entry rules or create a dropdown list.',
inputSchema: {
type: 'object',
properties: {
range: { type: 'string' },
dvType: { type: 'string', enum: ['WholeNumber', 'Decimal', 'Date', 'Time', 'TextLength', 'List', 'Custom'] },
dvOperator: { type: 'string', enum: ['Between', 'NotBetween', 'EqualTo', 'NotEqualTo', 'GreaterThan', 'LessThan', 'GreaterThanOrEqualTo', 'LessThanOrEqualTo'] },
dvValue1: { type: 'string' },
dvValue2: { type: 'string' },
dvIgnoreBlank: { type: 'boolean' },
dvInCellDropDown: { type: 'boolean' }
},
required: ['range', 'dvType']
},
outputSchema: {
type: 'object',
properties: {
action: { type: 'string', description: 'Echoes "dataValidation".' },
cancelled: { type: 'boolean', description: 'True when the user explicitly denied the action. Do not retry if this is true.' },
message: { type: 'string' }
},
required: ['action', 'message']
}
},
{
name: 'filterRange',
annotations: {
readOnlyHint: false
},
description: 'Applies a column filter to a range to show only rows matching a condition, or clears an existing filter. Use when the user wants to narrow visible rows; use sortRange if the intent is to reorder rows rather than hide them.',
inputSchema: {
type: 'object',
properties: {
range: { type: 'string' },
filterColumn: { type: 'string', description: 'Column letter, e.g. "A".' },
filterOperator: { type: 'string', enum: ['equal', 'notequal', 'greaterthan', 'lessthan', 'greaterthanorequal', 'lessthanorequal', 'contains', 'startswith', 'endswith', 'isempty', 'isnotempty'] },
filterValue: { type: 'string' },
clearFilter: { type: 'boolean', description: 'Set true to remove the existing filter.' }
},
required: ['range']
},
outputSchema: {
type: 'object',
properties: {
action: { type: 'string', description: 'Echoes "filter".' },
cancelled: { type: 'boolean', description: 'True when the user explicitly denied the action. Do not retry if this is true.' },
message: { type: 'string' }
},
required: ['action', 'message']
}
},
{
name: 'sortRange',
annotations: {
readOnlyHint: false
},
description: 'Reorders the rows of a range by the values in a specified column in ascending or descending order. Use when the user asks to sort data; use filterRange if the intent is to hide rows rather than reorder them.',
inputSchema: {
type: 'object',
properties: {
range: { type: 'string' },
sortColumn: { type: 'string', description: 'Column letter, e.g. "B".' },
sortOrder: { type: 'string', enum: ['Ascending', 'Descending'] },
sortContainsHeader: { type: 'boolean' }
}
},
outputSchema: {
type: 'object',
properties: {
action: { type: 'string', description: 'Echoes "sort".' },
cancelled: { type: 'boolean', description: 'True when the user explicitly denied the action. Do not retry if this is true.' },
message: { type: 'string' }
},
required: ['action', 'message']
}
},
{
name: 'insertRowsColumns',
annotations: {
readOnlyHint: false
},
description: 'Inserts one or more blank rows or columns at a specified position, shifting existing content down or right. Use when adding new rows or columns; use editCell to fill the inserted cells afterward.',
inputSchema: {
type: 'object',
properties: {
modelType: { type: 'string', enum: ['Row', 'Column'] },
startIndex: { type: 'number', description: '1-based row or column index.' },
count: { type: 'number', description: 'Number to insert. Defaults to 1.' }
},
required: ['modelType', 'startIndex']
},
outputSchema: {
type: 'object',
properties: {
action: { type: 'string', description: 'Echoes "insert".' },
cancelled: { type: 'boolean', description: 'True when the user explicitly denied the action. Do not retry if this is true.' },
message: { type: 'string', description: 'Confirmation, e.g. "Inserted 2 Row(s) at position 3."' }
},
required: ['action', 'message']
}
},
{
name: 'deleteRowsColumns',
annotations: {
readOnlyHint: false
},
description: 'Permanently removes one or more rows or columns at a specified position. This is destructive and shifts remaining content. Use only when the user explicitly asks to delete; prefer insertRowsColumns if the intent is to add space.',
inputSchema: {
type: 'object',
properties: {
modelType: { type: 'string', enum: ['Row', 'Column'] },
startIndex: { type: 'number', description: '1-based row or column index.' },
count: { type: 'number', description: 'Number to delete. Defaults to 1.' }
},
required: ['modelType', 'startIndex']
},
outputSchema: {
type: 'object',
properties: {
action: { type: 'string', description: 'Echoes "delete".' },
cancelled: { type: 'boolean', description: 'True when the user explicitly denied the action. Do not retry if this is true.' },
message: { type: 'string', description: 'Confirmation, e.g. "Deleted 1 Row(s) starting at position 5."' }
},
required: ['action', 'message']
}
},
{
name: 'insertSheet',
annotations: {
readOnlyHint: false
},
description: 'Inserts one or more new blank sheets into the workbook at a given position. Use when the user asks to add a new sheet or tab.',
inputSchema: {
type: 'object',
properties: {
startIndex: { type: 'number', description: '0-based sheet index at which to insert. Defaults to inserting after the last sheet.' },
count: { type: 'number', description: 'Number of sheets to insert. Defaults to 1.' },
sheetName: { type: 'string', description: 'Name for the new sheet. Applied only when inserting a single sheet.' }
}
},
outputSchema: {
type: 'object',
properties: {
action: { type: 'string', description: 'Echoes "insertSheet".' },
cancelled: { type: 'boolean', description: 'True when the user explicitly denied the action. Do not retry if this is true.' },
message: { type: 'string', description: 'Confirmation, e.g. "Inserted 1 sheet at position 2."' }
},
required: ['action', 'message']
}
},
{
name: 'findReplace',
annotations: {
readOnlyHint: false
},
description: 'Finds all occurrences of a value in the active sheet and replaces them with a new value. Use only when the user wants to change existing content; use find when you only need to locate a value without modifying it.',
inputSchema: {
type: 'object',
properties: {
findValue: { type: 'string' },
replaceValue: { type: 'string' },
caseSensitive: { type: 'boolean' },
exactMatch: { type: 'boolean' }
},
required: ['findValue', 'replaceValue']
},
outputSchema: {
type: 'object',
properties: {
action: { type: 'string', description: 'Echoes "findAndReplace".' },
cancelled: { type: 'boolean', description: 'True when the user explicitly denied the action. Do not retry if this is true.' },
message: { type: 'string', description: 'Confirmation of replacements made.' }
},
required: ['action', 'message']
}
},
{
name: 'autofill',
annotations: {
readOnlyHint: false
},
description: 'Extends a data pattern or series from a source range into an adjacent target range automatically. Use when the user asks to fill or extend a series; use editCell for non-pattern single-cell writes.',
inputSchema: {
type: 'object',
properties: {
dataRange: { type: 'string', description: 'Source range, e.g. "A1:A3".' },
fillRange: { type: 'string', description: 'Target range to fill, e.g. "A4:A10".' },
direction: { type: 'string', enum: ['Down', 'Up', 'Left', 'Right'] },
fillType: { type: 'string', enum: ['FillSeries', 'CopyCells', 'FillFormattingOnly', 'FillWithoutFormatting'] }
},
required: ['dataRange', 'fillRange']
},
outputSchema: {
type: 'object',
properties: {
action: { type: 'string', description: 'Echoes "autofill".' },
cancelled: { type: 'boolean', description: 'True when the user explicitly denied the action. Do not retry if this is true.' },
message: { type: 'string' }
},
required: ['action', 'message']
}
},
{
name: 'freezePanes',
annotations: {
readOnlyHint: false
},
description: 'Freezes or unfreezes rows, columns, or both so they remain visible while scrolling. Use for scroll-lock requests only; pass Unfreeze as the freezeType to remove existing frozen panes.',
inputSchema: {
type: 'object',
properties: {
freezeType: { type: 'string', enum: ['Rows', 'Columns', 'Panes', 'Unfreeze'] },
row: { type: 'number', description: 'Number of rows to freeze.' },
column: { type: 'number', description: 'Number of columns to freeze.' }
},
required: ['freezeType']
},
outputSchema: {
type: 'object',
properties: {
action: { type: 'string', description: 'Echoes "freezePanes".' },
cancelled: { type: 'boolean', description: 'True when the user explicitly denied the action. Do not retry if this is true.' },
message: { type: 'string' }
},
required: ['action', 'message']
}
},
{
name: 'insertHyperlink',
annotations: {
readOnlyHint: false
},
description: 'Inserts a clickable hyperlink into a cell with a display label. Use for URL or sheet-navigation links; use editCell if you only want to write a plain URL text value without making it clickable.',
inputSchema: {
type: 'object',
properties: {
address: { type: 'string', description: 'URL or sheet reference, e.g. "https://example.com".' },
displayText: { type: 'string' },
range: { type: 'string', description: 'Target cell. Defaults to the active cell.' }
},
required: ['address']
},
outputSchema: {
type: 'object',
properties: {
action: { type: 'string', description: 'Echoes "hyperlink".' },
cancelled: { type: 'boolean', description: 'True when the user explicitly denied the action. Do not retry if this is true.' },
message: { type: 'string' }
},
required: ['action', 'message']
}
},
{
name: 'save',
annotations: {
readOnlyHint: false
},
description: 'Opens the export dialog so the user can save the spreadsheet in a chosen format (xlsx, csv, pdf, etc.). Use only when the user explicitly asks to save or export; do not call this automatically at the end of other operations.',
inputSchema: {
type: 'object',
properties: {
saveType: { type: 'string', enum: ['xlsx', 'xls', 'csv', 'pdf'] }
}
},
outputSchema: {
type: 'object',
properties: {
action: { type: 'string', description: 'Echoes "save".' },
cancelled: { type: 'boolean', description: 'True when the user explicitly denied the action. Do not retry if this is true.' },
message: { type: 'string', description: 'Confirmation that the save dialog was opened.' }
},
required: ['action', 'message']
}
},
{
name: 'undo',
annotations: {
readOnlyHint: false
},
description: 'Reverses the last action performed on the spreadsheet. Call once per undo step. Do not call speculatively — only when the user explicitly asks to undo.',
inputSchema: {
type: 'object',
properties: {}
},
outputSchema: {
type: 'object',
properties: {
action: { type: 'string', description: 'Echoes "undo".' },
message: { type: 'string', description: 'Confirmation that the undo was performed, or a reason it was skipped (e.g. nothing to undo).' }
},
required: ['action', 'message']
}
}
];
var CAPABILITY_ACTION_MAP = {
editCell: 'edit',
formatCells: 'cellFormat',
setNumberFormat: 'numberFormat',
addConditionalFormat: 'conditionalFormat',
mergeCells: 'merge',
toggleWrap: 'wrap',
cut: 'cut',
copy: 'copy',
paste: 'paste',
insertChart: 'chart',
addDataValidation: 'dataValidation',
filterRange: 'filter',
sortRange: 'sort',
insertRowsColumns: 'insert',
deleteRowsColumns: 'delete',
insertSheet: 'insertSheet',
findReplace: 'findAndReplace',
find: 'find',
autofill: 'autofill',
freezePanes: 'freezePanes',
insertHyperlink: 'hyperlink',
save: 'save'
};
var WebMcpAdapter = (function () {
function WebMcpAdapter(parent) {
this.webMcpAbortController = null;
this.parent = parent;
this.executor = new command_executor_1.CommandExecutor(parent);
this.addEventListener();
}
WebMcpAdapter.prototype.addEventListener = function () {
this.parent.on(index_2.getWebMcpTools, this.getTools, this);
this.parent.on(index_2.registerWebMcpTools, this.registerTools, this);
};
WebMcpAdapter.prototype.removeEventListener = function () {
if (!this.parent.isDestroyed) {
this.parent.off(index_2.getWebMcpTools, this.getTools);
this.parent.off(index_2.registerWebMcpTools, this.registerTools);
}
};
WebMcpAdapter.prototype.getTools = function (args) {
var toolNames = args.toolNames;
if (toolNames && toolNames.length !== 0) {
args.tools = webMcpTools.filter(function (webMcpTool) { return toolNames.indexOf(webMcpTool.name) !== -1; })
.map(function (webMcpTool) { return (__assign({}, webMcpTool)); });
}
else {
args.tools = webMcpTools.map(function (webMcpTool) { return (__assign({}, webMcpTool)); });
}
return args.tools;
};
WebMcpAdapter.prototype.registerTools = function (args) {
var _this = this;
var modelContext = document.modelContext;
if (!modelContext || typeof modelContext.registerTool !== 'function') {
return;
}
this.webMcpAbortController = new AbortController();
var toolPrefix = (ej2_base_1.isNullOrUndefined(args.prefix) ? this.parent.element.id : args.prefix);
var tools = args.tools && args.tools.length && typeof args.tools[0] === 'object' ? args.tools :
this.getTools({ toolNames: args.tools });
tools.forEach(function (tool) {
tool.name = toolPrefix + "_" + tool.name;
tool.execute = tool.execute || (function (args) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
return [2, this.executeHandler(tool.name, args || {})];
}); }); });
modelContext.registerTool(tool, { signal: _this.webMcpAbortController.signal, exposedTo: args.exposedTo });
});
};
WebMcpAdapter.prototype.executeHandler = function (command, args) {
return __awaiter(this, void 0, void 0, function () {
var baseCommand, eventArgs, _a, summary, approved, action, results, r;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
baseCommand = command.includes('_') ? command.substring(command.indexOf('_') + 1) : command;
eventArgs = { toolName: command, toolArgs: args };
this.parent.trigger('beforeWebMcpToolExecute', eventArgs);
if (eventArgs.cancel) {
return [2, this.message({
action: command, cancelled: true,
message: eventArgs.cancellationResponse || '[User_CANCELLED] The tool execution for "${command}" was cancelled by the beforeWebMcpToolExecute event handler. ' +
'This is a final, irreversible decision by the user. ' +
'Do NOT retry this action, do NOT attempt a variation of it, ' +
'and do NOT proceed with any subsequent steps that depend on it. ' +
'Acknowledge the cancellation and stop.'
})];
}
_a = baseCommand;
switch (_a) {
case 'getCellData': return [3, 1];
case 'getRangeData': return [3, 2];
case 'getSheetInfo': return [3, 3];
case 'evaluateFormula': return [3, 4];
case 'find': return [3, 5];
case 'undo': return [3, 6];
case 'sheetList': return [3, 7];
}
return [3, 8];
case 1: return [2, this.handleGetCellData(args)];
case 2: return [2, this.handleGetRangeData(args)];
case 3: return [2, this.getSheetInfoHandler(args)];
case 4: return [2, this.handleEvaluateFormula(args)];
case 5: return [2, this.handleFind(args)];
case 6: return [2, this.handleUndo()];
case 7: return [2, this.handleSheetList()];
case 8:
if (!eventArgs.showConfirmationDialog) return [3, 10];
summary = this.buildConfirmationMessage(baseCommand, args);
return [4, this.requestConfirmation(baseCommand, args, summary)];
case 9:
approved = _b.sent();
if (!approved) {
return [2, this.message({
action: baseCommand,
cancelled: true,
message: eventArgs.cancellationResponse || '[USER_CANCELLED] The user explicitly denied: "${summary}". ' +
'This is a final, irreversible decision by the user. ' +
'Do NOT retry this action, do NOT attempt a variation of it, ' +
'and do NOT proceed with any subsequent steps that depend on it. ' +
'Acknowledge the cancellation and stop.'
})];
}
_b.label = 10;
case 10:
action = CAPABILITY_ACTION_MAP[baseCommand] || 'unknown';
return [4, this.executor.executeHandler([{ action: action, args: args }])];
case 11:
results = _b.sent();
r = results[0];
if (!r.success) {
return [2, this.error(r.message || 'Command failed.')];
}
return [2, this.message(__assign({ action: r.action, message: r.message }, (r.data || {})))];
}
});
});
};
WebMcpAdapter.prototype.destroy = function () {
this.removeEventListener();
if (this.webMcpAbortController) {
this.webMcpAbortController.abort();
this.webMcpAbortController = null;
}
this.executor = null;
this.parent = null;
};
WebMcpAdapter.prototype.getModuleName = function () {
return 'WebMcpAdapter';
};
WebMcpAdapter.prototype.message = function (data) {
return { content: [{ type: 'text', text: JSON.stringify(data) }] };
};
WebMcpAdapter.prototype.error = function (text) {
return { content: [{ type: 'text', text: text }], isError: true };
};
WebMcpAdapter.prototype.resolveSheetName = function (sheetName) {
return (typeof sheetName === 'string' && sheetName.trim()) ? sheetName.trim() : this.parent.getActiveSheet().name;
};
WebMcpAdapter.prototype.resolveSheetIndex = function (sheetName) {
return (this.parent.sheets).findIndex(function (sheet) {
return !ej2_base_1.isNullOrUndefined(sheet.name) && sheet.name.toLowerCase() === sheetName.toLowerCase();
});
};
WebMcpAdapter.prototype.handleGetCellData = function (args) {
if (!args.address) {
return this.error('Missing required argument: address');
}
var sheetName = this.resolveSheetName(args.sheetName);
var sheetIndex = this.resolveSheetIndex(sheetName);
if (sheetIndex < 0) {
return this.error("Sheet \"" + sheetName + "\" not found.");
}
try {
var idx = index_2.getRangeIndexes(args.address);
var cell = index_3.getCell(idx[0], idx[1], this.parent.sheets[sheetIndex], false, true);
var payload = {
sheetName: sheetName,
address: args.address,
value: cell.value
};
var hasContent = cell.value !== undefined && cell.value !== null && cell.value !== '';
if (hasContent && cell.format) {
payload.displayText = this.parent.getDisplayText(cell);
}
if (cell.formula) {
payload.formula = cell.formula;
}
if (args.includeFormat) {
Eif (cell.format) {
payload.format = cell.format;
}
if (cell.style) {
payload.style = cell.style;
}
}
return this.message(payload);
}
catch (_a) {
return this.error("Cannot read cell at \"" + args.address + "\".");
}
};
WebMcpAdapter.prototype.handleGetRangeData = function (args) {
if (!args.range) {
return this.error('Missing required argument: range');
}
var sheetName = this.resolveSheetName(args.sheetName);
var sheetIndex = this.resolveSheetIndex(sheetName);
if (sheetIndex < 0) {
return this.error("Sheet \"" + sheetName + "\" not found.");
}
try {
var idx = index_2.getRangeIndexes(args.range);
var MAX_ROWS = 200;
var endRow = Math.min(idx[2], idx[0] + MAX_ROWS - 1);
var sheet = this.parent.sheets[sheetIndex];
var cells = [];
for (var row = idx[0]; row <= endRow; row++) {
var rows = [];
for (var column = idx[1]; column <= idx[3]; column++) {
var cell = index_3.getCell(row, column, sheet, false, true);
var cellData = { value: cell.value };
var hasContent = cell.value !== undefined && cell.value !== null && cell.value !== '';
if (hasContent && cell.format) {
cellData.displayText = this.parent.getDisplayText(cell);
}
if (cell.formula) {
cellData.formula = cell.formula;
}
if (cell.format) {
cellData.format = cell.format;
}
if (cell.style) {
cellData.style = cell.style;
}
rows.push(cellData);
}
cells.push(rows);
}
return this.message({
sheetName: sheetName,
range: args.range,
rowCount: endRow - idx[0] + 1,
colCount: idx[3] - idx[1] + 1,
truncated: idx[2] > endRow,
cells: cells
});
}
catch (_a) {
return this.error("Cannot read range \"" + args.range + "\".");
}
};
WebMcpAdapter.prototype.getSheetInfoHandler = function (args) {
var sheetName = this.resolveSheetName(args.sheetName);
var sheetIndex = this.resolveSheetIndex(sheetName);
if (sheetIndex < 0) {
return this.error("Sheet \"" + sheetName + "\" not found.");
}
try {
var sheetData = JSON.parse(index_1.getSheetProperties(this.parent, ['rows', 'columns', 'cells'], sheetIndex, ['value']));
return this.message(__assign({ sheetName: sheetName, sheetIndex: sheetIndex }, sheetData));
}
catch (_a) {
return this.error('Failed to parse sheet properties.');
}
};
WebMcpAdapter.prototype.handleEvaluateFormula = function (args) {
if (!args.formula) {
return this.error('Missing required argument: formula');
}
try {
var value = this.parent.computeExpression(args.formula);
return this.message({ formula: args.formula, value: value });
}
catch (e) {
return this.error((e instanceof Error) ? e.message : "Cannot evaluate formula \"" + args.formula + "\".");
}
};
WebMcpAdapter.prototype.handleFind = function (args) {
if (!args.findValue) {
return this.error('Missing required argument: findValue');
}
try {
var findResult = this.executor.executeFind(args);
return this.message({ action: 'find', message: findResult.message, addresses: findResult.addresses });
}
catch (e) {
return this.error((e instanceof Error) ? e.message : 'Find operation failed.');
}
};
WebMcpAdapter.prototype.handleUndo = function () {
try {
this.parent.undo();
return this.message({ action: 'undo', message: 'Undo performed successfully.' });
}
catch (e) {
return this.error((e instanceof Error) ? e.message : 'Undo operation failed.');
}
};
WebMcpAdapter.prototype.handleSheetList = function () {
try {
var sheets = (this.parent.sheets).map(function (sheet) { return sheet.name; });
return this.message({ sheets: sheets });
}
catch (e) {
return this.error('Failed to retrieve sheet list.');
}
};
WebMcpAdapter.prototype.buildConfirmationMessage = function (command, args) {
switch (command) {
case 'editCell': return "Edit cell " + args.address + " \u2192 \"" + args.value + "\"";
case 'formatCells': return "Apply formatting to range " + args.range;
case 'setNumberFormat': return "Apply \"" + args.format + "\" number format to " + args.range;
case 'addConditionalFormat': return "Add conditional format (" + args.type + ") to " + args.range;
case 'mergeCells': return "Merge cells " + args.range;
case 'toggleWrap': return (args.wrap ? 'Enable' : 'Disable') + " text wrap on " + args.range;
case 'cut': return "Cut range " + args.range;
case 'copy': return "Copy range " + args.range;
case 'paste': return "Paste into " + args.range;
case 'insertChart': return "Insert " + args.chartType + " chart for range " + args.range;
case 'addDataValidation': return "Add " + args.dvType + " validation to " + args.range;
case 'filterRange': return args.clearFilter ? "Clear filter on " + args.range
: "Filter " + args.range + " where column " + args.filterColumn + " " + args.filterOperator + " \"" + args.filterValue + "\"";
case 'sortRange': return "Sort " + args.range + " by column " + args.sortColumn + " (" + args.sortOrder + ")";
case 'insertRowsColumns': return "Insert " + args.count + " " + args.modelType + "(s) at position " + args.startIndex;
case 'deleteRowsColumns': return "Delete " + args.count + " " + args.modelType + "(s) at position " + args.startIndex;
case 'insertSheet': return "Insert " + (args.count || 1) + " sheet(s)" + (args.sheetName ? " named \"" + args.sheetName + "\"" : '') + " at position " + (args.startIndex || 'end');
case 'findReplace': return "Replace all \"" + args.findValue + "\" with \"" + args.replaceValue + "\"";
case 'autofill': return "Autofill " + args.dataRange + " \u2192 " + args.fillRange;
case 'freezePanes': return "" + (args.freezeType === 'Unfreeze' ? 'Unfreeze panes' : "Freeze " + args.freezeType);
case 'insertHyperlink': return "Insert hyperlink \"" + args.displayText + "\" in " + (args.range || 'active cell');
case 'save': return "Save spreadsheet as " + (args.saveType || 'xlsx');
default: return "Perform \"" + command + "\" action";
}
};
WebMcpAdapter.prototype.requestConfirmation = function (command, args, summary) {
var _this = this;
return new Promise(function (resolve) {
var msg = summary || _this.buildConfirmationMessage(command, args);
var dialogInst = _this.parent.serviceLocator.getService(index_1.dialog);
var approved = false;
dialogInst.show({
width: 375,
showCloseIcon: true,
isModal: true,
cssClass: 'e-webmcp-confirm-dlg',
header: 'AI Action Request',
content: msg,
enableRtl: _this.parent.enableRtl,
close: function () {
resolve(approved);
},
buttons: [
{
buttonModel: { content: 'Ok', isPrimary: true },
click: function () { approved = true; dialogInst.hide(); }
}
]
});
});
};
return WebMcpAdapter;
}());
exports.WebMcpAdapter = WebMcpAdapter;
});
|