@atmaticai/agent-tools 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js ADDED
@@ -0,0 +1,3933 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ var commander = require('commander');
5
+ var index_js = require('@modelcontextprotocol/sdk/server/index.js');
6
+ var stdio_js = require('@modelcontextprotocol/sdk/server/stdio.js');
7
+ var types_js = require('@modelcontextprotocol/sdk/types.js');
8
+ var settings = require('@atmaticai/agent-tools-core/settings');
9
+ var agentToolsCore = require('@atmaticai/agent-tools-core');
10
+ var express = require('express');
11
+
12
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
13
+
14
+ var express__default = /*#__PURE__*/_interopDefault(express);
15
+
16
+ var jsonTools = [
17
+ {
18
+ name: "agent_tools_json_format",
19
+ description: "Format JSON with configurable indentation. Returns pretty-printed JSON.",
20
+ inputSchema: {
21
+ type: "object",
22
+ properties: {
23
+ input: {
24
+ type: "string",
25
+ description: "The JSON string to format"
26
+ },
27
+ indent: {
28
+ type: "number",
29
+ enum: [2, 4],
30
+ description: "Number of spaces for indentation (default: 2)"
31
+ },
32
+ sortKeys: {
33
+ type: "boolean",
34
+ description: "Sort object keys alphabetically (default: false)"
35
+ }
36
+ },
37
+ required: ["input"]
38
+ },
39
+ handler: async (args) => {
40
+ try {
41
+ const result = agentToolsCore.json.format(args.input, {
42
+ indent: args.indent || 2,
43
+ sortKeys: args.sortKeys || false
44
+ });
45
+ return { content: [{ type: "text", text: result }] };
46
+ } catch (e) {
47
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
48
+ }
49
+ }
50
+ },
51
+ {
52
+ name: "agent_tools_json_validate",
53
+ description: "Validate JSON, optionally against a JSON Schema. Returns validation result with errors.",
54
+ inputSchema: {
55
+ type: "object",
56
+ properties: {
57
+ input: {
58
+ type: "string",
59
+ description: "The JSON string to validate"
60
+ },
61
+ schema: {
62
+ type: "string",
63
+ description: "Optional JSON Schema to validate against"
64
+ }
65
+ },
66
+ required: ["input"]
67
+ },
68
+ handler: async (args) => {
69
+ const result = agentToolsCore.json.validate(args.input, args.schema);
70
+ return {
71
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
72
+ };
73
+ }
74
+ },
75
+ {
76
+ name: "agent_tools_json_query",
77
+ description: "Query JSON using JSONPath or JMESPath. Returns the matched values.",
78
+ inputSchema: {
79
+ type: "object",
80
+ properties: {
81
+ input: {
82
+ type: "string",
83
+ description: "The JSON string to query"
84
+ },
85
+ path: {
86
+ type: "string",
87
+ description: 'The query path (e.g., "$.store.book[*].author")'
88
+ },
89
+ dialect: {
90
+ type: "string",
91
+ enum: ["jsonpath", "jmespath"],
92
+ description: "Query dialect (default: jsonpath)"
93
+ }
94
+ },
95
+ required: ["input", "path"]
96
+ },
97
+ handler: async (args) => {
98
+ const result = agentToolsCore.json.query(args.input, args.path, {
99
+ dialect: args.dialect || "jsonpath"
100
+ });
101
+ return {
102
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
103
+ };
104
+ }
105
+ },
106
+ {
107
+ name: "agent_tools_json_convert",
108
+ description: "Convert between JSON, JSON5, JSONC, YAML, and TOML formats.",
109
+ inputSchema: {
110
+ type: "object",
111
+ properties: {
112
+ input: {
113
+ type: "string",
114
+ description: "The input string to convert"
115
+ },
116
+ from: {
117
+ type: "string",
118
+ enum: ["json", "json5", "jsonc", "yaml", "toml"],
119
+ description: "Source format"
120
+ },
121
+ to: {
122
+ type: "string",
123
+ enum: ["json", "json5", "jsonc", "yaml", "toml"],
124
+ description: "Target format"
125
+ }
126
+ },
127
+ required: ["input", "from", "to"]
128
+ },
129
+ handler: async (args) => {
130
+ const result = agentToolsCore.json.convert(args.input, {
131
+ from: args.from,
132
+ to: args.to
133
+ });
134
+ return { content: [{ type: "text", text: result }] };
135
+ }
136
+ },
137
+ {
138
+ name: "agent_tools_json_diff",
139
+ description: "Compare two JSON documents and return the differences as JSON Patch operations.",
140
+ inputSchema: {
141
+ type: "object",
142
+ properties: {
143
+ a: {
144
+ type: "string",
145
+ description: "First JSON document"
146
+ },
147
+ b: {
148
+ type: "string",
149
+ description: "Second JSON document"
150
+ }
151
+ },
152
+ required: ["a", "b"]
153
+ },
154
+ handler: async (args) => {
155
+ const result = agentToolsCore.json.diff(args.a, args.b);
156
+ return {
157
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
158
+ };
159
+ }
160
+ },
161
+ {
162
+ name: "agent_tools_json_minify",
163
+ description: "Minify JSON by removing all whitespace.",
164
+ inputSchema: {
165
+ type: "object",
166
+ properties: {
167
+ input: {
168
+ type: "string",
169
+ description: "The JSON string to minify"
170
+ }
171
+ },
172
+ required: ["input"]
173
+ },
174
+ handler: async (args) => {
175
+ const result = agentToolsCore.json.minify(args.input);
176
+ return { content: [{ type: "text", text: result }] };
177
+ }
178
+ },
179
+ {
180
+ name: "agent_tools_json_stats",
181
+ description: "Get statistics about a JSON document (key count, depth, types, size).",
182
+ inputSchema: {
183
+ type: "object",
184
+ properties: {
185
+ input: {
186
+ type: "string",
187
+ description: "The JSON string to analyze"
188
+ }
189
+ },
190
+ required: ["input"]
191
+ },
192
+ handler: async (args) => {
193
+ const result = agentToolsCore.json.getStats(args.input);
194
+ return {
195
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
196
+ };
197
+ }
198
+ },
199
+ {
200
+ name: "agent_tools_json_schema_validate",
201
+ description: "Validate JSON against a schema with detailed error analysis, coverage stats, and actionable fix suggestions. Returns a comprehensive summary suitable for LLM consumption.",
202
+ inputSchema: {
203
+ type: "object",
204
+ properties: {
205
+ input: {
206
+ type: "string",
207
+ description: "The JSON string to validate"
208
+ },
209
+ schema: {
210
+ type: "string",
211
+ description: "The JSON Schema to validate against"
212
+ }
213
+ },
214
+ required: ["input", "schema"]
215
+ },
216
+ handler: async (args) => {
217
+ const result = agentToolsCore.json.validateWithSummary(args.input, args.schema);
218
+ return {
219
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
220
+ };
221
+ }
222
+ }
223
+ ];
224
+ var csvTools = [
225
+ {
226
+ name: "agent_tools_csv_parse",
227
+ description: "Parse CSV data into structured JSON. Auto-detects delimiter if not specified.",
228
+ inputSchema: {
229
+ type: "object",
230
+ properties: {
231
+ input: {
232
+ type: "string",
233
+ description: "The CSV string to parse"
234
+ },
235
+ delimiter: {
236
+ type: "string",
237
+ description: "Field delimiter (auto-detected if not specified)"
238
+ },
239
+ header: {
240
+ type: "boolean",
241
+ description: "First row contains headers (default: true)"
242
+ },
243
+ skipRows: {
244
+ type: "number",
245
+ description: "Number of rows to skip at the beginning"
246
+ }
247
+ },
248
+ required: ["input"]
249
+ },
250
+ handler: async (args) => {
251
+ const result = agentToolsCore.csv.parse(args.input, {
252
+ delimiter: args.delimiter,
253
+ header: args.header ?? true,
254
+ skipRows: args.skipRows
255
+ });
256
+ return {
257
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
258
+ };
259
+ }
260
+ },
261
+ {
262
+ name: "agent_tools_csv_to_json",
263
+ description: "Convert CSV to JSON array.",
264
+ inputSchema: {
265
+ type: "object",
266
+ properties: {
267
+ input: {
268
+ type: "string",
269
+ description: "The CSV string to convert"
270
+ },
271
+ pretty: {
272
+ type: "boolean",
273
+ description: "Pretty-print output (default: true)"
274
+ }
275
+ },
276
+ required: ["input"]
277
+ },
278
+ handler: async (args) => {
279
+ const result = agentToolsCore.csv.toJson(args.input, args.pretty ?? true);
280
+ return { content: [{ type: "text", text: result }] };
281
+ }
282
+ },
283
+ {
284
+ name: "agent_tools_csv_filter",
285
+ description: "Filter CSV rows based on column conditions.",
286
+ inputSchema: {
287
+ type: "object",
288
+ properties: {
289
+ input: {
290
+ type: "string",
291
+ description: "The CSV string to filter"
292
+ },
293
+ filters: {
294
+ type: "array",
295
+ items: {
296
+ type: "object",
297
+ properties: {
298
+ column: { type: "string" },
299
+ operator: {
300
+ type: "string",
301
+ enum: [
302
+ "eq",
303
+ "neq",
304
+ "gt",
305
+ "gte",
306
+ "lt",
307
+ "lte",
308
+ "contains",
309
+ "startsWith",
310
+ "endsWith",
311
+ "matches",
312
+ "isNull",
313
+ "isNotNull"
314
+ ]
315
+ },
316
+ value: {}
317
+ },
318
+ required: ["column", "operator"]
319
+ },
320
+ description: "Array of filter conditions"
321
+ }
322
+ },
323
+ required: ["input", "filters"]
324
+ },
325
+ handler: async (args) => {
326
+ const result = agentToolsCore.csv.filter(args.input, args.filters);
327
+ return { content: [{ type: "text", text: result }] };
328
+ }
329
+ },
330
+ {
331
+ name: "agent_tools_csv_stats",
332
+ description: "Get column statistics for CSV data (types, counts, min/max, top values).",
333
+ inputSchema: {
334
+ type: "object",
335
+ properties: {
336
+ input: {
337
+ type: "string",
338
+ description: "The CSV string to analyze"
339
+ }
340
+ },
341
+ required: ["input"]
342
+ },
343
+ handler: async (args) => {
344
+ const result = agentToolsCore.csv.getStats(args.input);
345
+ return {
346
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
347
+ };
348
+ }
349
+ },
350
+ {
351
+ name: "agent_tools_csv_transform",
352
+ description: "Transform CSV by selecting, renaming, or excluding columns.",
353
+ inputSchema: {
354
+ type: "object",
355
+ properties: {
356
+ input: {
357
+ type: "string",
358
+ description: "The CSV string to transform"
359
+ },
360
+ select: {
361
+ type: "array",
362
+ items: { type: "string" },
363
+ description: "Columns to include"
364
+ },
365
+ exclude: {
366
+ type: "array",
367
+ items: { type: "string" },
368
+ description: "Columns to exclude"
369
+ },
370
+ rename: {
371
+ type: "object",
372
+ additionalProperties: { type: "string" },
373
+ description: "Column rename mapping (oldName: newName)"
374
+ }
375
+ },
376
+ required: ["input"]
377
+ },
378
+ handler: async (args) => {
379
+ const result = agentToolsCore.csv.transform(args.input, {
380
+ select: args.select,
381
+ exclude: args.exclude,
382
+ rename: args.rename
383
+ });
384
+ return { content: [{ type: "text", text: result }] };
385
+ }
386
+ },
387
+ {
388
+ name: "agent_tools_csv_export",
389
+ description: "Export CSV to different formats (csv, tsv, json, jsonl).",
390
+ inputSchema: {
391
+ type: "object",
392
+ properties: {
393
+ input: {
394
+ type: "string",
395
+ description: "The CSV string to export"
396
+ },
397
+ format: {
398
+ type: "string",
399
+ enum: ["csv", "tsv", "json", "jsonl"],
400
+ description: "Target format"
401
+ },
402
+ headers: {
403
+ type: "boolean",
404
+ description: "Include headers in output (default: true)"
405
+ }
406
+ },
407
+ required: ["input", "format"]
408
+ },
409
+ handler: async (args) => {
410
+ const result = agentToolsCore.csv.exportData(args.input, {
411
+ format: args.format,
412
+ headers: args.headers ?? true
413
+ });
414
+ return { content: [{ type: "text", text: result }] };
415
+ }
416
+ }
417
+ ];
418
+ var pdfTools = [
419
+ {
420
+ name: "agent_tools_pdf_merge",
421
+ description: "Merge multiple PDF files into one. Files should be base64 encoded.",
422
+ inputSchema: {
423
+ type: "object",
424
+ properties: {
425
+ files: {
426
+ type: "array",
427
+ items: { type: "string" },
428
+ description: "Array of base64-encoded PDF files"
429
+ },
430
+ pageRanges: {
431
+ type: "array",
432
+ items: { type: "string" },
433
+ description: 'Optional page ranges for each file (e.g., ["1-3", "all", "5,7-10"])'
434
+ }
435
+ },
436
+ required: ["files"]
437
+ },
438
+ handler: async (args) => {
439
+ const buffers = args.files.map((f) => Buffer.from(f, "base64"));
440
+ const result = await agentToolsCore.pdf.merge(buffers, { pageRanges: args.pageRanges });
441
+ return {
442
+ content: [
443
+ {
444
+ type: "text",
445
+ text: Buffer.from(result).toString("base64")
446
+ }
447
+ ]
448
+ };
449
+ }
450
+ },
451
+ {
452
+ name: "agent_tools_pdf_split",
453
+ description: "Split a PDF into multiple documents based on page ranges. Returns array of base64 PDFs.",
454
+ inputSchema: {
455
+ type: "object",
456
+ properties: {
457
+ file: {
458
+ type: "string",
459
+ description: "Base64-encoded PDF file"
460
+ },
461
+ ranges: {
462
+ type: "string",
463
+ description: 'Comma-separated page ranges (e.g., "1-3,4-6,7-10")'
464
+ }
465
+ },
466
+ required: ["file", "ranges"]
467
+ },
468
+ handler: async (args) => {
469
+ const buffer = Buffer.from(args.file, "base64");
470
+ const results = await agentToolsCore.pdf.split(buffer, { ranges: args.ranges });
471
+ const base64Results = results.map((r) => Buffer.from(r).toString("base64"));
472
+ return {
473
+ content: [
474
+ {
475
+ type: "text",
476
+ text: JSON.stringify(base64Results)
477
+ }
478
+ ]
479
+ };
480
+ }
481
+ },
482
+ {
483
+ name: "agent_tools_pdf_extract_pages",
484
+ description: "Extract specific pages from a PDF. Returns base64-encoded PDF.",
485
+ inputSchema: {
486
+ type: "object",
487
+ properties: {
488
+ file: {
489
+ type: "string",
490
+ description: "Base64-encoded PDF file"
491
+ },
492
+ pageRange: {
493
+ type: "string",
494
+ description: 'Pages to extract (e.g., "1,3,5-10")'
495
+ }
496
+ },
497
+ required: ["file", "pageRange"]
498
+ },
499
+ handler: async (args) => {
500
+ const buffer = Buffer.from(args.file, "base64");
501
+ const result = await agentToolsCore.pdf.extractPages(buffer, args.pageRange);
502
+ return {
503
+ content: [
504
+ {
505
+ type: "text",
506
+ text: Buffer.from(result).toString("base64")
507
+ }
508
+ ]
509
+ };
510
+ }
511
+ },
512
+ {
513
+ name: "agent_tools_pdf_extract_text",
514
+ description: "Extract text content from a PDF.",
515
+ inputSchema: {
516
+ type: "object",
517
+ properties: {
518
+ file: {
519
+ type: "string",
520
+ description: "Base64-encoded PDF file"
521
+ },
522
+ pages: {
523
+ type: "array",
524
+ items: { type: "number" },
525
+ description: "Optional specific pages to extract text from"
526
+ }
527
+ },
528
+ required: ["file"]
529
+ },
530
+ handler: async (args) => {
531
+ const buffer = Buffer.from(args.file, "base64");
532
+ const result = await agentToolsCore.pdf.extractText(buffer, { pages: args.pages });
533
+ return { content: [{ type: "text", text: result }] };
534
+ }
535
+ },
536
+ {
537
+ name: "agent_tools_pdf_metadata",
538
+ description: "Get metadata from a PDF (title, author, page count, etc.).",
539
+ inputSchema: {
540
+ type: "object",
541
+ properties: {
542
+ file: {
543
+ type: "string",
544
+ description: "Base64-encoded PDF file"
545
+ }
546
+ },
547
+ required: ["file"]
548
+ },
549
+ handler: async (args) => {
550
+ const buffer = Buffer.from(args.file, "base64");
551
+ const result = await agentToolsCore.pdf.getInfo(buffer);
552
+ return {
553
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
554
+ };
555
+ }
556
+ },
557
+ {
558
+ name: "agent_tools_pdf_set_metadata",
559
+ description: "Set metadata on a PDF. Returns modified base64-encoded PDF.",
560
+ inputSchema: {
561
+ type: "object",
562
+ properties: {
563
+ file: {
564
+ type: "string",
565
+ description: "Base64-encoded PDF file"
566
+ },
567
+ metadata: {
568
+ type: "object",
569
+ properties: {
570
+ title: { type: "string" },
571
+ author: { type: "string" },
572
+ subject: { type: "string" },
573
+ keywords: { type: "array", items: { type: "string" } }
574
+ },
575
+ description: "Metadata to set"
576
+ }
577
+ },
578
+ required: ["file", "metadata"]
579
+ },
580
+ handler: async (args) => {
581
+ const buffer = Buffer.from(args.file, "base64");
582
+ const result = await agentToolsCore.pdf.setMetadata(buffer, args.metadata);
583
+ return {
584
+ content: [
585
+ {
586
+ type: "text",
587
+ text: Buffer.from(result).toString("base64")
588
+ }
589
+ ]
590
+ };
591
+ }
592
+ },
593
+ {
594
+ name: "agent_tools_pdf_rotate",
595
+ description: "Rotate pages in a PDF. Returns base64-encoded PDF.",
596
+ inputSchema: {
597
+ type: "object",
598
+ properties: {
599
+ file: {
600
+ type: "string",
601
+ description: "Base64-encoded PDF file"
602
+ },
603
+ degrees: {
604
+ type: "number",
605
+ enum: [90, 180, 270],
606
+ description: "Rotation angle"
607
+ },
608
+ pages: {
609
+ type: "array",
610
+ items: { type: "number" },
611
+ description: "Pages to rotate (all pages if not specified)"
612
+ }
613
+ },
614
+ required: ["file", "degrees"]
615
+ },
616
+ handler: async (args) => {
617
+ const buffer = Buffer.from(args.file, "base64");
618
+ const result = await agentToolsCore.pdf.rotate(buffer, {
619
+ degrees: args.degrees,
620
+ pages: args.pages
621
+ });
622
+ return {
623
+ content: [
624
+ {
625
+ type: "text",
626
+ text: Buffer.from(result).toString("base64")
627
+ }
628
+ ]
629
+ };
630
+ }
631
+ },
632
+ {
633
+ name: "agent_tools_pdf_compress",
634
+ description: "Compress a PDF to reduce file size. Returns base64-encoded PDF.",
635
+ inputSchema: {
636
+ type: "object",
637
+ properties: {
638
+ file: {
639
+ type: "string",
640
+ description: "Base64-encoded PDF file"
641
+ },
642
+ quality: {
643
+ type: "string",
644
+ enum: ["low", "medium", "high"],
645
+ description: "Compression quality (default: medium)"
646
+ }
647
+ },
648
+ required: ["file"]
649
+ },
650
+ handler: async (args) => {
651
+ const buffer = Buffer.from(args.file, "base64");
652
+ const result = await agentToolsCore.pdf.compress(buffer, {
653
+ quality: args.quality || "medium"
654
+ });
655
+ return {
656
+ content: [
657
+ {
658
+ type: "text",
659
+ text: Buffer.from(result).toString("base64")
660
+ }
661
+ ]
662
+ };
663
+ }
664
+ },
665
+ {
666
+ name: "agent_tools_pdf_page_count",
667
+ description: "Get the number of pages in a PDF.",
668
+ inputSchema: {
669
+ type: "object",
670
+ properties: {
671
+ file: {
672
+ type: "string",
673
+ description: "Base64-encoded PDF file"
674
+ }
675
+ },
676
+ required: ["file"]
677
+ },
678
+ handler: async (args) => {
679
+ const buffer = Buffer.from(args.file, "base64");
680
+ const count = await agentToolsCore.pdf.getPageCount(buffer);
681
+ return {
682
+ content: [{ type: "text", text: String(count) }]
683
+ };
684
+ }
685
+ },
686
+ {
687
+ name: "agent_tools_pdf_to_template",
688
+ description: "Extract a reusable JSON template from a PDF, detecting {{placeholder}} fields. Returns template JSON.",
689
+ inputSchema: {
690
+ type: "object",
691
+ properties: {
692
+ file: {
693
+ type: "string",
694
+ description: "Base64-encoded PDF file"
695
+ },
696
+ name: {
697
+ type: "string",
698
+ description: "Optional template name"
699
+ },
700
+ description: {
701
+ type: "string",
702
+ description: "Optional template description"
703
+ }
704
+ },
705
+ required: ["file"]
706
+ },
707
+ handler: async (args) => {
708
+ const buffer = Buffer.from(args.file, "base64");
709
+ const template = await agentToolsCore.pdf.pdfToTemplate(buffer, {
710
+ name: args.name,
711
+ description: args.description
712
+ });
713
+ return {
714
+ content: [
715
+ {
716
+ type: "text",
717
+ text: JSON.stringify(template, null, 2)
718
+ }
719
+ ]
720
+ };
721
+ }
722
+ },
723
+ {
724
+ name: "agent_tools_pdf_from_template",
725
+ description: "Generate a PDF from a template JSON and data JSON, replacing placeholders with values. Returns base64-encoded PDF.",
726
+ inputSchema: {
727
+ type: "object",
728
+ properties: {
729
+ template: {
730
+ type: "object",
731
+ description: "PDF template JSON object"
732
+ },
733
+ data: {
734
+ type: "object",
735
+ description: "Key-value pairs for placeholder replacement"
736
+ },
737
+ missingFieldBehavior: {
738
+ type: "string",
739
+ enum: ["leave_placeholder", "use_default", "empty_string"],
740
+ description: "How to handle missing fields (default: leave_placeholder)"
741
+ }
742
+ },
743
+ required: ["template"]
744
+ },
745
+ handler: async (args) => {
746
+ const result = await agentToolsCore.pdf.templateToPdf(args.template, args.data ?? {}, {
747
+ missingFieldBehavior: args.missingFieldBehavior
748
+ });
749
+ return {
750
+ content: [
751
+ {
752
+ type: "text",
753
+ text: Buffer.from(result).toString("base64")
754
+ }
755
+ ]
756
+ };
757
+ }
758
+ },
759
+ {
760
+ name: "agent_tools_pdf_read_form",
761
+ description: "Read AcroForm fields from a fillable PDF. Returns field names, types, current values, and options.",
762
+ inputSchema: {
763
+ type: "object",
764
+ properties: {
765
+ file: {
766
+ type: "string",
767
+ description: "Base64-encoded PDF file"
768
+ }
769
+ },
770
+ required: ["file"]
771
+ },
772
+ handler: async (args) => {
773
+ const buffer = Buffer.from(args.file, "base64");
774
+ const result = await agentToolsCore.pdf.readFormFields(buffer);
775
+ return {
776
+ content: [
777
+ { type: "text", text: JSON.stringify(result, null, 2) }
778
+ ]
779
+ };
780
+ }
781
+ },
782
+ {
783
+ name: "agent_tools_pdf_fill_form",
784
+ description: "Fill AcroForm fields in a fillable PDF with provided data. Returns base64-encoded filled PDF.",
785
+ inputSchema: {
786
+ type: "object",
787
+ properties: {
788
+ file: {
789
+ type: "string",
790
+ description: "Base64-encoded PDF file"
791
+ },
792
+ data: {
793
+ type: "object",
794
+ description: "Key-value pairs mapping field names to values (string for text/radio/dropdown, boolean for checkbox)"
795
+ },
796
+ flatten: {
797
+ type: "boolean",
798
+ description: "If true, flatten the form fields making them non-editable (default: false)"
799
+ }
800
+ },
801
+ required: ["file", "data"]
802
+ },
803
+ handler: async (args) => {
804
+ const buffer = Buffer.from(args.file, "base64");
805
+ const result = await agentToolsCore.pdf.fillFormFields(buffer, args.data, {
806
+ flatten: args.flatten
807
+ });
808
+ return {
809
+ content: [
810
+ {
811
+ type: "text",
812
+ text: Buffer.from(result).toString("base64")
813
+ }
814
+ ]
815
+ };
816
+ }
817
+ }
818
+ ];
819
+ var xmlTools = [
820
+ {
821
+ name: "agent_tools_xml_parse",
822
+ description: "Parse XML string into a JSON object representation. Supports attributes, nested elements, and text nodes.",
823
+ inputSchema: {
824
+ type: "object",
825
+ properties: {
826
+ input: { type: "string", description: "XML string to parse" },
827
+ ignoreAttributes: {
828
+ type: "boolean",
829
+ description: "Whether to ignore XML attributes (default: false)"
830
+ },
831
+ trimValues: {
832
+ type: "boolean",
833
+ description: "Whether to trim text values (default: true)"
834
+ }
835
+ },
836
+ required: ["input"]
837
+ },
838
+ handler: async (args) => {
839
+ const result = agentToolsCore.xml.parse(args.input, {
840
+ ignoreAttributes: args.ignoreAttributes,
841
+ trimValues: args.trimValues
842
+ });
843
+ return {
844
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
845
+ };
846
+ }
847
+ },
848
+ {
849
+ name: "agent_tools_xml_format",
850
+ description: "Pretty-print XML with configurable indentation. Reformats XML to be human-readable.",
851
+ inputSchema: {
852
+ type: "object",
853
+ properties: {
854
+ input: { type: "string", description: "XML string to format" },
855
+ indent: {
856
+ type: "number",
857
+ description: "Number of spaces for indentation (default: 2)"
858
+ }
859
+ },
860
+ required: ["input"]
861
+ },
862
+ handler: async (args) => {
863
+ const result = agentToolsCore.xml.format(args.input, {
864
+ indent: args.indent || 2
865
+ });
866
+ return { content: [{ type: "text", text: result }] };
867
+ }
868
+ },
869
+ {
870
+ name: "agent_tools_xml_minify",
871
+ description: "Minify XML by removing unnecessary whitespace and formatting.",
872
+ inputSchema: {
873
+ type: "object",
874
+ properties: {
875
+ input: { type: "string", description: "XML string to minify" }
876
+ },
877
+ required: ["input"]
878
+ },
879
+ handler: async (args) => {
880
+ const result = agentToolsCore.xml.minify(args.input);
881
+ return { content: [{ type: "text", text: result }] };
882
+ }
883
+ },
884
+ {
885
+ name: "agent_tools_xml_validate",
886
+ description: "Validate XML syntax. Returns whether the XML is well-formed with error details if invalid.",
887
+ inputSchema: {
888
+ type: "object",
889
+ properties: {
890
+ input: { type: "string", description: "XML string to validate" }
891
+ },
892
+ required: ["input"]
893
+ },
894
+ handler: async (args) => {
895
+ const result = agentToolsCore.xml.validate(args.input);
896
+ return {
897
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
898
+ };
899
+ }
900
+ },
901
+ {
902
+ name: "agent_tools_xml_query",
903
+ description: 'Query XML using a simplified path expression (e.g., "root/items/item"). Returns matching nodes.',
904
+ inputSchema: {
905
+ type: "object",
906
+ properties: {
907
+ input: { type: "string", description: "XML string to query" },
908
+ path: {
909
+ type: "string",
910
+ description: 'Path expression (e.g., "catalog/book/title")'
911
+ }
912
+ },
913
+ required: ["input", "path"]
914
+ },
915
+ handler: async (args) => {
916
+ const result = agentToolsCore.xml.query(args.input, args.path);
917
+ return {
918
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
919
+ };
920
+ }
921
+ },
922
+ {
923
+ name: "agent_tools_xml_convert",
924
+ description: "Convert between XML and JSON formats.",
925
+ inputSchema: {
926
+ type: "object",
927
+ properties: {
928
+ input: { type: "string", description: "Input string to convert" },
929
+ from: {
930
+ type: "string",
931
+ enum: ["xml", "json"],
932
+ description: "Source format"
933
+ },
934
+ to: {
935
+ type: "string",
936
+ enum: ["xml", "json"],
937
+ description: "Target format"
938
+ }
939
+ },
940
+ required: ["input", "from", "to"]
941
+ },
942
+ handler: async (args) => {
943
+ const result = agentToolsCore.xml.convert(
944
+ args.input,
945
+ args.from,
946
+ args.to
947
+ );
948
+ return { content: [{ type: "text", text: result }] };
949
+ }
950
+ },
951
+ {
952
+ name: "agent_tools_xml_stats",
953
+ description: "Get statistics about an XML document: element count, attribute count, text nodes, depth, and size.",
954
+ inputSchema: {
955
+ type: "object",
956
+ properties: {
957
+ input: { type: "string", description: "XML string to analyze" }
958
+ },
959
+ required: ["input"]
960
+ },
961
+ handler: async (args) => {
962
+ const result = agentToolsCore.xml.getStats(args.input);
963
+ return {
964
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
965
+ };
966
+ }
967
+ }
968
+ ];
969
+ var excelTools = [
970
+ {
971
+ name: "agent_tools_excel_parse",
972
+ description: "Parse an Excel file (XLSX) into JSON. Returns sheet info, headers, row data, and row count. Input file must be base64-encoded.",
973
+ inputSchema: {
974
+ type: "object",
975
+ properties: {
976
+ file: {
977
+ type: "string",
978
+ description: "Base64-encoded Excel file"
979
+ },
980
+ sheet: {
981
+ type: "string",
982
+ description: "Sheet name or index to parse (default: first sheet)"
983
+ },
984
+ header: {
985
+ type: "boolean",
986
+ description: "Whether first row is headers (default: true)"
987
+ }
988
+ },
989
+ required: ["file"]
990
+ },
991
+ handler: async (args) => {
992
+ const buffer = Buffer.from(args.file, "base64");
993
+ const sheetArg = args.sheet;
994
+ const sheet = sheetArg !== void 0 && !isNaN(Number(sheetArg)) ? Number(sheetArg) : sheetArg;
995
+ const result = await agentToolsCore.excel.parse(buffer, {
996
+ sheet,
997
+ header: args.header
998
+ });
999
+ return {
1000
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
1001
+ };
1002
+ }
1003
+ },
1004
+ {
1005
+ name: "agent_tools_excel_convert",
1006
+ description: "Convert an Excel file to JSON, CSV, or TSV format. Input file must be base64-encoded.",
1007
+ inputSchema: {
1008
+ type: "object",
1009
+ properties: {
1010
+ file: {
1011
+ type: "string",
1012
+ description: "Base64-encoded Excel file"
1013
+ },
1014
+ format: {
1015
+ type: "string",
1016
+ enum: ["json", "csv", "tsv"],
1017
+ description: "Target format"
1018
+ },
1019
+ sheet: {
1020
+ type: "string",
1021
+ description: "Sheet name or index (default: first sheet)"
1022
+ },
1023
+ header: {
1024
+ type: "boolean",
1025
+ description: "Whether first row is headers (default: true)"
1026
+ }
1027
+ },
1028
+ required: ["file", "format"]
1029
+ },
1030
+ handler: async (args) => {
1031
+ const buffer = Buffer.from(args.file, "base64");
1032
+ const result = await agentToolsCore.excel.convert(buffer, args.format, {
1033
+ sheet: args.sheet,
1034
+ header: args.header
1035
+ });
1036
+ return { content: [{ type: "text", text: result }] };
1037
+ }
1038
+ },
1039
+ {
1040
+ name: "agent_tools_excel_stats",
1041
+ description: "Get statistics about an Excel file: sheet count, total rows, columns, and sheet details. Input file must be base64-encoded.",
1042
+ inputSchema: {
1043
+ type: "object",
1044
+ properties: {
1045
+ file: {
1046
+ type: "string",
1047
+ description: "Base64-encoded Excel file"
1048
+ }
1049
+ },
1050
+ required: ["file"]
1051
+ },
1052
+ handler: async (args) => {
1053
+ const buffer = Buffer.from(args.file, "base64");
1054
+ const result = await agentToolsCore.excel.getStats(buffer);
1055
+ return {
1056
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
1057
+ };
1058
+ }
1059
+ },
1060
+ {
1061
+ name: "agent_tools_excel_sheets",
1062
+ description: "List all sheets in an Excel file with their names, row counts, and column counts. Input file must be base64-encoded.",
1063
+ inputSchema: {
1064
+ type: "object",
1065
+ properties: {
1066
+ file: {
1067
+ type: "string",
1068
+ description: "Base64-encoded Excel file"
1069
+ }
1070
+ },
1071
+ required: ["file"]
1072
+ },
1073
+ handler: async (args) => {
1074
+ const buffer = Buffer.from(args.file, "base64");
1075
+ const result = await agentToolsCore.excel.getSheets(buffer);
1076
+ return {
1077
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
1078
+ };
1079
+ }
1080
+ },
1081
+ {
1082
+ name: "agent_tools_excel_create",
1083
+ description: "Create an Excel file from JSON data. Returns the file as base64-encoded XLSX.",
1084
+ inputSchema: {
1085
+ type: "object",
1086
+ properties: {
1087
+ data: {
1088
+ type: "string",
1089
+ description: "JSON string of an array of objects to convert to Excel"
1090
+ },
1091
+ sheetName: {
1092
+ type: "string",
1093
+ description: "Name for the worksheet (default: Sheet1)"
1094
+ }
1095
+ },
1096
+ required: ["data"]
1097
+ },
1098
+ handler: async (args) => {
1099
+ const data = JSON.parse(args.data);
1100
+ const result = await agentToolsCore.excel.createExcel(data, args.sheetName);
1101
+ return {
1102
+ content: [
1103
+ {
1104
+ type: "text",
1105
+ text: Buffer.from(result).toString("base64")
1106
+ }
1107
+ ]
1108
+ };
1109
+ }
1110
+ }
1111
+ ];
1112
+ var imageTools = [
1113
+ {
1114
+ name: "agent_tools_image_resize",
1115
+ description: "Resize an image to specified dimensions. Supports fit modes: cover, contain, fill, inside, outside. Input must be base64-encoded.",
1116
+ inputSchema: {
1117
+ type: "object",
1118
+ properties: {
1119
+ file: { type: "string", description: "Base64-encoded image file" },
1120
+ width: { type: "number", description: "Target width in pixels" },
1121
+ height: { type: "number", description: "Target height in pixels" },
1122
+ fit: {
1123
+ type: "string",
1124
+ enum: ["cover", "contain", "fill", "inside", "outside"],
1125
+ description: "How to fit the image (default: inside)"
1126
+ }
1127
+ },
1128
+ required: ["file"]
1129
+ },
1130
+ handler: async (args) => {
1131
+ const buffer = Buffer.from(args.file, "base64");
1132
+ const result = await agentToolsCore.image.resize(buffer, {
1133
+ width: args.width,
1134
+ height: args.height,
1135
+ fit: args.fit
1136
+ });
1137
+ return {
1138
+ content: [{ type: "text", text: Buffer.from(result).toString("base64") }]
1139
+ };
1140
+ }
1141
+ },
1142
+ {
1143
+ name: "agent_tools_image_crop",
1144
+ description: "Crop an image to a specified rectangle. Input must be base64-encoded.",
1145
+ inputSchema: {
1146
+ type: "object",
1147
+ properties: {
1148
+ file: { type: "string", description: "Base64-encoded image file" },
1149
+ left: { type: "number", description: "Left offset in pixels" },
1150
+ top: { type: "number", description: "Top offset in pixels" },
1151
+ width: { type: "number", description: "Crop width in pixels" },
1152
+ height: { type: "number", description: "Crop height in pixels" }
1153
+ },
1154
+ required: ["file", "left", "top", "width", "height"]
1155
+ },
1156
+ handler: async (args) => {
1157
+ const buffer = Buffer.from(args.file, "base64");
1158
+ const result = await agentToolsCore.image.crop(buffer, {
1159
+ left: args.left,
1160
+ top: args.top,
1161
+ width: args.width,
1162
+ height: args.height
1163
+ });
1164
+ return {
1165
+ content: [{ type: "text", text: Buffer.from(result).toString("base64") }]
1166
+ };
1167
+ }
1168
+ },
1169
+ {
1170
+ name: "agent_tools_image_convert",
1171
+ description: "Convert an image to a different format: png, jpeg, webp, gif, tiff, avif. Input must be base64-encoded.",
1172
+ inputSchema: {
1173
+ type: "object",
1174
+ properties: {
1175
+ file: { type: "string", description: "Base64-encoded image file" },
1176
+ format: {
1177
+ type: "string",
1178
+ enum: ["png", "jpeg", "webp", "gif", "tiff", "avif"],
1179
+ description: "Target image format"
1180
+ },
1181
+ quality: {
1182
+ type: "number",
1183
+ description: "Quality for lossy formats 1-100 (default: 80)"
1184
+ }
1185
+ },
1186
+ required: ["file", "format"]
1187
+ },
1188
+ handler: async (args) => {
1189
+ const buffer = Buffer.from(args.file, "base64");
1190
+ const result = await agentToolsCore.image.convert(buffer, {
1191
+ format: args.format,
1192
+ quality: args.quality
1193
+ });
1194
+ return {
1195
+ content: [{ type: "text", text: Buffer.from(result).toString("base64") }]
1196
+ };
1197
+ }
1198
+ },
1199
+ {
1200
+ name: "agent_tools_image_compress",
1201
+ description: "Compress an image to reduce file size. Input must be base64-encoded.",
1202
+ inputSchema: {
1203
+ type: "object",
1204
+ properties: {
1205
+ file: { type: "string", description: "Base64-encoded image file" },
1206
+ quality: {
1207
+ type: "number",
1208
+ description: "Compression quality 1-100 (default: 70)"
1209
+ },
1210
+ format: {
1211
+ type: "string",
1212
+ enum: ["png", "jpeg", "webp", "gif", "tiff", "avif"],
1213
+ description: "Output format (default: jpeg)"
1214
+ }
1215
+ },
1216
+ required: ["file"]
1217
+ },
1218
+ handler: async (args) => {
1219
+ const buffer = Buffer.from(args.file, "base64");
1220
+ const result = await agentToolsCore.image.compress(buffer, {
1221
+ quality: args.quality,
1222
+ format: args.format
1223
+ });
1224
+ return {
1225
+ content: [{ type: "text", text: Buffer.from(result).toString("base64") }]
1226
+ };
1227
+ }
1228
+ },
1229
+ {
1230
+ name: "agent_tools_image_rotate",
1231
+ description: "Rotate an image by a specified number of degrees. Input must be base64-encoded.",
1232
+ inputSchema: {
1233
+ type: "object",
1234
+ properties: {
1235
+ file: { type: "string", description: "Base64-encoded image file" },
1236
+ degrees: { type: "number", description: "Rotation angle in degrees" }
1237
+ },
1238
+ required: ["file", "degrees"]
1239
+ },
1240
+ handler: async (args) => {
1241
+ const buffer = Buffer.from(args.file, "base64");
1242
+ const result = await agentToolsCore.image.rotate(buffer, {
1243
+ degrees: args.degrees
1244
+ });
1245
+ return {
1246
+ content: [{ type: "text", text: Buffer.from(result).toString("base64") }]
1247
+ };
1248
+ }
1249
+ },
1250
+ {
1251
+ name: "agent_tools_image_metadata",
1252
+ description: "Get metadata from an image: dimensions, format, channels, color space, DPI, alpha channel. Input must be base64-encoded.",
1253
+ inputSchema: {
1254
+ type: "object",
1255
+ properties: {
1256
+ file: { type: "string", description: "Base64-encoded image file" }
1257
+ },
1258
+ required: ["file"]
1259
+ },
1260
+ handler: async (args) => {
1261
+ const buffer = Buffer.from(args.file, "base64");
1262
+ const result = await agentToolsCore.image.getMetadata(buffer);
1263
+ return {
1264
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
1265
+ };
1266
+ }
1267
+ },
1268
+ {
1269
+ name: "agent_tools_image_grayscale",
1270
+ description: "Convert an image to grayscale. Input must be base64-encoded.",
1271
+ inputSchema: {
1272
+ type: "object",
1273
+ properties: {
1274
+ file: { type: "string", description: "Base64-encoded image file" }
1275
+ },
1276
+ required: ["file"]
1277
+ },
1278
+ handler: async (args) => {
1279
+ const buffer = Buffer.from(args.file, "base64");
1280
+ const result = await agentToolsCore.image.grayscale(buffer);
1281
+ return {
1282
+ content: [{ type: "text", text: Buffer.from(result).toString("base64") }]
1283
+ };
1284
+ }
1285
+ }
1286
+ ];
1287
+ var markdownTools = [
1288
+ {
1289
+ name: "agent_tools_markdown_convert",
1290
+ description: "Convert between Markdown, HTML, and plain text formats. Supports GitHub Flavored Markdown.",
1291
+ inputSchema: {
1292
+ type: "object",
1293
+ properties: {
1294
+ input: { type: "string", description: "Input text to convert" },
1295
+ from: {
1296
+ type: "string",
1297
+ enum: ["markdown", "html", "text"],
1298
+ description: "Source format"
1299
+ },
1300
+ to: {
1301
+ type: "string",
1302
+ enum: ["markdown", "html", "text"],
1303
+ description: "Target format"
1304
+ },
1305
+ gfm: {
1306
+ type: "boolean",
1307
+ description: "Enable GitHub Flavored Markdown (default: true)"
1308
+ }
1309
+ },
1310
+ required: ["input", "from", "to"]
1311
+ },
1312
+ handler: async (args) => {
1313
+ const result = agentToolsCore.markdown.convert(args.input, {
1314
+ from: args.from,
1315
+ to: args.to,
1316
+ gfm: args.gfm
1317
+ });
1318
+ return { content: [{ type: "text", text: result }] };
1319
+ }
1320
+ },
1321
+ {
1322
+ name: "agent_tools_markdown_toc",
1323
+ description: "Generate a table of contents from a Markdown document. Returns structured heading entries with levels and slugs.",
1324
+ inputSchema: {
1325
+ type: "object",
1326
+ properties: {
1327
+ input: { type: "string", description: "Markdown text" },
1328
+ render: {
1329
+ type: "boolean",
1330
+ description: "Return rendered Markdown TOC instead of JSON (default: false)"
1331
+ }
1332
+ },
1333
+ required: ["input"]
1334
+ },
1335
+ handler: async (args) => {
1336
+ const entries = agentToolsCore.markdown.generateToc(args.input);
1337
+ if (args.render) {
1338
+ const rendered = agentToolsCore.markdown.renderToc(entries);
1339
+ return { content: [{ type: "text", text: rendered }] };
1340
+ }
1341
+ return {
1342
+ content: [{ type: "text", text: JSON.stringify(entries, null, 2) }]
1343
+ };
1344
+ }
1345
+ },
1346
+ {
1347
+ name: "agent_tools_markdown_links",
1348
+ description: "Extract all links from a Markdown document. Returns link text, URL, and line number for each link.",
1349
+ inputSchema: {
1350
+ type: "object",
1351
+ properties: {
1352
+ input: { type: "string", description: "Markdown text" }
1353
+ },
1354
+ required: ["input"]
1355
+ },
1356
+ handler: async (args) => {
1357
+ const result = agentToolsCore.markdown.extractLinks(args.input);
1358
+ return {
1359
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
1360
+ };
1361
+ }
1362
+ },
1363
+ {
1364
+ name: "agent_tools_markdown_frontmatter",
1365
+ description: "Extract YAML frontmatter from a Markdown document. Parses key-value pairs from the --- delimited header.",
1366
+ inputSchema: {
1367
+ type: "object",
1368
+ properties: {
1369
+ input: { type: "string", description: "Markdown text with frontmatter" }
1370
+ },
1371
+ required: ["input"]
1372
+ },
1373
+ handler: async (args) => {
1374
+ const result = agentToolsCore.markdown.extractFrontmatter(args.input);
1375
+ return {
1376
+ content: [
1377
+ {
1378
+ type: "text",
1379
+ text: result ? JSON.stringify(result, null, 2) : "No frontmatter found"
1380
+ }
1381
+ ]
1382
+ };
1383
+ }
1384
+ },
1385
+ {
1386
+ name: "agent_tools_markdown_stats",
1387
+ description: "Get statistics about a Markdown document: word count, headings, links, images, code blocks, lists, and more.",
1388
+ inputSchema: {
1389
+ type: "object",
1390
+ properties: {
1391
+ input: { type: "string", description: "Markdown text to analyze" }
1392
+ },
1393
+ required: ["input"]
1394
+ },
1395
+ handler: async (args) => {
1396
+ const result = agentToolsCore.markdown.getStats(args.input);
1397
+ return {
1398
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
1399
+ };
1400
+ }
1401
+ }
1402
+ ];
1403
+ var archiveTools = [
1404
+ {
1405
+ name: "agent_tools_archive_create",
1406
+ description: "Create a ZIP archive from a list of files. Each file needs a path and base64-encoded content. Returns the archive as base64.",
1407
+ inputSchema: {
1408
+ type: "object",
1409
+ properties: {
1410
+ files: {
1411
+ type: "array",
1412
+ description: "Array of files to add. Each item: { path: string, content: string (base64) }",
1413
+ items: {
1414
+ type: "object",
1415
+ properties: {
1416
+ path: { type: "string", description: "File path within archive" },
1417
+ content: { type: "string", description: "Base64-encoded file content" }
1418
+ },
1419
+ required: ["path", "content"]
1420
+ }
1421
+ },
1422
+ compressionLevel: {
1423
+ type: "number",
1424
+ description: "Compression level 0-9 (default: 6)"
1425
+ }
1426
+ },
1427
+ required: ["files"]
1428
+ },
1429
+ handler: async (args) => {
1430
+ const files = args.files.map((f) => ({
1431
+ path: f.path,
1432
+ content: Buffer.from(f.content, "base64")
1433
+ }));
1434
+ const result = await agentToolsCore.archive.create(files, {
1435
+ compressionLevel: args.compressionLevel
1436
+ });
1437
+ return {
1438
+ content: [{ type: "text", text: Buffer.from(result).toString("base64") }]
1439
+ };
1440
+ }
1441
+ },
1442
+ {
1443
+ name: "agent_tools_archive_extract",
1444
+ description: "Extract files from a ZIP archive. Returns extracted files with paths and base64-encoded content. Input must be base64-encoded.",
1445
+ inputSchema: {
1446
+ type: "object",
1447
+ properties: {
1448
+ file: { type: "string", description: "Base64-encoded ZIP file" },
1449
+ files: {
1450
+ type: "array",
1451
+ description: "Optional list of specific file paths to extract",
1452
+ items: { type: "string" }
1453
+ }
1454
+ },
1455
+ required: ["file"]
1456
+ },
1457
+ handler: async (args) => {
1458
+ const buffer = Buffer.from(args.file, "base64");
1459
+ const result = await agentToolsCore.archive.extract(buffer, {
1460
+ files: args.files
1461
+ });
1462
+ const output = result.map((f) => ({
1463
+ path: f.path,
1464
+ content: f.content.toString("base64"),
1465
+ size: f.content.length
1466
+ }));
1467
+ return {
1468
+ content: [{ type: "text", text: JSON.stringify(output, null, 2) }]
1469
+ };
1470
+ }
1471
+ },
1472
+ {
1473
+ name: "agent_tools_archive_list",
1474
+ description: "List contents of a ZIP archive without extracting. Returns file paths, sizes, and modification dates. Input must be base64-encoded.",
1475
+ inputSchema: {
1476
+ type: "object",
1477
+ properties: {
1478
+ file: { type: "string", description: "Base64-encoded ZIP file" }
1479
+ },
1480
+ required: ["file"]
1481
+ },
1482
+ handler: async (args) => {
1483
+ const buffer = Buffer.from(args.file, "base64");
1484
+ const result = await agentToolsCore.archive.list(buffer);
1485
+ return {
1486
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
1487
+ };
1488
+ }
1489
+ },
1490
+ {
1491
+ name: "agent_tools_archive_stats",
1492
+ description: "Get statistics about a ZIP archive: file count, directory count, total size, compressed size. Input must be base64-encoded.",
1493
+ inputSchema: {
1494
+ type: "object",
1495
+ properties: {
1496
+ file: { type: "string", description: "Base64-encoded ZIP file" }
1497
+ },
1498
+ required: ["file"]
1499
+ },
1500
+ handler: async (args) => {
1501
+ const buffer = Buffer.from(args.file, "base64");
1502
+ const result = await agentToolsCore.archive.getStats(buffer);
1503
+ return {
1504
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
1505
+ };
1506
+ }
1507
+ }
1508
+ ];
1509
+ var regexTools = [
1510
+ {
1511
+ name: "agent_tools_regex_test",
1512
+ description: "Test a regex pattern against input text. Returns all matches with positions and named groups.",
1513
+ inputSchema: {
1514
+ type: "object",
1515
+ properties: {
1516
+ input: { type: "string", description: "Text to search" },
1517
+ pattern: { type: "string", description: "Regular expression pattern" },
1518
+ flags: {
1519
+ type: "string",
1520
+ description: 'Regex flags (e.g., "gi" for global case-insensitive)'
1521
+ },
1522
+ caseInsensitive: {
1523
+ type: "boolean",
1524
+ description: "Case-insensitive matching (default: false)"
1525
+ },
1526
+ multiline: {
1527
+ type: "boolean",
1528
+ description: "Multiline mode (default: false)"
1529
+ }
1530
+ },
1531
+ required: ["input", "pattern"]
1532
+ },
1533
+ handler: async (args) => {
1534
+ const result = agentToolsCore.regex.test(args.input, args.pattern, {
1535
+ flags: args.flags,
1536
+ caseInsensitive: args.caseInsensitive,
1537
+ multiline: args.multiline
1538
+ });
1539
+ return {
1540
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
1541
+ };
1542
+ }
1543
+ },
1544
+ {
1545
+ name: "agent_tools_regex_replace",
1546
+ description: "Replace matches of a regex pattern in text. Supports backreferences ($1, $2) and named groups ($<name>).",
1547
+ inputSchema: {
1548
+ type: "object",
1549
+ properties: {
1550
+ input: { type: "string", description: "Text to process" },
1551
+ pattern: { type: "string", description: "Regular expression pattern" },
1552
+ replacement: {
1553
+ type: "string",
1554
+ description: "Replacement string (supports $1, $<name> backreferences)"
1555
+ },
1556
+ flags: { type: "string", description: "Regex flags" },
1557
+ global: {
1558
+ type: "boolean",
1559
+ description: "Replace all matches (default: true)"
1560
+ }
1561
+ },
1562
+ required: ["input", "pattern", "replacement"]
1563
+ },
1564
+ handler: async (args) => {
1565
+ const result = agentToolsCore.regex.replace(
1566
+ args.input,
1567
+ args.pattern,
1568
+ args.replacement,
1569
+ {
1570
+ flags: args.flags,
1571
+ global: args.global
1572
+ }
1573
+ );
1574
+ return {
1575
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
1576
+ };
1577
+ }
1578
+ },
1579
+ {
1580
+ name: "agent_tools_regex_extract",
1581
+ description: "Extract all matches of a regex pattern from text. Returns matched strings and named groups.",
1582
+ inputSchema: {
1583
+ type: "object",
1584
+ properties: {
1585
+ input: { type: "string", description: "Text to search" },
1586
+ pattern: { type: "string", description: "Regular expression pattern" },
1587
+ flags: { type: "string", description: "Regex flags" },
1588
+ caseInsensitive: {
1589
+ type: "boolean",
1590
+ description: "Case-insensitive matching"
1591
+ }
1592
+ },
1593
+ required: ["input", "pattern"]
1594
+ },
1595
+ handler: async (args) => {
1596
+ const result = agentToolsCore.regex.extract(args.input, args.pattern, {
1597
+ flags: args.flags,
1598
+ caseInsensitive: args.caseInsensitive
1599
+ });
1600
+ return {
1601
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
1602
+ };
1603
+ }
1604
+ },
1605
+ {
1606
+ name: "agent_tools_regex_validate",
1607
+ description: "Validate a regex pattern for syntax correctness. Returns whether the pattern is valid with error details.",
1608
+ inputSchema: {
1609
+ type: "object",
1610
+ properties: {
1611
+ pattern: { type: "string", description: "Regular expression pattern to validate" },
1612
+ flags: { type: "string", description: "Optional regex flags to validate" }
1613
+ },
1614
+ required: ["pattern"]
1615
+ },
1616
+ handler: async (args) => {
1617
+ const result = agentToolsCore.regex.validate(args.pattern, args.flags);
1618
+ return {
1619
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
1620
+ };
1621
+ }
1622
+ }
1623
+ ];
1624
+ var diffTools = [
1625
+ {
1626
+ name: "agent_tools_diff_compare",
1627
+ description: "Compare two texts and return their differences. Supports line, word, and character-level diffing.",
1628
+ inputSchema: {
1629
+ type: "object",
1630
+ properties: {
1631
+ a: { type: "string", description: "First text (original)" },
1632
+ b: { type: "string", description: "Second text (modified)" },
1633
+ type: {
1634
+ type: "string",
1635
+ enum: ["line", "word", "char"],
1636
+ description: "Diff granularity (default: line)"
1637
+ },
1638
+ ignoreWhitespace: {
1639
+ type: "boolean",
1640
+ description: "Ignore whitespace differences (default: false)"
1641
+ }
1642
+ },
1643
+ required: ["a", "b"]
1644
+ },
1645
+ handler: async (args) => {
1646
+ const result = agentToolsCore.diff.compare(args.a, args.b, {
1647
+ type: args.type,
1648
+ ignoreWhitespace: args.ignoreWhitespace
1649
+ });
1650
+ return {
1651
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
1652
+ };
1653
+ }
1654
+ },
1655
+ {
1656
+ name: "agent_tools_diff_unified",
1657
+ description: "Generate a unified diff (patch format) between two texts. Compatible with git diff output.",
1658
+ inputSchema: {
1659
+ type: "object",
1660
+ properties: {
1661
+ a: { type: "string", description: "Original text" },
1662
+ b: { type: "string", description: "Modified text" },
1663
+ fromFile: {
1664
+ type: "string",
1665
+ description: 'Original file name (default: "a")'
1666
+ },
1667
+ toFile: {
1668
+ type: "string",
1669
+ description: 'Modified file name (default: "b")'
1670
+ },
1671
+ context: {
1672
+ type: "number",
1673
+ description: "Number of context lines (default: 3)"
1674
+ }
1675
+ },
1676
+ required: ["a", "b"]
1677
+ },
1678
+ handler: async (args) => {
1679
+ const result = agentToolsCore.diff.unifiedDiff(args.a, args.b, {
1680
+ fromFile: args.fromFile,
1681
+ toFile: args.toFile,
1682
+ context: args.context
1683
+ });
1684
+ return { content: [{ type: "text", text: result }] };
1685
+ }
1686
+ },
1687
+ {
1688
+ name: "agent_tools_diff_apply",
1689
+ description: "Apply a unified diff patch to a text. Use to transform text using a previously generated patch.",
1690
+ inputSchema: {
1691
+ type: "object",
1692
+ properties: {
1693
+ input: { type: "string", description: "Original text" },
1694
+ patch: { type: "string", description: "Unified diff patch to apply" },
1695
+ fuzz: {
1696
+ type: "number",
1697
+ description: "Fuzz factor for approximate matching (default: 0)"
1698
+ }
1699
+ },
1700
+ required: ["input", "patch"]
1701
+ },
1702
+ handler: async (args) => {
1703
+ try {
1704
+ const result = agentToolsCore.diff.apply(args.input, args.patch, {
1705
+ fuzz: args.fuzz
1706
+ });
1707
+ return { content: [{ type: "text", text: result }] };
1708
+ } catch (e) {
1709
+ return {
1710
+ isError: true,
1711
+ content: [{ type: "text", text: `Error: ${e.message}` }]
1712
+ };
1713
+ }
1714
+ }
1715
+ }
1716
+ ];
1717
+ var sqlTools = [
1718
+ {
1719
+ name: "agent_tools_sql_format",
1720
+ description: "Format SQL queries with configurable dialect, indentation, and keyword casing. Supports MySQL, PostgreSQL, SQLite, TransactSQL, BigQuery.",
1721
+ inputSchema: {
1722
+ type: "object",
1723
+ properties: {
1724
+ input: { type: "string", description: "SQL query to format" },
1725
+ dialect: {
1726
+ type: "string",
1727
+ enum: ["mysql", "postgresql", "sqlite", "transactsql", "bigquery"],
1728
+ description: "SQL dialect (default: postgresql)"
1729
+ },
1730
+ indent: {
1731
+ type: "number",
1732
+ description: "Indentation spaces (default: 2)"
1733
+ },
1734
+ uppercase: {
1735
+ type: "boolean",
1736
+ description: "Uppercase SQL keywords (default: true)"
1737
+ }
1738
+ },
1739
+ required: ["input"]
1740
+ },
1741
+ handler: async (args) => {
1742
+ const result = agentToolsCore.sql.format(args.input, {
1743
+ dialect: args.dialect,
1744
+ indent: args.indent,
1745
+ uppercase: args.uppercase
1746
+ });
1747
+ return { content: [{ type: "text", text: result }] };
1748
+ }
1749
+ },
1750
+ {
1751
+ name: "agent_tools_sql_minify",
1752
+ description: "Minify SQL by removing comments and excess whitespace.",
1753
+ inputSchema: {
1754
+ type: "object",
1755
+ properties: {
1756
+ input: { type: "string", description: "SQL query to minify" }
1757
+ },
1758
+ required: ["input"]
1759
+ },
1760
+ handler: async (args) => {
1761
+ const result = agentToolsCore.sql.minify(args.input);
1762
+ return { content: [{ type: "text", text: result }] };
1763
+ }
1764
+ },
1765
+ {
1766
+ name: "agent_tools_sql_parse",
1767
+ description: "Parse a SQL query into an AST. Returns query type, referenced tables, and columns.",
1768
+ inputSchema: {
1769
+ type: "object",
1770
+ properties: {
1771
+ input: { type: "string", description: "SQL query to parse" },
1772
+ dialect: {
1773
+ type: "string",
1774
+ enum: ["mysql", "postgresql", "sqlite", "transactsql", "bigquery"],
1775
+ description: "SQL dialect (default: postgresql)"
1776
+ }
1777
+ },
1778
+ required: ["input"]
1779
+ },
1780
+ handler: async (args) => {
1781
+ const result = agentToolsCore.sql.parse(args.input, args.dialect);
1782
+ return {
1783
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
1784
+ };
1785
+ }
1786
+ },
1787
+ {
1788
+ name: "agent_tools_sql_validate",
1789
+ description: "Validate SQL syntax. Returns whether the query is syntactically correct with error details.",
1790
+ inputSchema: {
1791
+ type: "object",
1792
+ properties: {
1793
+ input: { type: "string", description: "SQL query to validate" },
1794
+ dialect: {
1795
+ type: "string",
1796
+ enum: ["mysql", "postgresql", "sqlite", "transactsql", "bigquery"],
1797
+ description: "SQL dialect (default: postgresql)"
1798
+ }
1799
+ },
1800
+ required: ["input"]
1801
+ },
1802
+ handler: async (args) => {
1803
+ const result = agentToolsCore.sql.validate(args.input, args.dialect);
1804
+ return {
1805
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
1806
+ };
1807
+ }
1808
+ },
1809
+ {
1810
+ name: "agent_tools_sql_convert",
1811
+ description: "Convert SQL between dialects (MySQL, PostgreSQL, SQLite, TransactSQL, BigQuery).",
1812
+ inputSchema: {
1813
+ type: "object",
1814
+ properties: {
1815
+ input: { type: "string", description: "SQL query to convert" },
1816
+ from: {
1817
+ type: "string",
1818
+ enum: ["mysql", "postgresql", "sqlite", "transactsql", "bigquery"],
1819
+ description: "Source dialect"
1820
+ },
1821
+ to: {
1822
+ type: "string",
1823
+ enum: ["mysql", "postgresql", "sqlite", "transactsql", "bigquery"],
1824
+ description: "Target dialect"
1825
+ }
1826
+ },
1827
+ required: ["input", "to"]
1828
+ },
1829
+ handler: async (args) => {
1830
+ const result = agentToolsCore.sql.convert(args.input, {
1831
+ from: args.from,
1832
+ to: args.to
1833
+ });
1834
+ return { content: [{ type: "text", text: result }] };
1835
+ }
1836
+ },
1837
+ {
1838
+ name: "agent_tools_sql_stats",
1839
+ description: "Analyze SQL queries. Returns query count, types, referenced tables, joins, and subqueries.",
1840
+ inputSchema: {
1841
+ type: "object",
1842
+ properties: {
1843
+ input: { type: "string", description: "SQL queries to analyze" },
1844
+ dialect: {
1845
+ type: "string",
1846
+ enum: ["mysql", "postgresql", "sqlite", "transactsql", "bigquery"],
1847
+ description: "SQL dialect (default: postgresql)"
1848
+ }
1849
+ },
1850
+ required: ["input"]
1851
+ },
1852
+ handler: async (args) => {
1853
+ const result = agentToolsCore.sql.getStats(args.input, args.dialect);
1854
+ return {
1855
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
1856
+ };
1857
+ }
1858
+ }
1859
+ ];
1860
+ var cryptoMcpTools = [
1861
+ {
1862
+ name: "agent_tools_crypto_hash",
1863
+ description: "Hash a string using MD5, SHA-1, SHA-256, SHA-384, or SHA-512. Returns the hex digest.",
1864
+ inputSchema: {
1865
+ type: "object",
1866
+ properties: {
1867
+ input: { type: "string", description: "String to hash" },
1868
+ algorithm: {
1869
+ type: "string",
1870
+ enum: ["md5", "sha1", "sha256", "sha384", "sha512"],
1871
+ description: "Hash algorithm (default: sha256)"
1872
+ }
1873
+ },
1874
+ required: ["input"]
1875
+ },
1876
+ handler: async (args) => {
1877
+ const result = agentToolsCore.crypto.hash(
1878
+ args.input,
1879
+ args.algorithm
1880
+ );
1881
+ return {
1882
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
1883
+ };
1884
+ }
1885
+ },
1886
+ {
1887
+ name: "agent_tools_crypto_hmac",
1888
+ description: "Generate an HMAC (Hash-based Message Authentication Code) for a string with a secret key.",
1889
+ inputSchema: {
1890
+ type: "object",
1891
+ properties: {
1892
+ input: { type: "string", description: "Message to authenticate" },
1893
+ key: { type: "string", description: "Secret key for HMAC" },
1894
+ algorithm: {
1895
+ type: "string",
1896
+ enum: ["md5", "sha1", "sha256", "sha384", "sha512"],
1897
+ description: "Hash algorithm (default: sha256)"
1898
+ }
1899
+ },
1900
+ required: ["input", "key"]
1901
+ },
1902
+ handler: async (args) => {
1903
+ const result = agentToolsCore.crypto.hmac(args.input, args.key, {
1904
+ algorithm: args.algorithm
1905
+ });
1906
+ return {
1907
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
1908
+ };
1909
+ }
1910
+ },
1911
+ {
1912
+ name: "agent_tools_crypto_encode",
1913
+ description: "Encode a string to Base64, Hex, URL-encoded, or HTML-encoded format.",
1914
+ inputSchema: {
1915
+ type: "object",
1916
+ properties: {
1917
+ input: { type: "string", description: "String to encode" },
1918
+ format: {
1919
+ type: "string",
1920
+ enum: ["base64", "hex", "url", "html"],
1921
+ description: "Encoding format"
1922
+ }
1923
+ },
1924
+ required: ["input", "format"]
1925
+ },
1926
+ handler: async (args) => {
1927
+ const result = agentToolsCore.crypto.encode(
1928
+ args.input,
1929
+ args.format
1930
+ );
1931
+ return { content: [{ type: "text", text: result }] };
1932
+ }
1933
+ },
1934
+ {
1935
+ name: "agent_tools_crypto_decode",
1936
+ description: "Decode a string from Base64, Hex, URL-encoded, or HTML-encoded format.",
1937
+ inputSchema: {
1938
+ type: "object",
1939
+ properties: {
1940
+ input: { type: "string", description: "Encoded string to decode" },
1941
+ format: {
1942
+ type: "string",
1943
+ enum: ["base64", "hex", "url", "html"],
1944
+ description: "Encoding format to decode from"
1945
+ }
1946
+ },
1947
+ required: ["input", "format"]
1948
+ },
1949
+ handler: async (args) => {
1950
+ const result = agentToolsCore.crypto.decode(
1951
+ args.input,
1952
+ args.format
1953
+ );
1954
+ return { content: [{ type: "text", text: result }] };
1955
+ }
1956
+ },
1957
+ {
1958
+ name: "agent_tools_crypto_jwt_decode",
1959
+ description: "Decode a JWT token without verification. Returns header, payload, signature, and expiration status.",
1960
+ inputSchema: {
1961
+ type: "object",
1962
+ properties: {
1963
+ token: { type: "string", description: "JWT token to decode" }
1964
+ },
1965
+ required: ["token"]
1966
+ },
1967
+ handler: async (args) => {
1968
+ const result = agentToolsCore.crypto.decodeJwt(args.token);
1969
+ return {
1970
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
1971
+ };
1972
+ }
1973
+ },
1974
+ {
1975
+ name: "agent_tools_crypto_uuid",
1976
+ description: "Generate a new UUID v4.",
1977
+ inputSchema: {
1978
+ type: "object",
1979
+ properties: {},
1980
+ required: []
1981
+ },
1982
+ handler: async () => {
1983
+ const result = agentToolsCore.crypto.generateUuid();
1984
+ return {
1985
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
1986
+ };
1987
+ }
1988
+ },
1989
+ {
1990
+ name: "agent_tools_crypto_checksum",
1991
+ description: "Calculate the checksum of data. Useful for verifying file integrity. Accepts text or base64-encoded binary.",
1992
+ inputSchema: {
1993
+ type: "object",
1994
+ properties: {
1995
+ input: { type: "string", description: "Text or base64-encoded data" },
1996
+ algorithm: {
1997
+ type: "string",
1998
+ enum: ["md5", "sha1", "sha256", "sha384", "sha512"],
1999
+ description: "Hash algorithm (default: sha256)"
2000
+ },
2001
+ base64: {
2002
+ type: "boolean",
2003
+ description: "Whether input is base64-encoded binary (default: false)"
2004
+ }
2005
+ },
2006
+ required: ["input"]
2007
+ },
2008
+ handler: async (args) => {
2009
+ const data = args.base64 ? Buffer.from(args.input, "base64") : args.input;
2010
+ const result = agentToolsCore.crypto.checksum(data, args.algorithm);
2011
+ return {
2012
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
2013
+ };
2014
+ }
2015
+ }
2016
+ ];
2017
+ var datetimeTools = [
2018
+ {
2019
+ name: "agent_tools_datetime_parse",
2020
+ description: "Parse a date string (ISO, Unix timestamp, RFC 2822, SQL) into a structured object with year, month, day, timezone, and more.",
2021
+ inputSchema: {
2022
+ type: "object",
2023
+ properties: {
2024
+ input: {
2025
+ type: "string",
2026
+ description: "Date string or Unix timestamp to parse"
2027
+ },
2028
+ timezone: {
2029
+ type: "string",
2030
+ description: "Timezone to interpret the date in (default: utc)"
2031
+ }
2032
+ },
2033
+ required: ["input"]
2034
+ },
2035
+ handler: async (args) => {
2036
+ const result = agentToolsCore.datetime.parseDate(args.input, args.timezone);
2037
+ return {
2038
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
2039
+ };
2040
+ }
2041
+ },
2042
+ {
2043
+ name: "agent_tools_datetime_format",
2044
+ description: "Format a date string using a Luxon format pattern. Supports timezone conversion.",
2045
+ inputSchema: {
2046
+ type: "object",
2047
+ properties: {
2048
+ input: { type: "string", description: "ISO date string to format" },
2049
+ format: {
2050
+ type: "string",
2051
+ description: 'Luxon format pattern (e.g., "yyyy-MM-dd HH:mm:ss")'
2052
+ },
2053
+ timezone: {
2054
+ type: "string",
2055
+ description: "Target timezone (default: utc)"
2056
+ }
2057
+ },
2058
+ required: ["input"]
2059
+ },
2060
+ handler: async (args) => {
2061
+ const result = agentToolsCore.datetime.formatDate(args.input, {
2062
+ format: args.format,
2063
+ timezone: args.timezone
2064
+ });
2065
+ return { content: [{ type: "text", text: result }] };
2066
+ }
2067
+ },
2068
+ {
2069
+ name: "agent_tools_datetime_now",
2070
+ description: "Get the current date and time with full details in a specified timezone.",
2071
+ inputSchema: {
2072
+ type: "object",
2073
+ properties: {
2074
+ timezone: {
2075
+ type: "string",
2076
+ description: "Timezone (default: utc)"
2077
+ }
2078
+ },
2079
+ required: []
2080
+ },
2081
+ handler: async (args) => {
2082
+ const result = agentToolsCore.datetime.now(args.timezone);
2083
+ return {
2084
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
2085
+ };
2086
+ }
2087
+ },
2088
+ {
2089
+ name: "agent_tools_datetime_add",
2090
+ description: "Add time to a date. Specify years, months, weeks, days, hours, minutes, and/or seconds to add.",
2091
+ inputSchema: {
2092
+ type: "object",
2093
+ properties: {
2094
+ input: { type: "string", description: "ISO date string" },
2095
+ years: { type: "number", description: "Years to add" },
2096
+ months: { type: "number", description: "Months to add" },
2097
+ weeks: { type: "number", description: "Weeks to add" },
2098
+ days: { type: "number", description: "Days to add" },
2099
+ hours: { type: "number", description: "Hours to add" },
2100
+ minutes: { type: "number", description: "Minutes to add" },
2101
+ seconds: { type: "number", description: "Seconds to add" },
2102
+ timezone: { type: "string", description: "Timezone" }
2103
+ },
2104
+ required: ["input"]
2105
+ },
2106
+ handler: async (args) => {
2107
+ const result = agentToolsCore.datetime.add(
2108
+ args.input,
2109
+ {
2110
+ years: args.years,
2111
+ months: args.months,
2112
+ weeks: args.weeks,
2113
+ days: args.days,
2114
+ hours: args.hours,
2115
+ minutes: args.minutes,
2116
+ seconds: args.seconds
2117
+ },
2118
+ args.timezone
2119
+ );
2120
+ return { content: [{ type: "text", text: result }] };
2121
+ }
2122
+ },
2123
+ {
2124
+ name: "agent_tools_datetime_subtract",
2125
+ description: "Subtract time from a date. Specify years, months, weeks, days, hours, minutes, and/or seconds to subtract.",
2126
+ inputSchema: {
2127
+ type: "object",
2128
+ properties: {
2129
+ input: { type: "string", description: "ISO date string" },
2130
+ years: { type: "number", description: "Years to subtract" },
2131
+ months: { type: "number", description: "Months to subtract" },
2132
+ weeks: { type: "number", description: "Weeks to subtract" },
2133
+ days: { type: "number", description: "Days to subtract" },
2134
+ hours: { type: "number", description: "Hours to subtract" },
2135
+ minutes: { type: "number", description: "Minutes to subtract" },
2136
+ seconds: { type: "number", description: "Seconds to subtract" },
2137
+ timezone: { type: "string", description: "Timezone" }
2138
+ },
2139
+ required: ["input"]
2140
+ },
2141
+ handler: async (args) => {
2142
+ const result = agentToolsCore.datetime.subtract(
2143
+ args.input,
2144
+ {
2145
+ years: args.years,
2146
+ months: args.months,
2147
+ weeks: args.weeks,
2148
+ days: args.days,
2149
+ hours: args.hours,
2150
+ minutes: args.minutes,
2151
+ seconds: args.seconds
2152
+ },
2153
+ args.timezone
2154
+ );
2155
+ return { content: [{ type: "text", text: result }] };
2156
+ }
2157
+ },
2158
+ {
2159
+ name: "agent_tools_datetime_diff",
2160
+ description: "Calculate the difference between two dates. Returns years, months, days, hours, minutes, seconds and totals.",
2161
+ inputSchema: {
2162
+ type: "object",
2163
+ properties: {
2164
+ a: { type: "string", description: "First date (ISO string)" },
2165
+ b: { type: "string", description: "Second date (ISO string)" }
2166
+ },
2167
+ required: ["a", "b"]
2168
+ },
2169
+ handler: async (args) => {
2170
+ const result = agentToolsCore.datetime.diff(args.a, args.b);
2171
+ return {
2172
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
2173
+ };
2174
+ }
2175
+ },
2176
+ {
2177
+ name: "agent_tools_datetime_timezone_convert",
2178
+ description: "Convert a date from one timezone to another. Returns the converted date with offset information.",
2179
+ inputSchema: {
2180
+ type: "object",
2181
+ properties: {
2182
+ input: { type: "string", description: "ISO date string" },
2183
+ from: { type: "string", description: 'Source timezone (e.g., "America/New_York")' },
2184
+ to: { type: "string", description: 'Target timezone (e.g., "Asia/Tokyo")' }
2185
+ },
2186
+ required: ["input", "from", "to"]
2187
+ },
2188
+ handler: async (args) => {
2189
+ const result = agentToolsCore.datetime.convertTimezone(
2190
+ args.input,
2191
+ args.from,
2192
+ args.to
2193
+ );
2194
+ return {
2195
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
2196
+ };
2197
+ }
2198
+ },
2199
+ {
2200
+ name: "agent_tools_datetime_cron",
2201
+ description: "Parse a cron expression. Returns a human-readable description and the next scheduled run times.",
2202
+ inputSchema: {
2203
+ type: "object",
2204
+ properties: {
2205
+ expression: {
2206
+ type: "string",
2207
+ description: "Cron expression (5 fields: min hour dom month dow)"
2208
+ },
2209
+ count: {
2210
+ type: "number",
2211
+ description: "Number of next run times to return (default: 5)"
2212
+ }
2213
+ },
2214
+ required: ["expression"]
2215
+ },
2216
+ handler: async (args) => {
2217
+ const result = agentToolsCore.datetime.parseCron(
2218
+ args.expression,
2219
+ args.count
2220
+ );
2221
+ return {
2222
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
2223
+ };
2224
+ }
2225
+ },
2226
+ {
2227
+ name: "agent_tools_datetime_timezones",
2228
+ description: "List all available IANA timezone names.",
2229
+ inputSchema: {
2230
+ type: "object",
2231
+ properties: {},
2232
+ required: []
2233
+ },
2234
+ handler: async () => {
2235
+ const result = agentToolsCore.datetime.listTimezones();
2236
+ return {
2237
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
2238
+ };
2239
+ }
2240
+ }
2241
+ ];
2242
+ var textTools = [
2243
+ {
2244
+ name: "agent_tools_text_case",
2245
+ description: "Convert text between case formats: camel, snake, kebab, pascal, title, sentence, upper, lower, constant.",
2246
+ inputSchema: {
2247
+ type: "object",
2248
+ properties: {
2249
+ input: {
2250
+ type: "string",
2251
+ description: "The text to convert"
2252
+ },
2253
+ to: {
2254
+ type: "string",
2255
+ enum: ["camel", "snake", "kebab", "pascal", "title", "sentence", "upper", "lower", "constant"],
2256
+ description: "Target case format"
2257
+ }
2258
+ },
2259
+ required: ["input", "to"]
2260
+ },
2261
+ handler: async (args) => {
2262
+ try {
2263
+ const result = agentToolsCore.text.convertCase(args.input, args.to);
2264
+ return { content: [{ type: "text", text: result }] };
2265
+ } catch (e) {
2266
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
2267
+ }
2268
+ }
2269
+ },
2270
+ {
2271
+ name: "agent_tools_text_slugify",
2272
+ description: "Convert text to a URL-friendly slug.",
2273
+ inputSchema: {
2274
+ type: "object",
2275
+ properties: {
2276
+ input: {
2277
+ type: "string",
2278
+ description: "The text to slugify"
2279
+ },
2280
+ separator: {
2281
+ type: "string",
2282
+ description: 'Separator character (default: "-")'
2283
+ }
2284
+ },
2285
+ required: ["input"]
2286
+ },
2287
+ handler: async (args) => {
2288
+ try {
2289
+ const result = agentToolsCore.text.slugify(args.input, args.separator);
2290
+ return { content: [{ type: "text", text: result }] };
2291
+ } catch (e) {
2292
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
2293
+ }
2294
+ }
2295
+ },
2296
+ {
2297
+ name: "agent_tools_text_stats",
2298
+ description: "Get text statistics: character count, word count, sentence count, paragraph count, lines, and reading time.",
2299
+ inputSchema: {
2300
+ type: "object",
2301
+ properties: {
2302
+ input: {
2303
+ type: "string",
2304
+ description: "The text to analyze"
2305
+ }
2306
+ },
2307
+ required: ["input"]
2308
+ },
2309
+ handler: async (args) => {
2310
+ const result = agentToolsCore.text.getTextStats(args.input);
2311
+ return {
2312
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
2313
+ };
2314
+ }
2315
+ },
2316
+ {
2317
+ name: "agent_tools_text_truncate",
2318
+ description: "Truncate text to a specified length with word or character boundary.",
2319
+ inputSchema: {
2320
+ type: "object",
2321
+ properties: {
2322
+ input: {
2323
+ type: "string",
2324
+ description: "The text to truncate"
2325
+ },
2326
+ length: {
2327
+ type: "number",
2328
+ description: "Maximum length"
2329
+ },
2330
+ boundary: {
2331
+ type: "string",
2332
+ enum: ["character", "word"],
2333
+ description: 'Truncation boundary (default: "word")'
2334
+ },
2335
+ suffix: {
2336
+ type: "string",
2337
+ description: 'Suffix to append (default: "...")'
2338
+ }
2339
+ },
2340
+ required: ["input", "length"]
2341
+ },
2342
+ handler: async (args) => {
2343
+ try {
2344
+ const result = agentToolsCore.text.truncate(args.input, {
2345
+ length: args.length,
2346
+ boundary: args.boundary,
2347
+ suffix: args.suffix
2348
+ });
2349
+ return { content: [{ type: "text", text: result }] };
2350
+ } catch (e) {
2351
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
2352
+ }
2353
+ }
2354
+ },
2355
+ {
2356
+ name: "agent_tools_text_lorem",
2357
+ description: "Generate Lorem Ipsum placeholder text.",
2358
+ inputSchema: {
2359
+ type: "object",
2360
+ properties: {
2361
+ count: {
2362
+ type: "number",
2363
+ description: "Number of units to generate"
2364
+ },
2365
+ unit: {
2366
+ type: "string",
2367
+ enum: ["words", "sentences", "paragraphs"],
2368
+ description: 'Unit type (default: "words")'
2369
+ }
2370
+ },
2371
+ required: ["count"]
2372
+ },
2373
+ handler: async (args) => {
2374
+ const result = agentToolsCore.text.generateLorem(args.count, args.unit);
2375
+ return { content: [{ type: "text", text: result }] };
2376
+ }
2377
+ },
2378
+ {
2379
+ name: "agent_tools_text_similarity",
2380
+ description: "Compare two strings and return Levenshtein distance and similarity ratio (0-1).",
2381
+ inputSchema: {
2382
+ type: "object",
2383
+ properties: {
2384
+ a: {
2385
+ type: "string",
2386
+ description: "First string"
2387
+ },
2388
+ b: {
2389
+ type: "string",
2390
+ description: "Second string"
2391
+ }
2392
+ },
2393
+ required: ["a", "b"]
2394
+ },
2395
+ handler: async (args) => {
2396
+ const result = agentToolsCore.text.similarity(args.a, args.b);
2397
+ return {
2398
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
2399
+ };
2400
+ }
2401
+ },
2402
+ {
2403
+ name: "agent_tools_text_template",
2404
+ description: "Interpolate variables into a template string using {{key}} syntax. Reports missing keys.",
2405
+ inputSchema: {
2406
+ type: "object",
2407
+ properties: {
2408
+ template: {
2409
+ type: "string",
2410
+ description: "Template string with {{key}} placeholders"
2411
+ },
2412
+ variables: {
2413
+ type: "object",
2414
+ description: "Key-value pairs for interpolation"
2415
+ }
2416
+ },
2417
+ required: ["template", "variables"]
2418
+ },
2419
+ handler: async (args) => {
2420
+ const result = agentToolsCore.text.interpolate(args.template, args.variables);
2421
+ return {
2422
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
2423
+ };
2424
+ }
2425
+ }
2426
+ ];
2427
+ var mathTools = [
2428
+ {
2429
+ name: "agent_tools_math_convert",
2430
+ description: "Convert between units of measurement (length, weight, temperature, data).",
2431
+ inputSchema: {
2432
+ type: "object",
2433
+ properties: {
2434
+ value: {
2435
+ type: "number",
2436
+ description: "The numeric value to convert"
2437
+ },
2438
+ from: {
2439
+ type: "string",
2440
+ description: 'Source unit (e.g., "km", "lb", "celsius", "gb")'
2441
+ },
2442
+ to: {
2443
+ type: "string",
2444
+ description: 'Target unit (e.g., "mi", "kg", "fahrenheit", "mb")'
2445
+ },
2446
+ category: {
2447
+ type: "string",
2448
+ enum: ["length", "weight", "temperature", "data"],
2449
+ description: "Unit category"
2450
+ }
2451
+ },
2452
+ required: ["value", "from", "to", "category"]
2453
+ },
2454
+ handler: async (args) => {
2455
+ try {
2456
+ const result = agentToolsCore.math.convertUnit(args.value, args.from, args.to, args.category);
2457
+ return {
2458
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
2459
+ };
2460
+ } catch (e) {
2461
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
2462
+ }
2463
+ }
2464
+ },
2465
+ {
2466
+ name: "agent_tools_math_base",
2467
+ description: "Convert numbers between binary, octal, decimal, and hexadecimal bases.",
2468
+ inputSchema: {
2469
+ type: "object",
2470
+ properties: {
2471
+ input: {
2472
+ type: "string",
2473
+ description: "The number string to convert"
2474
+ },
2475
+ fromBase: {
2476
+ type: "string",
2477
+ enum: ["binary", "octal", "decimal", "hex"],
2478
+ description: "Source number base"
2479
+ }
2480
+ },
2481
+ required: ["input", "fromBase"]
2482
+ },
2483
+ handler: async (args) => {
2484
+ try {
2485
+ const result = agentToolsCore.math.convertBase(args.input, args.fromBase);
2486
+ return {
2487
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
2488
+ };
2489
+ } catch (e) {
2490
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
2491
+ }
2492
+ }
2493
+ },
2494
+ {
2495
+ name: "agent_tools_math_statistics",
2496
+ description: "Calculate statistics for a set of numbers: mean, median, mode, std deviation, percentiles.",
2497
+ inputSchema: {
2498
+ type: "object",
2499
+ properties: {
2500
+ numbers: {
2501
+ type: "array",
2502
+ items: { type: "number" },
2503
+ description: "Array of numbers to analyze"
2504
+ }
2505
+ },
2506
+ required: ["numbers"]
2507
+ },
2508
+ handler: async (args) => {
2509
+ try {
2510
+ const result = agentToolsCore.math.calculateStats(args.numbers);
2511
+ return {
2512
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
2513
+ };
2514
+ } catch (e) {
2515
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
2516
+ }
2517
+ }
2518
+ },
2519
+ {
2520
+ name: "agent_tools_math_format",
2521
+ description: "Format a number with locale-aware formatting, currency, or percentage display.",
2522
+ inputSchema: {
2523
+ type: "object",
2524
+ properties: {
2525
+ value: {
2526
+ type: "number",
2527
+ description: "The number to format"
2528
+ },
2529
+ locale: {
2530
+ type: "string",
2531
+ description: 'Locale string (default: "en-US")'
2532
+ },
2533
+ style: {
2534
+ type: "string",
2535
+ enum: ["decimal", "currency", "percent"],
2536
+ description: 'Format style (default: "decimal")'
2537
+ },
2538
+ currency: {
2539
+ type: "string",
2540
+ description: 'Currency code when style is "currency" (e.g., "USD")'
2541
+ },
2542
+ minimumFractionDigits: {
2543
+ type: "number",
2544
+ description: "Minimum decimal places"
2545
+ },
2546
+ maximumFractionDigits: {
2547
+ type: "number",
2548
+ description: "Maximum decimal places"
2549
+ }
2550
+ },
2551
+ required: ["value"]
2552
+ },
2553
+ handler: async (args) => {
2554
+ try {
2555
+ const result = agentToolsCore.math.formatNumber(args.value, {
2556
+ locale: args.locale,
2557
+ style: args.style,
2558
+ currency: args.currency,
2559
+ minimumFractionDigits: args.minimumFractionDigits,
2560
+ maximumFractionDigits: args.maximumFractionDigits
2561
+ });
2562
+ return { content: [{ type: "text", text: result }] };
2563
+ } catch (e) {
2564
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
2565
+ }
2566
+ }
2567
+ },
2568
+ {
2569
+ name: "agent_tools_math_percentage",
2570
+ description: "Calculate percentages: what percentage a value is of a total, or percentage change between two values.",
2571
+ inputSchema: {
2572
+ type: "object",
2573
+ properties: {
2574
+ action: {
2575
+ type: "string",
2576
+ enum: ["of", "change"],
2577
+ description: '"of" for value/total percentage, "change" for percentage change from/to'
2578
+ },
2579
+ value: {
2580
+ type: "number",
2581
+ description: 'The value (or "from" value for change)'
2582
+ },
2583
+ total: {
2584
+ type: "number",
2585
+ description: 'The total (or "to" value for change)'
2586
+ }
2587
+ },
2588
+ required: ["action", "value", "total"]
2589
+ },
2590
+ handler: async (args) => {
2591
+ try {
2592
+ if (args.action === "change") {
2593
+ const result2 = agentToolsCore.math.percentageChange(args.value, args.total);
2594
+ return {
2595
+ content: [{ type: "text", text: JSON.stringify(result2, null, 2) }]
2596
+ };
2597
+ }
2598
+ const result = agentToolsCore.math.percentage(args.value, args.total);
2599
+ return {
2600
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
2601
+ };
2602
+ } catch (e) {
2603
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
2604
+ }
2605
+ }
2606
+ }
2607
+ ];
2608
+ var colorTools = [
2609
+ {
2610
+ name: "agent_tools_color_parse",
2611
+ description: "Parse a color string (hex, rgb(), hsl()) and return all format representations.",
2612
+ inputSchema: {
2613
+ type: "object",
2614
+ properties: {
2615
+ input: {
2616
+ type: "string",
2617
+ description: 'Color string to parse (e.g., "#FF5733", "rgb(255,87,51)", "hsl(9,100%,60%)")'
2618
+ }
2619
+ },
2620
+ required: ["input"]
2621
+ },
2622
+ handler: async (args) => {
2623
+ try {
2624
+ const result = agentToolsCore.color.parseColor(args.input);
2625
+ return {
2626
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
2627
+ };
2628
+ } catch (e) {
2629
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
2630
+ }
2631
+ }
2632
+ },
2633
+ {
2634
+ name: "agent_tools_color_convert",
2635
+ description: "Convert a color to a specific format (hex, rgb, hsl).",
2636
+ inputSchema: {
2637
+ type: "object",
2638
+ properties: {
2639
+ input: {
2640
+ type: "string",
2641
+ description: "Color string to convert"
2642
+ },
2643
+ to: {
2644
+ type: "string",
2645
+ enum: ["hex", "rgb", "hsl"],
2646
+ description: "Target color format"
2647
+ }
2648
+ },
2649
+ required: ["input", "to"]
2650
+ },
2651
+ handler: async (args) => {
2652
+ try {
2653
+ const result = agentToolsCore.color.convertColor(args.input, args.to);
2654
+ return { content: [{ type: "text", text: result }] };
2655
+ } catch (e) {
2656
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
2657
+ }
2658
+ }
2659
+ },
2660
+ {
2661
+ name: "agent_tools_color_contrast",
2662
+ description: "Calculate WCAG 2.1 contrast ratio between two colors with AA/AAA pass/fail results.",
2663
+ inputSchema: {
2664
+ type: "object",
2665
+ properties: {
2666
+ color1: {
2667
+ type: "string",
2668
+ description: "First color"
2669
+ },
2670
+ color2: {
2671
+ type: "string",
2672
+ description: "Second color"
2673
+ }
2674
+ },
2675
+ required: ["color1", "color2"]
2676
+ },
2677
+ handler: async (args) => {
2678
+ try {
2679
+ const result = agentToolsCore.color.contrastRatio(args.color1, args.color2);
2680
+ return {
2681
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
2682
+ };
2683
+ } catch (e) {
2684
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
2685
+ }
2686
+ }
2687
+ },
2688
+ {
2689
+ name: "agent_tools_color_palette",
2690
+ description: "Generate a color palette from a base color: complementary, analogous, triadic, shades, or tints.",
2691
+ inputSchema: {
2692
+ type: "object",
2693
+ properties: {
2694
+ base: {
2695
+ type: "string",
2696
+ description: "Base color string"
2697
+ },
2698
+ type: {
2699
+ type: "string",
2700
+ enum: ["complementary", "analogous", "triadic", "shades", "tints"],
2701
+ description: "Palette generation strategy"
2702
+ },
2703
+ count: {
2704
+ type: "number",
2705
+ description: "Number of colors to generate (default: 5, ignored for complementary/triadic)"
2706
+ }
2707
+ },
2708
+ required: ["base", "type"]
2709
+ },
2710
+ handler: async (args) => {
2711
+ try {
2712
+ const result = agentToolsCore.color.generatePalette(args.base, {
2713
+ type: args.type,
2714
+ count: args.count
2715
+ });
2716
+ return {
2717
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
2718
+ };
2719
+ } catch (e) {
2720
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
2721
+ }
2722
+ }
2723
+ },
2724
+ {
2725
+ name: "agent_tools_color_blend",
2726
+ description: "Blend two colors together at a given ratio.",
2727
+ inputSchema: {
2728
+ type: "object",
2729
+ properties: {
2730
+ color1: {
2731
+ type: "string",
2732
+ description: "First color"
2733
+ },
2734
+ color2: {
2735
+ type: "string",
2736
+ description: "Second color"
2737
+ },
2738
+ ratio: {
2739
+ type: "number",
2740
+ description: "Blend ratio 0-1 (0 = all color1, 1 = all color2, default: 0.5)"
2741
+ }
2742
+ },
2743
+ required: ["color1", "color2"]
2744
+ },
2745
+ handler: async (args) => {
2746
+ try {
2747
+ const result = agentToolsCore.color.blendColors(args.color1, args.color2, args.ratio);
2748
+ return {
2749
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
2750
+ };
2751
+ } catch (e) {
2752
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
2753
+ }
2754
+ }
2755
+ },
2756
+ {
2757
+ name: "agent_tools_color_name",
2758
+ description: "Find the nearest CSS named color for a given color input.",
2759
+ inputSchema: {
2760
+ type: "object",
2761
+ properties: {
2762
+ input: {
2763
+ type: "string",
2764
+ description: "Color string to identify"
2765
+ }
2766
+ },
2767
+ required: ["input"]
2768
+ },
2769
+ handler: async (args) => {
2770
+ try {
2771
+ const result = agentToolsCore.color.colorName(args.input);
2772
+ return {
2773
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
2774
+ };
2775
+ } catch (e) {
2776
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
2777
+ }
2778
+ }
2779
+ }
2780
+ ];
2781
+ var physicsTools = [
2782
+ {
2783
+ name: "agent_tools_physics_constants",
2784
+ description: "Look up physical constants (speed of light, Planck, Boltzmann, etc.) or list all constants by category.",
2785
+ inputSchema: {
2786
+ type: "object",
2787
+ properties: {
2788
+ key: { type: "string", description: "Constant key (c, G, h, hbar, k_B, N_A, R, e, epsilon_0, mu_0, m_e, m_p, sigma, g, atm, k_e)" },
2789
+ category: { type: "string", description: "Filter by category: universal, electromagnetic, thermodynamics, quantum, atomic, mechanics, chemistry" }
2790
+ },
2791
+ required: []
2792
+ },
2793
+ handler: async (args) => {
2794
+ try {
2795
+ if (args.key) {
2796
+ const result2 = agentToolsCore.physics.getConstant(args.key);
2797
+ return { content: [{ type: "text", text: JSON.stringify(result2, null, 2) }] };
2798
+ }
2799
+ const result = agentToolsCore.physics.listConstants(args.category);
2800
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
2801
+ } catch (e) {
2802
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
2803
+ }
2804
+ }
2805
+ },
2806
+ {
2807
+ name: "agent_tools_physics_kinematics",
2808
+ description: "Solve kinematics equations of motion. Provide at least 3 known values to solve for the remaining.",
2809
+ inputSchema: {
2810
+ type: "object",
2811
+ properties: {
2812
+ displacement: { type: "number", description: "Displacement in meters" },
2813
+ initialVelocity: { type: "number", description: "Initial velocity in m/s" },
2814
+ finalVelocity: { type: "number", description: "Final velocity in m/s" },
2815
+ acceleration: { type: "number", description: "Acceleration in m/s\xB2" },
2816
+ time: { type: "number", description: "Time in seconds" }
2817
+ },
2818
+ required: []
2819
+ },
2820
+ handler: async (args) => {
2821
+ try {
2822
+ const result = agentToolsCore.physics.solveKinematics(args);
2823
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
2824
+ } catch (e) {
2825
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
2826
+ }
2827
+ }
2828
+ },
2829
+ {
2830
+ name: "agent_tools_physics_projectile",
2831
+ description: "Calculate projectile motion: range, max height, flight time, and velocity at peak.",
2832
+ inputSchema: {
2833
+ type: "object",
2834
+ properties: {
2835
+ initialVelocity: { type: "number", description: "Initial velocity in m/s" },
2836
+ angle: { type: "number", description: "Launch angle in degrees (0-90)" },
2837
+ gravity: { type: "number", description: "Gravity in m/s\xB2 (default: 9.80665)" }
2838
+ },
2839
+ required: ["initialVelocity", "angle"]
2840
+ },
2841
+ handler: async (args) => {
2842
+ try {
2843
+ const result = agentToolsCore.physics.projectileMotion(args.initialVelocity, args.angle, args.gravity);
2844
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
2845
+ } catch (e) {
2846
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
2847
+ }
2848
+ }
2849
+ },
2850
+ {
2851
+ name: "agent_tools_physics_force",
2852
+ description: "Calculate force using Newton's second law (F = ma).",
2853
+ inputSchema: {
2854
+ type: "object",
2855
+ properties: {
2856
+ mass: { type: "number", description: "Mass in kg" },
2857
+ acceleration: { type: "number", description: "Acceleration in m/s\xB2" }
2858
+ },
2859
+ required: ["mass", "acceleration"]
2860
+ },
2861
+ handler: async (args) => {
2862
+ try {
2863
+ const result = agentToolsCore.physics.calculateForce(args.mass, args.acceleration);
2864
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
2865
+ } catch (e) {
2866
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
2867
+ }
2868
+ }
2869
+ },
2870
+ {
2871
+ name: "agent_tools_physics_energy",
2872
+ description: "Calculate kinetic energy, potential energy, and total mechanical energy.",
2873
+ inputSchema: {
2874
+ type: "object",
2875
+ properties: {
2876
+ mass: { type: "number", description: "Mass in kg" },
2877
+ velocity: { type: "number", description: "Velocity in m/s" },
2878
+ height: { type: "number", description: "Height in meters (default: 0)" },
2879
+ gravity: { type: "number", description: "Gravity in m/s\xB2 (default: 9.80665)" }
2880
+ },
2881
+ required: ["mass", "velocity"]
2882
+ },
2883
+ handler: async (args) => {
2884
+ try {
2885
+ const result = agentToolsCore.physics.calculateEnergy(args.mass, args.velocity, args.height, args.gravity);
2886
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
2887
+ } catch (e) {
2888
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
2889
+ }
2890
+ }
2891
+ },
2892
+ {
2893
+ name: "agent_tools_physics_gravity",
2894
+ description: "Calculate gravitational force between two masses using Newton's law of universal gravitation.",
2895
+ inputSchema: {
2896
+ type: "object",
2897
+ properties: {
2898
+ mass1: { type: "number", description: "First mass in kg" },
2899
+ mass2: { type: "number", description: "Second mass in kg" },
2900
+ distance: { type: "number", description: "Distance between centers in meters" }
2901
+ },
2902
+ required: ["mass1", "mass2", "distance"]
2903
+ },
2904
+ handler: async (args) => {
2905
+ try {
2906
+ const result = agentToolsCore.physics.gravitationalForce(args.mass1, args.mass2, args.distance);
2907
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
2908
+ } catch (e) {
2909
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
2910
+ }
2911
+ }
2912
+ },
2913
+ {
2914
+ name: "agent_tools_physics_orbital",
2915
+ description: "Calculate orbital velocity and escape velocity for a body orbiting a central mass.",
2916
+ inputSchema: {
2917
+ type: "object",
2918
+ properties: {
2919
+ mass: { type: "number", description: "Central body mass in kg" },
2920
+ radius: { type: "number", description: "Orbital radius in meters" }
2921
+ },
2922
+ required: ["mass", "radius"]
2923
+ },
2924
+ handler: async (args) => {
2925
+ try {
2926
+ const result = agentToolsCore.physics.orbitalMechanics(args.mass, args.radius);
2927
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
2928
+ } catch (e) {
2929
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
2930
+ }
2931
+ }
2932
+ },
2933
+ {
2934
+ name: "agent_tools_physics_ohms_law",
2935
+ description: "Apply Ohm's law. Provide at least 2 of voltage, current, resistance to solve for the third and power.",
2936
+ inputSchema: {
2937
+ type: "object",
2938
+ properties: {
2939
+ voltage: { type: "number", description: "Voltage in volts" },
2940
+ current: { type: "number", description: "Current in amperes" },
2941
+ resistance: { type: "number", description: "Resistance in ohms" }
2942
+ },
2943
+ required: []
2944
+ },
2945
+ handler: async (args) => {
2946
+ try {
2947
+ const result = agentToolsCore.physics.ohmsLaw(args);
2948
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
2949
+ } catch (e) {
2950
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
2951
+ }
2952
+ }
2953
+ },
2954
+ {
2955
+ name: "agent_tools_physics_resistors",
2956
+ description: "Calculate total resistance for resistors in series or parallel.",
2957
+ inputSchema: {
2958
+ type: "object",
2959
+ properties: {
2960
+ values: { type: "array", items: { type: "number" }, description: "Resistor values in ohms" },
2961
+ configuration: { type: "string", enum: ["series", "parallel"], description: "Circuit configuration" }
2962
+ },
2963
+ required: ["values", "configuration"]
2964
+ },
2965
+ handler: async (args) => {
2966
+ try {
2967
+ const result = agentToolsCore.physics.resistors(args.values, args.configuration);
2968
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
2969
+ } catch (e) {
2970
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
2971
+ }
2972
+ }
2973
+ },
2974
+ {
2975
+ name: "agent_tools_physics_wave",
2976
+ description: "Solve wave equation (v = f\u03BB). Provide at least 2 of frequency, wavelength, speed.",
2977
+ inputSchema: {
2978
+ type: "object",
2979
+ properties: {
2980
+ frequency: { type: "number", description: "Frequency in Hz" },
2981
+ wavelength: { type: "number", description: "Wavelength in meters" },
2982
+ speed: { type: "number", description: "Wave speed in m/s" }
2983
+ },
2984
+ required: []
2985
+ },
2986
+ handler: async (args) => {
2987
+ try {
2988
+ const result = agentToolsCore.physics.waveEquation(args);
2989
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
2990
+ } catch (e) {
2991
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
2992
+ }
2993
+ }
2994
+ },
2995
+ {
2996
+ name: "agent_tools_physics_snell",
2997
+ description: "Apply Snell's law for light refraction. Calculates refraction angle and detects total internal reflection.",
2998
+ inputSchema: {
2999
+ type: "object",
3000
+ properties: {
3001
+ n1: { type: "number", description: "Refractive index of medium 1" },
3002
+ n2: { type: "number", description: "Refractive index of medium 2" },
3003
+ angle: { type: "number", description: "Incident angle in degrees" }
3004
+ },
3005
+ required: ["n1", "n2", "angle"]
3006
+ },
3007
+ handler: async (args) => {
3008
+ try {
3009
+ const result = agentToolsCore.physics.snellsLaw(args.n1, args.n2, args.angle);
3010
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
3011
+ } catch (e) {
3012
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
3013
+ }
3014
+ }
3015
+ },
3016
+ {
3017
+ name: "agent_tools_physics_ideal_gas",
3018
+ description: "Solve the ideal gas law (PV = nRT). Provide at least 3 of pressure, volume, moles, temperature.",
3019
+ inputSchema: {
3020
+ type: "object",
3021
+ properties: {
3022
+ pressure: { type: "number", description: "Pressure in Pa" },
3023
+ volume: { type: "number", description: "Volume in m\xB3" },
3024
+ moles: { type: "number", description: "Amount in mol" },
3025
+ temperature: { type: "number", description: "Temperature in K" }
3026
+ },
3027
+ required: []
3028
+ },
3029
+ handler: async (args) => {
3030
+ try {
3031
+ const result = agentToolsCore.physics.idealGasLaw(args);
3032
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
3033
+ } catch (e) {
3034
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
3035
+ }
3036
+ }
3037
+ },
3038
+ {
3039
+ name: "agent_tools_physics_carnot",
3040
+ description: "Calculate Carnot efficiency for a heat engine given hot and cold reservoir temperatures.",
3041
+ inputSchema: {
3042
+ type: "object",
3043
+ properties: {
3044
+ hotTemperature: { type: "number", description: "Hot reservoir temperature in Kelvin" },
3045
+ coldTemperature: { type: "number", description: "Cold reservoir temperature in Kelvin" }
3046
+ },
3047
+ required: ["hotTemperature", "coldTemperature"]
3048
+ },
3049
+ handler: async (args) => {
3050
+ try {
3051
+ const result = agentToolsCore.physics.carnotEfficiency(args.hotTemperature, args.coldTemperature);
3052
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
3053
+ } catch (e) {
3054
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
3055
+ }
3056
+ }
3057
+ },
3058
+ {
3059
+ name: "agent_tools_physics_lorentz",
3060
+ description: "Calculate the Lorentz factor (gamma) for special relativity given a velocity.",
3061
+ inputSchema: {
3062
+ type: "object",
3063
+ properties: {
3064
+ velocity: { type: "number", description: "Velocity in m/s" }
3065
+ },
3066
+ required: ["velocity"]
3067
+ },
3068
+ handler: async (args) => {
3069
+ try {
3070
+ const result = agentToolsCore.physics.lorentzFactor(args.velocity);
3071
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
3072
+ } catch (e) {
3073
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
3074
+ }
3075
+ }
3076
+ },
3077
+ {
3078
+ name: "agent_tools_physics_time_dilation",
3079
+ description: "Calculate relativistic time dilation for a moving object.",
3080
+ inputSchema: {
3081
+ type: "object",
3082
+ properties: {
3083
+ properTime: { type: "number", description: "Proper time in seconds" },
3084
+ velocity: { type: "number", description: "Velocity in m/s" }
3085
+ },
3086
+ required: ["properTime", "velocity"]
3087
+ },
3088
+ handler: async (args) => {
3089
+ try {
3090
+ const result = agentToolsCore.physics.timeDilation(args.properTime, args.velocity);
3091
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
3092
+ } catch (e) {
3093
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
3094
+ }
3095
+ }
3096
+ },
3097
+ {
3098
+ name: "agent_tools_physics_mass_energy",
3099
+ description: "Calculate mass-energy equivalence (E = mc\xB2). Convert mass to energy or energy to mass.",
3100
+ inputSchema: {
3101
+ type: "object",
3102
+ properties: {
3103
+ mass: { type: "number", description: "Mass in kg (for mass\u2192energy)" },
3104
+ energy: { type: "number", description: "Energy in joules (for energy\u2192mass)" }
3105
+ },
3106
+ required: []
3107
+ },
3108
+ handler: async (args) => {
3109
+ try {
3110
+ const result = args.mass !== void 0 ? agentToolsCore.physics.massEnergy(args.mass) : agentToolsCore.physics.energyToMass(args.energy);
3111
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
3112
+ } catch (e) {
3113
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
3114
+ }
3115
+ }
3116
+ },
3117
+ {
3118
+ name: "agent_tools_physics_unit_convert",
3119
+ description: "Convert between physics units: force (N, lbf, kgf), energy (J, cal, eV, kWh, BTU), power (W, hp), pressure (Pa, atm, bar, psi), speed (m/s, km/h, mph).",
3120
+ inputSchema: {
3121
+ type: "object",
3122
+ properties: {
3123
+ value: { type: "number", description: "Value to convert" },
3124
+ from: { type: "string", description: "Source unit" },
3125
+ to: { type: "string", description: "Target unit" },
3126
+ category: { type: "string", enum: ["force", "energy", "power", "pressure", "speed"], description: "Unit category" }
3127
+ },
3128
+ required: ["value", "from", "to", "category"]
3129
+ },
3130
+ handler: async (args) => {
3131
+ try {
3132
+ const result = agentToolsCore.physics.convertPhysicsUnit(args.value, args.from, args.to, args.category);
3133
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
3134
+ } catch (e) {
3135
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
3136
+ }
3137
+ }
3138
+ }
3139
+ ];
3140
+ var structuralTools = [
3141
+ // --- Stress & Strain ---
3142
+ {
3143
+ name: "agent_tools_structural_normal_stress",
3144
+ description: "Calculate normal stress (\u03C3 = F/A) given force and cross-sectional area.",
3145
+ inputSchema: {
3146
+ type: "object",
3147
+ properties: {
3148
+ force: { type: "number", description: "Axial force in Newtons" },
3149
+ area: { type: "number", description: "Cross-sectional area in m\xB2" }
3150
+ },
3151
+ required: ["force", "area"]
3152
+ },
3153
+ handler: async (args) => {
3154
+ try {
3155
+ const result = agentToolsCore.structural.normalStress(args.force, args.area);
3156
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
3157
+ } catch (e) {
3158
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
3159
+ }
3160
+ }
3161
+ },
3162
+ {
3163
+ name: "agent_tools_structural_shear_stress",
3164
+ description: "Calculate shear stress (\u03C4 = V/A) given shear force and area.",
3165
+ inputSchema: {
3166
+ type: "object",
3167
+ properties: {
3168
+ force: { type: "number", description: "Shear force in Newtons" },
3169
+ area: { type: "number", description: "Cross-sectional area in m\xB2" }
3170
+ },
3171
+ required: ["force", "area"]
3172
+ },
3173
+ handler: async (args) => {
3174
+ try {
3175
+ const result = agentToolsCore.structural.shearStress(args.force, args.area);
3176
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
3177
+ } catch (e) {
3178
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
3179
+ }
3180
+ }
3181
+ },
3182
+ {
3183
+ name: "agent_tools_structural_strain",
3184
+ description: "Calculate strain (\u03B5 = \u0394L/L) given change in length and original length.",
3185
+ inputSchema: {
3186
+ type: "object",
3187
+ properties: {
3188
+ deltaLength: { type: "number", description: "Change in length in meters" },
3189
+ originalLength: { type: "number", description: "Original length in meters" }
3190
+ },
3191
+ required: ["deltaLength", "originalLength"]
3192
+ },
3193
+ handler: async (args) => {
3194
+ try {
3195
+ const result = agentToolsCore.structural.strain(args.deltaLength, args.originalLength);
3196
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
3197
+ } catch (e) {
3198
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
3199
+ }
3200
+ }
3201
+ },
3202
+ {
3203
+ name: "agent_tools_structural_youngs_modulus",
3204
+ description: "Calculate Young's modulus (E = \u03C3/\u03B5) from stress and strain values.",
3205
+ inputSchema: {
3206
+ type: "object",
3207
+ properties: {
3208
+ stress: { type: "number", description: "Stress in Pa" },
3209
+ strain: { type: "number", description: "Strain (dimensionless)" }
3210
+ },
3211
+ required: ["stress", "strain"]
3212
+ },
3213
+ handler: async (args) => {
3214
+ try {
3215
+ const result = agentToolsCore.structural.youngsModulus(args.stress, args.strain);
3216
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
3217
+ } catch (e) {
3218
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
3219
+ }
3220
+ }
3221
+ },
3222
+ {
3223
+ name: "agent_tools_structural_factor_of_safety",
3224
+ description: "Calculate factor of safety (FoS = \u03C3_ultimate / \u03C3_working).",
3225
+ inputSchema: {
3226
+ type: "object",
3227
+ properties: {
3228
+ ultimateStress: { type: "number", description: "Ultimate stress in Pa" },
3229
+ workingStress: { type: "number", description: "Working/allowable stress in Pa" }
3230
+ },
3231
+ required: ["ultimateStress", "workingStress"]
3232
+ },
3233
+ handler: async (args) => {
3234
+ try {
3235
+ const result = agentToolsCore.structural.factorOfSafety(args.ultimateStress, args.workingStress);
3236
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
3237
+ } catch (e) {
3238
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
3239
+ }
3240
+ }
3241
+ },
3242
+ {
3243
+ name: "agent_tools_structural_hoop_stress",
3244
+ description: "Calculate hoop and longitudinal stress in thin-walled pressure vessels (\u03C3 = pR/t).",
3245
+ inputSchema: {
3246
+ type: "object",
3247
+ properties: {
3248
+ pressure: { type: "number", description: "Internal pressure in Pa" },
3249
+ radius: { type: "number", description: "Vessel radius in meters" },
3250
+ thickness: { type: "number", description: "Wall thickness in meters" }
3251
+ },
3252
+ required: ["pressure", "radius", "thickness"]
3253
+ },
3254
+ handler: async (args) => {
3255
+ try {
3256
+ const result = agentToolsCore.structural.hoopStress(args.pressure, args.radius, args.thickness);
3257
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
3258
+ } catch (e) {
3259
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
3260
+ }
3261
+ }
3262
+ },
3263
+ // --- Beams ---
3264
+ {
3265
+ name: "agent_tools_structural_simply_supported_beam",
3266
+ description: "Analyze a simply supported beam: reactions, max moment, max shear, and deflection. Load types: point-center, point-custom, uniform, triangular.",
3267
+ inputSchema: {
3268
+ type: "object",
3269
+ properties: {
3270
+ length: { type: "number", description: "Beam length in meters" },
3271
+ load: { type: "number", description: "Total load in Newtons" },
3272
+ loadType: { type: "string", enum: ["point-center", "point-custom", "uniform", "triangular"], description: "Type of loading" },
3273
+ E: { type: "number", description: "Elastic modulus in Pa (optional, for deflection)" },
3274
+ I: { type: "number", description: "Moment of inertia in m\u2074 (optional, for deflection)" },
3275
+ loadPosition: { type: "number", description: "Load position from left end in meters (for point-custom)" }
3276
+ },
3277
+ required: ["length", "load", "loadType"]
3278
+ },
3279
+ handler: async (args) => {
3280
+ try {
3281
+ const result = agentToolsCore.structural.simplySupported(args.length, args.load, args.loadType, args.E, args.I, args.loadPosition);
3282
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
3283
+ } catch (e) {
3284
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
3285
+ }
3286
+ }
3287
+ },
3288
+ {
3289
+ name: "agent_tools_structural_cantilever_beam",
3290
+ description: "Analyze a cantilever beam: reactions, max moment, max shear, and deflection. Load types: point-end, point-custom, uniform.",
3291
+ inputSchema: {
3292
+ type: "object",
3293
+ properties: {
3294
+ length: { type: "number", description: "Beam length in meters" },
3295
+ load: { type: "number", description: "Total load in Newtons" },
3296
+ loadType: { type: "string", enum: ["point-end", "point-custom", "uniform"], description: "Type of loading" },
3297
+ E: { type: "number", description: "Elastic modulus in Pa (optional, for deflection)" },
3298
+ I: { type: "number", description: "Moment of inertia in m\u2074 (optional, for deflection)" },
3299
+ loadPosition: { type: "number", description: "Load position from fixed end in meters (for point-custom)" }
3300
+ },
3301
+ required: ["length", "load", "loadType"]
3302
+ },
3303
+ handler: async (args) => {
3304
+ try {
3305
+ const result = agentToolsCore.structural.cantilever(args.length, args.load, args.loadType, args.E, args.I, args.loadPosition);
3306
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
3307
+ } catch (e) {
3308
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
3309
+ }
3310
+ }
3311
+ },
3312
+ // --- Columns ---
3313
+ {
3314
+ name: "agent_tools_structural_euler_buckling",
3315
+ description: "Calculate Euler's critical buckling load (Pcr = \u03C0\xB2EI/Le\xB2) for columns with various end conditions.",
3316
+ inputSchema: {
3317
+ type: "object",
3318
+ properties: {
3319
+ E: { type: "number", description: "Elastic modulus in Pa" },
3320
+ I: { type: "number", description: "Moment of inertia in m\u2074" },
3321
+ length: { type: "number", description: "Column length in meters" },
3322
+ endCondition: { type: "string", enum: ["pinned-pinned", "fixed-free", "fixed-pinned", "fixed-fixed"], description: "End support conditions" }
3323
+ },
3324
+ required: ["E", "I", "length", "endCondition"]
3325
+ },
3326
+ handler: async (args) => {
3327
+ try {
3328
+ const result = agentToolsCore.structural.eulerBuckling(args.E, args.I, args.length, args.endCondition);
3329
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
3330
+ } catch (e) {
3331
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
3332
+ }
3333
+ }
3334
+ },
3335
+ {
3336
+ name: "agent_tools_structural_slenderness_ratio",
3337
+ description: "Calculate slenderness ratio (\u03BB = Le/r) and classify column as short, intermediate, or long.",
3338
+ inputSchema: {
3339
+ type: "object",
3340
+ properties: {
3341
+ effectiveLength: { type: "number", description: "Effective length in meters" },
3342
+ radiusOfGyration: { type: "number", description: "Radius of gyration in meters" }
3343
+ },
3344
+ required: ["effectiveLength", "radiusOfGyration"]
3345
+ },
3346
+ handler: async (args) => {
3347
+ try {
3348
+ const result = agentToolsCore.structural.slendernessRatio(args.effectiveLength, args.radiusOfGyration);
3349
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
3350
+ } catch (e) {
3351
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
3352
+ }
3353
+ }
3354
+ },
3355
+ // --- Sections ---
3356
+ {
3357
+ name: "agent_tools_structural_rectangle_section",
3358
+ description: "Calculate properties of a rectangular cross-section: area, Ixx, Iyy, Sx, Sy, rx, ry.",
3359
+ inputSchema: {
3360
+ type: "object",
3361
+ properties: {
3362
+ width: { type: "number", description: "Width in meters" },
3363
+ height: { type: "number", description: "Height in meters" }
3364
+ },
3365
+ required: ["width", "height"]
3366
+ },
3367
+ handler: async (args) => {
3368
+ try {
3369
+ const result = agentToolsCore.structural.rectangleSection(args.width, args.height);
3370
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
3371
+ } catch (e) {
3372
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
3373
+ }
3374
+ }
3375
+ },
3376
+ {
3377
+ name: "agent_tools_structural_circular_section",
3378
+ description: "Calculate properties of a solid circular cross-section: area, I, S, r.",
3379
+ inputSchema: {
3380
+ type: "object",
3381
+ properties: {
3382
+ diameter: { type: "number", description: "Diameter in meters" }
3383
+ },
3384
+ required: ["diameter"]
3385
+ },
3386
+ handler: async (args) => {
3387
+ try {
3388
+ const result = agentToolsCore.structural.circularSection(args.diameter);
3389
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
3390
+ } catch (e) {
3391
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
3392
+ }
3393
+ }
3394
+ },
3395
+ {
3396
+ name: "agent_tools_structural_hollow_circular_section",
3397
+ description: "Calculate properties of a hollow circular (tube) cross-section: area, I, S, r.",
3398
+ inputSchema: {
3399
+ type: "object",
3400
+ properties: {
3401
+ outerDiameter: { type: "number", description: "Outer diameter in meters" },
3402
+ innerDiameter: { type: "number", description: "Inner diameter in meters" }
3403
+ },
3404
+ required: ["outerDiameter", "innerDiameter"]
3405
+ },
3406
+ handler: async (args) => {
3407
+ try {
3408
+ const result = agentToolsCore.structural.hollowCircularSection(args.outerDiameter, args.innerDiameter);
3409
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
3410
+ } catch (e) {
3411
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
3412
+ }
3413
+ }
3414
+ },
3415
+ {
3416
+ name: "agent_tools_structural_i_beam_section",
3417
+ description: "Calculate properties of an I-beam (wide flange) cross-section: area, Ixx, Iyy, Sx, Sy, rx, ry.",
3418
+ inputSchema: {
3419
+ type: "object",
3420
+ properties: {
3421
+ flangeWidth: { type: "number", description: "Flange width in meters" },
3422
+ flangeThickness: { type: "number", description: "Flange thickness in meters" },
3423
+ webHeight: { type: "number", description: "Web height (between flanges) in meters" },
3424
+ webThickness: { type: "number", description: "Web thickness in meters" }
3425
+ },
3426
+ required: ["flangeWidth", "flangeThickness", "webHeight", "webThickness"]
3427
+ },
3428
+ handler: async (args) => {
3429
+ try {
3430
+ const result = agentToolsCore.structural.iBeamSection(args.flangeWidth, args.flangeThickness, args.webHeight, args.webThickness);
3431
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
3432
+ } catch (e) {
3433
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
3434
+ }
3435
+ }
3436
+ },
3437
+ // --- Soils ---
3438
+ {
3439
+ name: "agent_tools_structural_terzaghi_bearing",
3440
+ description: "Calculate Terzaghi's bearing capacity for shallow foundations (strip, square, circular).",
3441
+ inputSchema: {
3442
+ type: "object",
3443
+ properties: {
3444
+ cohesion: { type: "number", description: "Soil cohesion in Pa" },
3445
+ depth: { type: "number", description: "Foundation depth in meters" },
3446
+ unitWeight: { type: "number", description: "Soil unit weight in N/m\xB3" },
3447
+ frictionAngle: { type: "number", description: "Soil friction angle in degrees" },
3448
+ foundationType: { type: "string", enum: ["strip", "square", "circular"], description: "Foundation shape" }
3449
+ },
3450
+ required: ["cohesion", "depth", "unitWeight", "frictionAngle", "foundationType"]
3451
+ },
3452
+ handler: async (args) => {
3453
+ try {
3454
+ const result = agentToolsCore.structural.terzaghiBearing(args.cohesion, args.depth, args.unitWeight, args.frictionAngle, args.foundationType);
3455
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
3456
+ } catch (e) {
3457
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
3458
+ }
3459
+ }
3460
+ },
3461
+ {
3462
+ name: "agent_tools_structural_lateral_earth_pressure",
3463
+ description: "Calculate Rankine lateral earth pressure coefficients and forces (active, passive, at-rest).",
3464
+ inputSchema: {
3465
+ type: "object",
3466
+ properties: {
3467
+ unitWeight: { type: "number", description: "Soil unit weight in N/m\xB3" },
3468
+ height: { type: "number", description: "Wall/excavation height in meters" },
3469
+ frictionAngle: { type: "number", description: "Soil friction angle in degrees" },
3470
+ pressureType: { type: "string", enum: ["active", "passive", "at-rest"], description: "Type of earth pressure" }
3471
+ },
3472
+ required: ["unitWeight", "height", "frictionAngle", "pressureType"]
3473
+ },
3474
+ handler: async (args) => {
3475
+ try {
3476
+ const result = agentToolsCore.structural.lateralEarthPressure(args.unitWeight, args.height, args.frictionAngle, args.pressureType);
3477
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
3478
+ } catch (e) {
3479
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
3480
+ }
3481
+ }
3482
+ },
3483
+ {
3484
+ name: "agent_tools_structural_settlement",
3485
+ description: "Calculate elastic settlement (\u03B4 = qH/E) for foundations.",
3486
+ inputSchema: {
3487
+ type: "object",
3488
+ properties: {
3489
+ load: { type: "number", description: "Applied load in Newtons" },
3490
+ area: { type: "number", description: "Foundation area in m\xB2" },
3491
+ elasticModulus: { type: "number", description: "Soil elastic modulus in Pa" },
3492
+ thickness: { type: "number", description: "Compressible layer thickness in meters" }
3493
+ },
3494
+ required: ["load", "area", "elasticModulus", "thickness"]
3495
+ },
3496
+ handler: async (args) => {
3497
+ try {
3498
+ const result = agentToolsCore.structural.settlement(args.load, args.area, args.elasticModulus, args.thickness);
3499
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
3500
+ } catch (e) {
3501
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
3502
+ }
3503
+ }
3504
+ },
3505
+ // --- Materials ---
3506
+ {
3507
+ name: "agent_tools_structural_get_material",
3508
+ description: "Look up structural material properties (E, fy, fu, density, Poisson ratio, thermal expansion) by name.",
3509
+ inputSchema: {
3510
+ type: "object",
3511
+ properties: {
3512
+ name: { type: "string", description: "Material name (e.g., A36, A992, 304, 6061, C30, Douglas Fir)" }
3513
+ },
3514
+ required: ["name"]
3515
+ },
3516
+ handler: async (args) => {
3517
+ try {
3518
+ const result = agentToolsCore.structural.getMaterial(args.name);
3519
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
3520
+ } catch (e) {
3521
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
3522
+ }
3523
+ }
3524
+ },
3525
+ {
3526
+ name: "agent_tools_structural_list_materials",
3527
+ description: "List structural materials, optionally filtered by category (steel, aluminum, concrete, timber, other).",
3528
+ inputSchema: {
3529
+ type: "object",
3530
+ properties: {
3531
+ category: { type: "string", description: "Filter by category: steel, aluminum, concrete, timber, other" }
3532
+ },
3533
+ required: []
3534
+ },
3535
+ handler: async (args) => {
3536
+ try {
3537
+ const result = agentToolsCore.structural.listMaterials(args.category);
3538
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
3539
+ } catch (e) {
3540
+ return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] };
3541
+ }
3542
+ }
3543
+ }
3544
+ ];
3545
+
3546
+ // src/tools/index.ts
3547
+ var allTools = [
3548
+ ...jsonTools,
3549
+ ...csvTools,
3550
+ ...pdfTools,
3551
+ ...xmlTools,
3552
+ ...excelTools,
3553
+ ...imageTools,
3554
+ ...markdownTools,
3555
+ ...archiveTools,
3556
+ ...regexTools,
3557
+ ...diffTools,
3558
+ ...sqlTools,
3559
+ ...cryptoMcpTools,
3560
+ ...datetimeTools,
3561
+ ...textTools,
3562
+ ...mathTools,
3563
+ ...colorTools,
3564
+ ...physicsTools,
3565
+ ...structuralTools
3566
+ ];
3567
+
3568
+ // src/server.ts
3569
+ function getToolCategory(toolName) {
3570
+ const match = toolName.match(/^agent_tools_([a-z]+)_/);
3571
+ return match ? match[1] : null;
3572
+ }
3573
+ function createServer() {
3574
+ const server = new index_js.Server(
3575
+ {
3576
+ name: "agent-tools",
3577
+ version: "1.0.0"
3578
+ },
3579
+ {
3580
+ capabilities: {
3581
+ tools: {}
3582
+ }
3583
+ }
3584
+ );
3585
+ server.setRequestHandler(types_js.ListToolsRequestSchema, async () => {
3586
+ const settings$1 = await settings.settingsService.getSettings();
3587
+ const enabledTools = allTools.filter((tool) => {
3588
+ const category = getToolCategory(tool.name);
3589
+ return !category || settings$1.enabled[category] !== false;
3590
+ });
3591
+ return {
3592
+ tools: enabledTools.map((tool) => ({
3593
+ name: tool.name,
3594
+ description: tool.description,
3595
+ inputSchema: tool.inputSchema
3596
+ }))
3597
+ };
3598
+ });
3599
+ server.setRequestHandler(types_js.CallToolRequestSchema, async (request) => {
3600
+ const { name, arguments: args } = request.params;
3601
+ const category = getToolCategory(name);
3602
+ if (category) {
3603
+ const enabled = await settings.settingsService.isToolEnabled(category);
3604
+ if (!enabled) {
3605
+ return {
3606
+ content: [
3607
+ {
3608
+ type: "text",
3609
+ text: `Error: The "${category}" tool category is currently disabled. Enable it in Settings.`
3610
+ }
3611
+ ],
3612
+ isError: true
3613
+ };
3614
+ }
3615
+ }
3616
+ const tool = allTools.find((t) => t.name === name);
3617
+ if (!tool) {
3618
+ throw new Error(`Unknown tool: ${name}`);
3619
+ }
3620
+ try {
3621
+ const result = await tool.handler(args);
3622
+ return result;
3623
+ } catch (error) {
3624
+ return {
3625
+ content: [
3626
+ {
3627
+ type: "text",
3628
+ text: `Error: ${error.message}`
3629
+ }
3630
+ ],
3631
+ isError: true
3632
+ };
3633
+ }
3634
+ });
3635
+ return server;
3636
+ }
3637
+ async function runStdioServer() {
3638
+ const server = createServer();
3639
+ const transport = new stdio_js.StdioServerTransport();
3640
+ await server.connect(transport);
3641
+ }
3642
+ function createHttpServer(port = 3001) {
3643
+ const app = express__default.default();
3644
+ app.use(express__default.default.json({ limit: "50mb" }));
3645
+ app.use((_req, res, next) => {
3646
+ res.header("Access-Control-Allow-Origin", "*");
3647
+ res.header("Access-Control-Allow-Methods", "GET, POST, OPTIONS");
3648
+ res.header("Access-Control-Allow-Headers", "Content-Type");
3649
+ next();
3650
+ });
3651
+ app.options("*", (_req, res) => {
3652
+ res.sendStatus(200);
3653
+ });
3654
+ app.get("/health", (_req, res) => {
3655
+ res.json({ status: "ok", server: "agent-tools-mcp", version: "1.0.0" });
3656
+ });
3657
+ app.post("/mcp", async (req, res) => {
3658
+ const request = req.body;
3659
+ if (request.jsonrpc !== "2.0") {
3660
+ return res.status(400).json({
3661
+ jsonrpc: "2.0",
3662
+ id: request.id,
3663
+ error: { code: -32600, message: "Invalid Request" }
3664
+ });
3665
+ }
3666
+ try {
3667
+ const result = await handleRequest(request);
3668
+ res.json(result);
3669
+ } catch (error) {
3670
+ res.json({
3671
+ jsonrpc: "2.0",
3672
+ id: request.id,
3673
+ error: {
3674
+ code: -32603,
3675
+ message: error.message
3676
+ }
3677
+ });
3678
+ }
3679
+ });
3680
+ app.post("/mcp/stream", async (req, res) => {
3681
+ const request = req.body;
3682
+ res.setHeader("Content-Type", "text/event-stream");
3683
+ res.setHeader("Cache-Control", "no-cache");
3684
+ res.setHeader("Connection", "keep-alive");
3685
+ try {
3686
+ res.write(`event: start
3687
+ `);
3688
+ res.write(`data: ${JSON.stringify({ id: request.id })}
3689
+
3690
+ `);
3691
+ const result = await handleRequest(request);
3692
+ res.write(`event: result
3693
+ `);
3694
+ res.write(`data: ${JSON.stringify(result)}
3695
+
3696
+ `);
3697
+ res.write(`event: end
3698
+ `);
3699
+ res.write(`data: {}
3700
+
3701
+ `);
3702
+ res.end();
3703
+ } catch (error) {
3704
+ res.write(`event: error
3705
+ `);
3706
+ res.write(
3707
+ `data: ${JSON.stringify({ error: error.message })}
3708
+
3709
+ `
3710
+ );
3711
+ res.end();
3712
+ }
3713
+ });
3714
+ app.get("/tools", (_req, res) => {
3715
+ res.json({
3716
+ tools: allTools.map((tool) => ({
3717
+ name: tool.name,
3718
+ description: tool.description,
3719
+ inputSchema: tool.inputSchema
3720
+ }))
3721
+ });
3722
+ });
3723
+ return app.listen(port, () => {
3724
+ console.log(`Agent Tools MCP HTTP server running on port ${port}`);
3725
+ console.log(`Endpoints:`);
3726
+ console.log(` POST /mcp - JSON-RPC endpoint`);
3727
+ console.log(` POST /mcp/stream - Streaming endpoint`);
3728
+ console.log(` GET /tools - List available tools`);
3729
+ console.log(` GET /health - Health check`);
3730
+ });
3731
+ }
3732
+ async function handleRequest(request) {
3733
+ const { method, params, id } = request;
3734
+ switch (method) {
3735
+ case "tools/list":
3736
+ return {
3737
+ jsonrpc: "2.0",
3738
+ id,
3739
+ result: {
3740
+ tools: allTools.map((tool) => ({
3741
+ name: tool.name,
3742
+ description: tool.description,
3743
+ inputSchema: tool.inputSchema
3744
+ }))
3745
+ }
3746
+ };
3747
+ case "tools/call": {
3748
+ const { name, arguments: args } = params;
3749
+ const tool = allTools.find((t) => t.name === name);
3750
+ if (!tool) {
3751
+ return {
3752
+ jsonrpc: "2.0",
3753
+ id,
3754
+ error: { code: -32601, message: `Unknown tool: ${name}` }
3755
+ };
3756
+ }
3757
+ try {
3758
+ const result = await tool.handler(args);
3759
+ return { jsonrpc: "2.0", id, result };
3760
+ } catch (error) {
3761
+ return {
3762
+ jsonrpc: "2.0",
3763
+ id,
3764
+ error: { code: -32603, message: error.message }
3765
+ };
3766
+ }
3767
+ }
3768
+ case "initialize":
3769
+ return {
3770
+ jsonrpc: "2.0",
3771
+ id,
3772
+ result: {
3773
+ protocolVersion: "2024-11-05",
3774
+ serverInfo: {
3775
+ name: "agent-tools",
3776
+ version: "1.0.0"
3777
+ },
3778
+ capabilities: {
3779
+ tools: {}
3780
+ }
3781
+ }
3782
+ };
3783
+ default:
3784
+ return {
3785
+ jsonrpc: "2.0",
3786
+ id,
3787
+ error: { code: -32601, message: `Method not found: ${method}` }
3788
+ };
3789
+ }
3790
+ }
3791
+ var clients = /* @__PURE__ */ new Map();
3792
+ function createSSEServer(port = 3001) {
3793
+ const app = express__default.default();
3794
+ app.use(express__default.default.json({ limit: "50mb" }));
3795
+ app.use((_req, res, next) => {
3796
+ res.header("Access-Control-Allow-Origin", "*");
3797
+ res.header("Access-Control-Allow-Methods", "GET, POST, OPTIONS");
3798
+ res.header("Access-Control-Allow-Headers", "Content-Type");
3799
+ next();
3800
+ });
3801
+ app.get("/health", (_req, res) => {
3802
+ res.json({ status: "ok", server: "agent-tools-mcp-sse", version: "1.0.0" });
3803
+ });
3804
+ app.get("/sse", (req, res) => {
3805
+ const clientId = Math.random().toString(36).substring(7);
3806
+ res.setHeader("Content-Type", "text/event-stream");
3807
+ res.setHeader("Cache-Control", "no-cache");
3808
+ res.setHeader("Connection", "keep-alive");
3809
+ res.write(`event: connected
3810
+ `);
3811
+ res.write(`data: ${JSON.stringify({ clientId })}
3812
+
3813
+ `);
3814
+ res.write(`event: endpoint
3815
+ `);
3816
+ res.write(`data: ${JSON.stringify({ endpoint: `/message?clientId=${clientId}` })}
3817
+
3818
+ `);
3819
+ clients.set(clientId, { id: clientId, res });
3820
+ req.on("close", () => {
3821
+ clients.delete(clientId);
3822
+ });
3823
+ });
3824
+ app.post("/message", async (req, res) => {
3825
+ const clientId = req.query.clientId;
3826
+ const client = clients.get(clientId);
3827
+ if (!client) {
3828
+ return res.status(404).json({ error: "Client not found" });
3829
+ }
3830
+ const { method, params, id } = req.body;
3831
+ try {
3832
+ let result;
3833
+ switch (method) {
3834
+ case "tools/list":
3835
+ result = {
3836
+ tools: allTools.map((tool) => ({
3837
+ name: tool.name,
3838
+ description: tool.description,
3839
+ inputSchema: tool.inputSchema
3840
+ }))
3841
+ };
3842
+ break;
3843
+ case "tools/call": {
3844
+ const { name, arguments: args } = params;
3845
+ const tool = allTools.find((t) => t.name === name);
3846
+ if (!tool) {
3847
+ throw new Error(`Unknown tool: ${name}`);
3848
+ }
3849
+ result = await tool.handler(args);
3850
+ break;
3851
+ }
3852
+ case "initialize":
3853
+ result = {
3854
+ protocolVersion: "2024-11-05",
3855
+ serverInfo: {
3856
+ name: "agent-tools",
3857
+ version: "1.0.0"
3858
+ },
3859
+ capabilities: {
3860
+ tools: {}
3861
+ }
3862
+ };
3863
+ break;
3864
+ default:
3865
+ throw new Error(`Unknown method: ${method}`);
3866
+ }
3867
+ client.res.write(`event: message
3868
+ `);
3869
+ client.res.write(
3870
+ `data: ${JSON.stringify({ jsonrpc: "2.0", id, result })}
3871
+
3872
+ `
3873
+ );
3874
+ res.json({ status: "sent" });
3875
+ } catch (error) {
3876
+ client.res.write(`event: message
3877
+ `);
3878
+ client.res.write(
3879
+ `data: ${JSON.stringify({
3880
+ jsonrpc: "2.0",
3881
+ id,
3882
+ error: { code: -32603, message: error.message }
3883
+ })}
3884
+
3885
+ `
3886
+ );
3887
+ res.json({ status: "error", error: error.message });
3888
+ }
3889
+ });
3890
+ app.get("/tools", (_req, res) => {
3891
+ res.json({
3892
+ tools: allTools.map((tool) => ({
3893
+ name: tool.name,
3894
+ description: tool.description,
3895
+ inputSchema: tool.inputSchema
3896
+ }))
3897
+ });
3898
+ });
3899
+ return app.listen(port, () => {
3900
+ console.log(`Agent Tools MCP SSE server running on port ${port}`);
3901
+ console.log(`Endpoints:`);
3902
+ console.log(` GET /sse - SSE connection`);
3903
+ console.log(` POST /message - Send message (requires clientId)`);
3904
+ console.log(` GET /tools - List available tools`);
3905
+ console.log(` GET /health - Health check`);
3906
+ });
3907
+ }
3908
+
3909
+ // src/cli.ts
3910
+ var program = new commander.Command();
3911
+ program.name("agent-tools-mcp").description("Agent Tools MCP Server - Deterministic data transformation tools").version("1.0.0");
3912
+ program.option("-t, --transport <type>", "Transport type: stdio, sse, http", "stdio").option("-p, --port <number>", "Port for HTTP/SSE transport", "3001").action(async (options) => {
3913
+ const { transport, port } = options;
3914
+ console.log(`Starting Agent Tools MCP server...`);
3915
+ console.log(`Transport: ${transport}`);
3916
+ switch (transport) {
3917
+ case "stdio":
3918
+ await runStdioServer();
3919
+ break;
3920
+ case "http":
3921
+ createHttpServer(parseInt(port, 10));
3922
+ break;
3923
+ case "sse":
3924
+ createSSEServer(parseInt(port, 10));
3925
+ break;
3926
+ default:
3927
+ console.error(`Unknown transport: ${transport}`);
3928
+ process.exit(1);
3929
+ }
3930
+ });
3931
+ program.parse();
3932
+ //# sourceMappingURL=cli.js.map
3933
+ //# sourceMappingURL=cli.js.map