converteverything-mcp 1.2.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -11
- package/dist/client.d.ts +72 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +280 -0
- package/dist/client.js.map +1 -1
- package/dist/index.js +594 -5
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +99 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +18 -15
- package/dist/types.js.map +1 -1
- package/package.json +9 -3
package/dist/index.js
CHANGED
|
@@ -54,7 +54,7 @@ const types_js_2 = require("./types.js");
|
|
|
54
54
|
// ============================================================================
|
|
55
55
|
// Package Info
|
|
56
56
|
// ============================================================================
|
|
57
|
-
const PACKAGE_VERSION = "
|
|
57
|
+
const PACKAGE_VERSION = "2.0.0";
|
|
58
58
|
const PACKAGE_NAME = "converteverything-mcp";
|
|
59
59
|
function parseArgs() {
|
|
60
60
|
const args = process.argv.slice(2);
|
|
@@ -89,7 +89,7 @@ function showHelp() {
|
|
|
89
89
|
console.log(`
|
|
90
90
|
${PACKAGE_NAME} v${PACKAGE_VERSION}
|
|
91
91
|
|
|
92
|
-
MCP server for ConvertEverything.io - Convert files between
|
|
92
|
+
MCP server for ConvertEverything.io - Convert files between 100+ formats
|
|
93
93
|
|
|
94
94
|
USAGE:
|
|
95
95
|
npx ${PACKAGE_NAME} [OPTIONS]
|
|
@@ -187,13 +187,75 @@ const EstimateOutputSizeSchema = zod_1.z.object({
|
|
|
187
187
|
options: zod_1.z.record(zod_1.z.unknown()).optional().describe("Conversion options"),
|
|
188
188
|
preset: zod_1.z.string().optional().describe("Preset name"),
|
|
189
189
|
});
|
|
190
|
+
// New schemas for v2.0 features
|
|
191
|
+
const CompressImageSchema = zod_1.z.object({
|
|
192
|
+
file_path: zod_1.z.string().min(1).describe("Path to the image file"),
|
|
193
|
+
quality: zod_1.z.number().min(1).max(100).optional().describe("Output quality 1-100 (default: 80)"),
|
|
194
|
+
max_dimension: zod_1.z.number().optional().describe("Max width/height in pixels"),
|
|
195
|
+
});
|
|
196
|
+
const CompressVideoSchema = zod_1.z.object({
|
|
197
|
+
file_path: zod_1.z.string().min(1).describe("Path to the video file"),
|
|
198
|
+
crf: zod_1.z.number().min(0).max(51).optional().describe("Quality 0-51 (default: 28, lower = better)"),
|
|
199
|
+
preset: zod_1.z.string().optional().describe("Encoding preset: ultrafast, fast, medium, slow, veryslow"),
|
|
200
|
+
max_resolution: zod_1.z.string().optional().describe("Max resolution (e.g., '1920x1080', '720p')"),
|
|
201
|
+
remove_audio: zod_1.z.boolean().optional().describe("Remove audio track"),
|
|
202
|
+
});
|
|
203
|
+
const CompressPdfSchema = zod_1.z.object({
|
|
204
|
+
file_path: zod_1.z.string().min(1).describe("Path to the PDF file"),
|
|
205
|
+
quality: zod_1.z.enum(["low", "medium", "high"]).optional().describe("Compression quality (default: medium)"),
|
|
206
|
+
});
|
|
207
|
+
const CreateArchiveSchema = zod_1.z.object({
|
|
208
|
+
file_paths: zod_1.z.array(zod_1.z.string().min(1)).min(1).max(100).describe("Array of file paths to archive"),
|
|
209
|
+
output_format: zod_1.z.enum(["zip", "tar", "tar.gz", "tar.bz2", "7z"]).optional().describe("Archive format (default: zip)"),
|
|
210
|
+
archive_name: zod_1.z.string().optional().describe("Output filename (default: archive)"),
|
|
211
|
+
compression_level: zod_1.z.number().min(1).max(9).optional().describe("Compression level 1-9 (default: 6)"),
|
|
212
|
+
});
|
|
213
|
+
const ReconvertSchema = zod_1.z.object({
|
|
214
|
+
conversion_id: zod_1.z.string().uuid().describe("ID of the original conversion"),
|
|
215
|
+
target_format: zod_1.z.string().min(1).max(10).describe("New target format"),
|
|
216
|
+
options: zod_1.z.record(zod_1.z.unknown()).optional().describe("New conversion options"),
|
|
217
|
+
});
|
|
218
|
+
const GetThumbnailSchema = zod_1.z.object({
|
|
219
|
+
conversion_id: zod_1.z.string().uuid().describe("The conversion ID"),
|
|
220
|
+
save_path: zod_1.z.string().optional().describe("Optional path to save the thumbnail"),
|
|
221
|
+
});
|
|
222
|
+
const TrueBatchConvertSchema = zod_1.z.object({
|
|
223
|
+
file_paths: zod_1.z.array(zod_1.z.string().min(1)).min(1).max(50).describe("Array of file paths"),
|
|
224
|
+
target_format: zod_1.z.string().min(1).max(10).describe("Target format for all files"),
|
|
225
|
+
options: zod_1.z.record(zod_1.z.unknown()).optional().describe("Shared conversion options"),
|
|
226
|
+
});
|
|
227
|
+
const GetBatchStatusSchema = zod_1.z.object({
|
|
228
|
+
batch_id: zod_1.z.string().uuid().describe("The batch ID"),
|
|
229
|
+
});
|
|
230
|
+
const ListMyFilesSchema = zod_1.z.object({
|
|
231
|
+
page: zod_1.z.number().optional().describe("Page number (default: 1)"),
|
|
232
|
+
per_page: zod_1.z.number().optional().describe("Items per page (default: 20, max: 100)"),
|
|
233
|
+
});
|
|
234
|
+
const CreateShareLinkSchema = zod_1.z.object({
|
|
235
|
+
conversion_id: zod_1.z.string().uuid().describe("The conversion ID to share"),
|
|
236
|
+
});
|
|
237
|
+
const ShareViaEmailSchema = zod_1.z.object({
|
|
238
|
+
short_id: zod_1.z.string().min(1).describe("The short ID of the shareable file"),
|
|
239
|
+
recipient_email: zod_1.z.string().email().describe("Email address to send to"),
|
|
240
|
+
message: zod_1.z.string().optional().describe("Optional message to include"),
|
|
241
|
+
});
|
|
242
|
+
const ListCloudFilesSchema = zod_1.z.object({
|
|
243
|
+
provider: zod_1.z.enum(["google_drive", "dropbox", "onedrive", "box"]).describe("Cloud provider"),
|
|
244
|
+
folder_id: zod_1.z.string().optional().describe("Folder ID (root if not specified)"),
|
|
245
|
+
page_token: zod_1.z.string().optional().describe("Pagination token"),
|
|
246
|
+
});
|
|
247
|
+
const ImportFromCloudSchema = zod_1.z.object({
|
|
248
|
+
provider: zod_1.z.enum(["google_drive", "dropbox", "onedrive", "box"]).describe("Cloud provider"),
|
|
249
|
+
file_id: zod_1.z.string().min(1).describe("File ID from cloud provider"),
|
|
250
|
+
file_name: zod_1.z.string().min(1).describe("File name"),
|
|
251
|
+
});
|
|
190
252
|
// ============================================================================
|
|
191
253
|
// Tool Definitions
|
|
192
254
|
// ============================================================================
|
|
193
255
|
const TOOLS = [
|
|
194
256
|
{
|
|
195
257
|
name: "get_supported_formats",
|
|
196
|
-
description: "Get a list of all supported file formats for conversion, organized by category " +
|
|
258
|
+
description: "Get a list of all 100+ supported file formats for conversion, organized by category " +
|
|
197
259
|
"(audio, video, image, document, ebook, data, 3d, font, archive, cad).",
|
|
198
260
|
inputSchema: {
|
|
199
261
|
type: "object",
|
|
@@ -223,7 +285,7 @@ const TOOLS = [
|
|
|
223
285
|
},
|
|
224
286
|
{
|
|
225
287
|
name: "convert_file",
|
|
226
|
-
description: "Convert a file from one format to another. Supports
|
|
288
|
+
description: "Convert a file from one format to another. Supports 100+ formats. " +
|
|
227
289
|
"Use 'preset' for quick settings or 'options' for fine-grained control.",
|
|
228
290
|
inputSchema: {
|
|
229
291
|
type: "object",
|
|
@@ -361,6 +423,218 @@ const TOOLS = [
|
|
|
361
423
|
required: ["file_path", "target_format"],
|
|
362
424
|
},
|
|
363
425
|
},
|
|
426
|
+
// ========== Compression Tools (v2.0) ==========
|
|
427
|
+
{
|
|
428
|
+
name: "compress_image",
|
|
429
|
+
description: "Compress an image file. Reduces file size while maintaining quality. " +
|
|
430
|
+
"Supports JPG, PNG, WebP, TIFF, BMP.",
|
|
431
|
+
inputSchema: {
|
|
432
|
+
type: "object",
|
|
433
|
+
properties: {
|
|
434
|
+
file_path: { type: "string", description: "Path to the image file" },
|
|
435
|
+
quality: { type: "number", description: "Output quality 1-100 (default: 80)" },
|
|
436
|
+
max_dimension: { type: "number", description: "Max width/height in pixels" },
|
|
437
|
+
},
|
|
438
|
+
required: ["file_path"],
|
|
439
|
+
},
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
name: "compress_video",
|
|
443
|
+
description: "Compress a video file. Reduces file size with configurable quality. " +
|
|
444
|
+
"Supports MP4, AVI, MKV, MOV, WebM, and more.",
|
|
445
|
+
inputSchema: {
|
|
446
|
+
type: "object",
|
|
447
|
+
properties: {
|
|
448
|
+
file_path: { type: "string", description: "Path to the video file" },
|
|
449
|
+
crf: { type: "number", description: "Quality 0-51 (default: 28, lower = better)" },
|
|
450
|
+
preset: { type: "string", description: "Encoding preset: ultrafast, fast, medium, slow, veryslow" },
|
|
451
|
+
max_resolution: { type: "string", description: "Max resolution (e.g., '1920x1080', '720p')" },
|
|
452
|
+
remove_audio: { type: "boolean", description: "Remove audio track" },
|
|
453
|
+
},
|
|
454
|
+
required: ["file_path"],
|
|
455
|
+
},
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
name: "compress_pdf",
|
|
459
|
+
description: "Compress a PDF file. Reduces file size with configurable quality levels.",
|
|
460
|
+
inputSchema: {
|
|
461
|
+
type: "object",
|
|
462
|
+
properties: {
|
|
463
|
+
file_path: { type: "string", description: "Path to the PDF file" },
|
|
464
|
+
quality: { type: "string", description: "Compression quality: low, medium, high (default: medium)" },
|
|
465
|
+
},
|
|
466
|
+
required: ["file_path"],
|
|
467
|
+
},
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
name: "get_compression_usage",
|
|
471
|
+
description: "Get your compression usage statistics and limits.",
|
|
472
|
+
inputSchema: {
|
|
473
|
+
type: "object",
|
|
474
|
+
properties: {},
|
|
475
|
+
required: [],
|
|
476
|
+
},
|
|
477
|
+
},
|
|
478
|
+
// ========== Archive Tools (v2.0) ==========
|
|
479
|
+
{
|
|
480
|
+
name: "create_archive",
|
|
481
|
+
description: "Create an archive (ZIP, TAR, 7z) from multiple files. " +
|
|
482
|
+
"Useful for bundling files for download or backup.",
|
|
483
|
+
inputSchema: {
|
|
484
|
+
type: "object",
|
|
485
|
+
properties: {
|
|
486
|
+
file_paths: {
|
|
487
|
+
type: "array",
|
|
488
|
+
items: { type: "string" },
|
|
489
|
+
description: "Array of file paths to include in archive",
|
|
490
|
+
},
|
|
491
|
+
output_format: { type: "string", description: "Archive format: zip, tar, tar.gz, tar.bz2, 7z (default: zip)" },
|
|
492
|
+
archive_name: { type: "string", description: "Output filename (default: archive)" },
|
|
493
|
+
compression_level: { type: "number", description: "Compression level 1-9 (default: 6)" },
|
|
494
|
+
},
|
|
495
|
+
required: ["file_paths"],
|
|
496
|
+
},
|
|
497
|
+
},
|
|
498
|
+
// ========== Advanced Conversion (v2.0) ==========
|
|
499
|
+
{
|
|
500
|
+
name: "reconvert",
|
|
501
|
+
description: "Re-convert an existing conversion to a different format or with new options. " +
|
|
502
|
+
"Uses the original uploaded file without needing to upload again.",
|
|
503
|
+
inputSchema: {
|
|
504
|
+
type: "object",
|
|
505
|
+
properties: {
|
|
506
|
+
conversion_id: { type: "string", description: "ID of the original conversion" },
|
|
507
|
+
target_format: { type: "string", description: "New target format" },
|
|
508
|
+
options: { type: "object", description: "New conversion options" },
|
|
509
|
+
},
|
|
510
|
+
required: ["conversion_id", "target_format"],
|
|
511
|
+
},
|
|
512
|
+
},
|
|
513
|
+
{
|
|
514
|
+
name: "get_thumbnail",
|
|
515
|
+
description: "Get a thumbnail image for a conversion. Useful for previewing converted files.",
|
|
516
|
+
inputSchema: {
|
|
517
|
+
type: "object",
|
|
518
|
+
properties: {
|
|
519
|
+
conversion_id: { type: "string", description: "The conversion ID" },
|
|
520
|
+
save_path: { type: "string", description: "Optional path to save the thumbnail" },
|
|
521
|
+
},
|
|
522
|
+
required: ["conversion_id"],
|
|
523
|
+
},
|
|
524
|
+
},
|
|
525
|
+
{
|
|
526
|
+
name: "batch_convert_api",
|
|
527
|
+
description: "Convert multiple files using the true batch API endpoint. " +
|
|
528
|
+
"More efficient than sequential conversions for multiple files.",
|
|
529
|
+
inputSchema: {
|
|
530
|
+
type: "object",
|
|
531
|
+
properties: {
|
|
532
|
+
file_paths: {
|
|
533
|
+
type: "array",
|
|
534
|
+
items: { type: "string" },
|
|
535
|
+
description: "Array of file paths to convert",
|
|
536
|
+
},
|
|
537
|
+
target_format: { type: "string", description: "Target format for all files" },
|
|
538
|
+
options: { type: "object", description: "Shared conversion options" },
|
|
539
|
+
},
|
|
540
|
+
required: ["file_paths", "target_format"],
|
|
541
|
+
},
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
name: "get_batch_status",
|
|
545
|
+
description: "Get the status of a batch conversion.",
|
|
546
|
+
inputSchema: {
|
|
547
|
+
type: "object",
|
|
548
|
+
properties: {
|
|
549
|
+
batch_id: { type: "string", description: "The batch ID" },
|
|
550
|
+
},
|
|
551
|
+
required: ["batch_id"],
|
|
552
|
+
},
|
|
553
|
+
},
|
|
554
|
+
// ========== File Sharing (v2.0) ==========
|
|
555
|
+
{
|
|
556
|
+
name: "list_my_files",
|
|
557
|
+
description: "List your shareable files. Shows files you've converted that can be shared.",
|
|
558
|
+
inputSchema: {
|
|
559
|
+
type: "object",
|
|
560
|
+
properties: {
|
|
561
|
+
page: { type: "number", description: "Page number (default: 1)" },
|
|
562
|
+
per_page: { type: "number", description: "Items per page (default: 20, max: 100)" },
|
|
563
|
+
},
|
|
564
|
+
required: [],
|
|
565
|
+
},
|
|
566
|
+
},
|
|
567
|
+
{
|
|
568
|
+
name: "create_share_link",
|
|
569
|
+
description: "Create a shareable download link for a converted file.",
|
|
570
|
+
inputSchema: {
|
|
571
|
+
type: "object",
|
|
572
|
+
properties: {
|
|
573
|
+
conversion_id: { type: "string", description: "The conversion ID to share" },
|
|
574
|
+
},
|
|
575
|
+
required: ["conversion_id"],
|
|
576
|
+
},
|
|
577
|
+
},
|
|
578
|
+
{
|
|
579
|
+
name: "share_via_email",
|
|
580
|
+
description: "Share a file by sending a download link via email.",
|
|
581
|
+
inputSchema: {
|
|
582
|
+
type: "object",
|
|
583
|
+
properties: {
|
|
584
|
+
short_id: { type: "string", description: "The short ID of the shareable file" },
|
|
585
|
+
recipient_email: { type: "string", description: "Email address to send to" },
|
|
586
|
+
message: { type: "string", description: "Optional message to include" },
|
|
587
|
+
},
|
|
588
|
+
required: ["short_id", "recipient_email"],
|
|
589
|
+
},
|
|
590
|
+
},
|
|
591
|
+
// ========== Cloud Import (v2.0) ==========
|
|
592
|
+
{
|
|
593
|
+
name: "list_cloud_providers",
|
|
594
|
+
description: "List available cloud storage providers for your tier. " +
|
|
595
|
+
"Bronze+: Google Drive, Dropbox. Gold: OneDrive, Box.",
|
|
596
|
+
inputSchema: {
|
|
597
|
+
type: "object",
|
|
598
|
+
properties: {},
|
|
599
|
+
required: [],
|
|
600
|
+
},
|
|
601
|
+
},
|
|
602
|
+
{
|
|
603
|
+
name: "list_cloud_connections",
|
|
604
|
+
description: "List your connected cloud storage accounts.",
|
|
605
|
+
inputSchema: {
|
|
606
|
+
type: "object",
|
|
607
|
+
properties: {},
|
|
608
|
+
required: [],
|
|
609
|
+
},
|
|
610
|
+
},
|
|
611
|
+
{
|
|
612
|
+
name: "list_cloud_files",
|
|
613
|
+
description: "Browse files in a connected cloud storage account.",
|
|
614
|
+
inputSchema: {
|
|
615
|
+
type: "object",
|
|
616
|
+
properties: {
|
|
617
|
+
provider: { type: "string", description: "Cloud provider: google_drive, dropbox, onedrive, box" },
|
|
618
|
+
folder_id: { type: "string", description: "Folder ID (root if not specified)" },
|
|
619
|
+
page_token: { type: "string", description: "Pagination token for next page" },
|
|
620
|
+
},
|
|
621
|
+
required: ["provider"],
|
|
622
|
+
},
|
|
623
|
+
},
|
|
624
|
+
{
|
|
625
|
+
name: "import_from_cloud",
|
|
626
|
+
description: "Import a file from cloud storage for conversion. " +
|
|
627
|
+
"File will be downloaded and ready for conversion.",
|
|
628
|
+
inputSchema: {
|
|
629
|
+
type: "object",
|
|
630
|
+
properties: {
|
|
631
|
+
provider: { type: "string", description: "Cloud provider: google_drive, dropbox, onedrive, box" },
|
|
632
|
+
file_id: { type: "string", description: "File ID from cloud provider" },
|
|
633
|
+
file_name: { type: "string", description: "File name" },
|
|
634
|
+
},
|
|
635
|
+
required: ["provider", "file_id", "file_name"],
|
|
636
|
+
},
|
|
637
|
+
},
|
|
364
638
|
];
|
|
365
639
|
// ============================================================================
|
|
366
640
|
// Resource Definitions
|
|
@@ -369,7 +643,7 @@ const RESOURCES = [
|
|
|
369
643
|
{
|
|
370
644
|
uri: "converteverything://formats",
|
|
371
645
|
name: "Supported Formats",
|
|
372
|
-
description: "Complete list of all
|
|
646
|
+
description: "Complete list of all 100+ supported file formats by category",
|
|
373
647
|
mimeType: "text/plain",
|
|
374
648
|
},
|
|
375
649
|
{
|
|
@@ -579,6 +853,43 @@ class ConvertEverythingServer {
|
|
|
579
853
|
return await this.handleGetFileInfo(args);
|
|
580
854
|
case "estimate_output_size":
|
|
581
855
|
return await this.handleEstimateOutputSize(args);
|
|
856
|
+
// v2.0 Compression tools
|
|
857
|
+
case "compress_image":
|
|
858
|
+
return await this.handleCompressImage(args);
|
|
859
|
+
case "compress_video":
|
|
860
|
+
return await this.handleCompressVideo(args);
|
|
861
|
+
case "compress_pdf":
|
|
862
|
+
return await this.handleCompressPdf(args);
|
|
863
|
+
case "get_compression_usage":
|
|
864
|
+
return await this.handleGetCompressionUsage();
|
|
865
|
+
// v2.0 Archive tools
|
|
866
|
+
case "create_archive":
|
|
867
|
+
return await this.handleCreateArchive(args);
|
|
868
|
+
// v2.0 Advanced conversion
|
|
869
|
+
case "reconvert":
|
|
870
|
+
return await this.handleReconvert(args);
|
|
871
|
+
case "get_thumbnail":
|
|
872
|
+
return await this.handleGetThumbnail(args);
|
|
873
|
+
case "batch_convert_api":
|
|
874
|
+
return await this.handleBatchConvertApi(args);
|
|
875
|
+
case "get_batch_status":
|
|
876
|
+
return await this.handleGetBatchStatus(args);
|
|
877
|
+
// v2.0 File sharing
|
|
878
|
+
case "list_my_files":
|
|
879
|
+
return await this.handleListMyFiles(args);
|
|
880
|
+
case "create_share_link":
|
|
881
|
+
return await this.handleCreateShareLink(args);
|
|
882
|
+
case "share_via_email":
|
|
883
|
+
return await this.handleShareViaEmail(args);
|
|
884
|
+
// v2.0 Cloud import
|
|
885
|
+
case "list_cloud_providers":
|
|
886
|
+
return await this.handleListCloudProviders();
|
|
887
|
+
case "list_cloud_connections":
|
|
888
|
+
return await this.handleListCloudConnections();
|
|
889
|
+
case "list_cloud_files":
|
|
890
|
+
return await this.handleListCloudFiles(args);
|
|
891
|
+
case "import_from_cloud":
|
|
892
|
+
return await this.handleImportFromCloud(args);
|
|
582
893
|
default:
|
|
583
894
|
throw new Error(`Unknown tool: ${name}`);
|
|
584
895
|
}
|
|
@@ -946,6 +1257,284 @@ class ConvertEverythingServer {
|
|
|
946
1257
|
(estimate.notes ? ` Notes: ${estimate.notes}` : "");
|
|
947
1258
|
return { content: [{ type: "text", text }] };
|
|
948
1259
|
}
|
|
1260
|
+
// ==========================================================================
|
|
1261
|
+
// v2.0 Compression Handlers
|
|
1262
|
+
// ==========================================================================
|
|
1263
|
+
async handleCompressImage(args) {
|
|
1264
|
+
const parsed = CompressImageSchema.parse(args);
|
|
1265
|
+
const client = this.getClient();
|
|
1266
|
+
const options = {};
|
|
1267
|
+
if (parsed.quality !== undefined)
|
|
1268
|
+
options.quality = parsed.quality;
|
|
1269
|
+
if (parsed.max_dimension !== undefined)
|
|
1270
|
+
options.max_dimension = parsed.max_dimension;
|
|
1271
|
+
const result = await client.compressImage(parsed.file_path, options);
|
|
1272
|
+
const text = `Image compression started:\n` +
|
|
1273
|
+
` ID: ${result.id}\n` +
|
|
1274
|
+
` Status: ${result.status}\n` +
|
|
1275
|
+
` File: ${result.original_filename}\n` +
|
|
1276
|
+
(parsed.quality !== undefined ? ` Quality: ${parsed.quality}%\n` : "") +
|
|
1277
|
+
(parsed.max_dimension !== undefined ? ` Max dimension: ${parsed.max_dimension}px\n` : "") +
|
|
1278
|
+
`\nUse wait_for_conversion to wait for completion.`;
|
|
1279
|
+
return { content: [{ type: "text", text }] };
|
|
1280
|
+
}
|
|
1281
|
+
async handleCompressVideo(args) {
|
|
1282
|
+
const parsed = CompressVideoSchema.parse(args);
|
|
1283
|
+
const client = this.getClient();
|
|
1284
|
+
const options = {};
|
|
1285
|
+
if (parsed.crf !== undefined)
|
|
1286
|
+
options.crf = parsed.crf;
|
|
1287
|
+
if (parsed.preset)
|
|
1288
|
+
options.preset = parsed.preset;
|
|
1289
|
+
if (parsed.max_resolution)
|
|
1290
|
+
options.max_resolution = parsed.max_resolution;
|
|
1291
|
+
if (parsed.remove_audio !== undefined)
|
|
1292
|
+
options.remove_audio = parsed.remove_audio;
|
|
1293
|
+
const result = await client.compressVideo(parsed.file_path, options);
|
|
1294
|
+
const text = `Video compression started:\n` +
|
|
1295
|
+
` ID: ${result.id}\n` +
|
|
1296
|
+
` Status: ${result.status}\n` +
|
|
1297
|
+
` File: ${result.original_filename}\n` +
|
|
1298
|
+
(parsed.crf !== undefined ? ` CRF: ${parsed.crf}\n` : "") +
|
|
1299
|
+
(parsed.preset ? ` Preset: ${parsed.preset}\n` : "") +
|
|
1300
|
+
(parsed.max_resolution ? ` Max resolution: ${parsed.max_resolution}\n` : "") +
|
|
1301
|
+
(parsed.remove_audio ? ` Audio: removed\n` : "") +
|
|
1302
|
+
`\nUse wait_for_conversion to wait for completion.`;
|
|
1303
|
+
return { content: [{ type: "text", text }] };
|
|
1304
|
+
}
|
|
1305
|
+
async handleCompressPdf(args) {
|
|
1306
|
+
const parsed = CompressPdfSchema.parse(args);
|
|
1307
|
+
const client = this.getClient();
|
|
1308
|
+
const result = await client.compressPdf(parsed.file_path, parsed.quality);
|
|
1309
|
+
const text = `PDF compression started:\n` +
|
|
1310
|
+
` ID: ${result.id}\n` +
|
|
1311
|
+
` Status: ${result.status}\n` +
|
|
1312
|
+
` File: ${result.original_filename}\n` +
|
|
1313
|
+
(parsed.quality ? ` Quality: ${parsed.quality}\n` : "") +
|
|
1314
|
+
`\nUse wait_for_conversion to wait for completion.`;
|
|
1315
|
+
return { content: [{ type: "text", text }] };
|
|
1316
|
+
}
|
|
1317
|
+
async handleGetCompressionUsage() {
|
|
1318
|
+
const client = this.getClient();
|
|
1319
|
+
const usage = await client.getCompressionUsage();
|
|
1320
|
+
const limitText = usage.compressions_limit === -1
|
|
1321
|
+
? "Unlimited"
|
|
1322
|
+
: usage.compressions_limit.toString();
|
|
1323
|
+
const remainingText = usage.compressions_remaining === -1
|
|
1324
|
+
? "Unlimited"
|
|
1325
|
+
: usage.compressions_remaining.toString();
|
|
1326
|
+
const text = `Compression Usage:\n` +
|
|
1327
|
+
` Tier: ${usage.tier}\n` +
|
|
1328
|
+
` Compressions used: ${usage.compressions_used}\n` +
|
|
1329
|
+
` Limit: ${limitText}\n` +
|
|
1330
|
+
` Remaining: ${remainingText}`;
|
|
1331
|
+
return { content: [{ type: "text", text }] };
|
|
1332
|
+
}
|
|
1333
|
+
// ==========================================================================
|
|
1334
|
+
// v2.0 Archive Handler
|
|
1335
|
+
// ==========================================================================
|
|
1336
|
+
async handleCreateArchive(args) {
|
|
1337
|
+
const parsed = CreateArchiveSchema.parse(args);
|
|
1338
|
+
const client = this.getClient();
|
|
1339
|
+
const options = {};
|
|
1340
|
+
if (parsed.output_format)
|
|
1341
|
+
options.output_format = parsed.output_format;
|
|
1342
|
+
if (parsed.archive_name)
|
|
1343
|
+
options.archive_name = parsed.archive_name;
|
|
1344
|
+
if (parsed.compression_level !== undefined)
|
|
1345
|
+
options.compression_level = parsed.compression_level;
|
|
1346
|
+
const result = await client.createArchive(parsed.file_paths, options);
|
|
1347
|
+
const text = `Archive creation started:\n` +
|
|
1348
|
+
` ID: ${result.id}\n` +
|
|
1349
|
+
` Status: ${result.status}\n` +
|
|
1350
|
+
` Files: ${parsed.file_paths.length}\n` +
|
|
1351
|
+
` Format: ${parsed.output_format || "zip"}\n` +
|
|
1352
|
+
(parsed.archive_name ? ` Name: ${parsed.archive_name}\n` : "") +
|
|
1353
|
+
`\nUse wait_for_conversion to wait for completion.`;
|
|
1354
|
+
return { content: [{ type: "text", text }] };
|
|
1355
|
+
}
|
|
1356
|
+
// ==========================================================================
|
|
1357
|
+
// v2.0 Advanced Conversion Handlers
|
|
1358
|
+
// ==========================================================================
|
|
1359
|
+
async handleReconvert(args) {
|
|
1360
|
+
const parsed = ReconvertSchema.parse(args);
|
|
1361
|
+
const client = this.getClient();
|
|
1362
|
+
const result = await client.reconvert(parsed.conversion_id, parsed.target_format, parsed.options);
|
|
1363
|
+
const text = `Re-conversion started:\n` +
|
|
1364
|
+
` New ID: ${result.id}\n` +
|
|
1365
|
+
` Status: ${result.status}\n` +
|
|
1366
|
+
` Original ID: ${parsed.conversion_id}\n` +
|
|
1367
|
+
` New format: ${parsed.target_format.toUpperCase()}\n` +
|
|
1368
|
+
`\nUse wait_for_conversion to wait for completion.`;
|
|
1369
|
+
return { content: [{ type: "text", text }] };
|
|
1370
|
+
}
|
|
1371
|
+
async handleGetThumbnail(args) {
|
|
1372
|
+
const parsed = GetThumbnailSchema.parse(args);
|
|
1373
|
+
const client = this.getClient();
|
|
1374
|
+
const { data, contentType } = await client.getThumbnail(parsed.conversion_id);
|
|
1375
|
+
if (parsed.save_path) {
|
|
1376
|
+
const savePath = path.resolve(parsed.save_path);
|
|
1377
|
+
fs.writeFileSync(savePath, data);
|
|
1378
|
+
return {
|
|
1379
|
+
content: [{
|
|
1380
|
+
type: "text",
|
|
1381
|
+
text: `Thumbnail saved to: ${savePath}\nSize: ${data.length} bytes\nType: ${contentType}`,
|
|
1382
|
+
}],
|
|
1383
|
+
};
|
|
1384
|
+
}
|
|
1385
|
+
const base64 = data.toString("base64");
|
|
1386
|
+
return {
|
|
1387
|
+
content: [{
|
|
1388
|
+
type: "text",
|
|
1389
|
+
text: `Thumbnail for conversion ${parsed.conversion_id}\nSize: ${data.length} bytes\nType: ${contentType}\nData (base64):\n${base64}`,
|
|
1390
|
+
}],
|
|
1391
|
+
};
|
|
1392
|
+
}
|
|
1393
|
+
async handleBatchConvertApi(args) {
|
|
1394
|
+
const parsed = TrueBatchConvertSchema.parse(args);
|
|
1395
|
+
const client = this.getClient();
|
|
1396
|
+
const result = await client.batchConvert(parsed.file_paths, parsed.target_format, parsed.options);
|
|
1397
|
+
let text = `Batch conversion started:\n` +
|
|
1398
|
+
` Batch ID: ${result.batch_id}\n` +
|
|
1399
|
+
` Total files: ${result.total_files}\n` +
|
|
1400
|
+
` Target format: ${parsed.target_format.toUpperCase()}\n\n`;
|
|
1401
|
+
if (result.conversions && result.conversions.length > 0) {
|
|
1402
|
+
text += `Conversions:\n`;
|
|
1403
|
+
for (const conv of result.conversions) {
|
|
1404
|
+
text += ` ${conv.original_filename} → ${conv.id}\n`;
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
text += `\nUse get_batch_status to check progress.`;
|
|
1408
|
+
return { content: [{ type: "text", text }] };
|
|
1409
|
+
}
|
|
1410
|
+
async handleGetBatchStatus(args) {
|
|
1411
|
+
const parsed = GetBatchStatusSchema.parse(args);
|
|
1412
|
+
const client = this.getClient();
|
|
1413
|
+
const result = await client.getBatchStatus(parsed.batch_id);
|
|
1414
|
+
let text = `Batch Status:\n` +
|
|
1415
|
+
` Batch ID: ${result.batch_id}\n` +
|
|
1416
|
+
` Status: ${result.status}\n` +
|
|
1417
|
+
` Total: ${result.total_files}\n` +
|
|
1418
|
+
` Completed: ${result.completed}\n` +
|
|
1419
|
+
` Failed: ${result.failed}\n\n`;
|
|
1420
|
+
if (result.conversions && result.conversions.length > 0) {
|
|
1421
|
+
text += `Conversions:\n`;
|
|
1422
|
+
for (const conv of result.conversions) {
|
|
1423
|
+
text += ` ${conv.original_filename}: ${conv.status}`;
|
|
1424
|
+
if (conv.error_message)
|
|
1425
|
+
text += ` (${conv.error_message})`;
|
|
1426
|
+
text += "\n";
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
return { content: [{ type: "text", text }] };
|
|
1430
|
+
}
|
|
1431
|
+
// ==========================================================================
|
|
1432
|
+
// v2.0 File Sharing Handlers
|
|
1433
|
+
// ==========================================================================
|
|
1434
|
+
async handleListMyFiles(args) {
|
|
1435
|
+
const parsed = ListMyFilesSchema.parse(args);
|
|
1436
|
+
const client = this.getClient();
|
|
1437
|
+
const result = await client.listMyFiles(parsed.page, parsed.per_page);
|
|
1438
|
+
let text = `Your Files (${result.files.length} of ${result.total}):\n\n`;
|
|
1439
|
+
if (result.files.length === 0) {
|
|
1440
|
+
text += "No shareable files found.";
|
|
1441
|
+
}
|
|
1442
|
+
else {
|
|
1443
|
+
for (const file of result.files) {
|
|
1444
|
+
const sizeKB = (file.size_bytes / 1024).toFixed(1);
|
|
1445
|
+
text += `${file.short_id}: ${file.filename}\n`;
|
|
1446
|
+
text += ` Size: ${sizeKB} KB | Downloads: ${file.download_count}\n`;
|
|
1447
|
+
text += ` Expires: ${file.expires_at}\n\n`;
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
return { content: [{ type: "text", text }] };
|
|
1451
|
+
}
|
|
1452
|
+
async handleCreateShareLink(args) {
|
|
1453
|
+
const parsed = CreateShareLinkSchema.parse(args);
|
|
1454
|
+
const client = this.getClient();
|
|
1455
|
+
const result = await client.createShareLink(parsed.conversion_id);
|
|
1456
|
+
const text = `Share link created:\n` +
|
|
1457
|
+
` Short ID: ${result.short_id}\n` +
|
|
1458
|
+
` Share URL: ${result.share_url}\n` +
|
|
1459
|
+
` Download URL: ${result.download_url}\n` +
|
|
1460
|
+
` Expires: ${result.expires_at}`;
|
|
1461
|
+
return { content: [{ type: "text", text }] };
|
|
1462
|
+
}
|
|
1463
|
+
async handleShareViaEmail(args) {
|
|
1464
|
+
const parsed = ShareViaEmailSchema.parse(args);
|
|
1465
|
+
const client = this.getClient();
|
|
1466
|
+
const result = await client.shareViaEmail(parsed.short_id, parsed.recipient_email, parsed.message);
|
|
1467
|
+
const text = result.success
|
|
1468
|
+
? `✓ ${result.message}`
|
|
1469
|
+
: `✗ ${result.message}`;
|
|
1470
|
+
return { content: [{ type: "text", text }] };
|
|
1471
|
+
}
|
|
1472
|
+
// ==========================================================================
|
|
1473
|
+
// v2.0 Cloud Import Handlers
|
|
1474
|
+
// ==========================================================================
|
|
1475
|
+
async handleListCloudProviders() {
|
|
1476
|
+
const client = this.getClient();
|
|
1477
|
+
const result = await client.listCloudProviders();
|
|
1478
|
+
let text = `Cloud Storage Providers:\n\n`;
|
|
1479
|
+
for (const provider of result.providers) {
|
|
1480
|
+
const status = provider.available ? "✓ Available" : `✗ Requires ${provider.required_tier || "upgrade"}`;
|
|
1481
|
+
text += `${provider.name} (${provider.id})\n`;
|
|
1482
|
+
text += ` ${status}\n\n`;
|
|
1483
|
+
}
|
|
1484
|
+
return { content: [{ type: "text", text }] };
|
|
1485
|
+
}
|
|
1486
|
+
async handleListCloudConnections() {
|
|
1487
|
+
const client = this.getClient();
|
|
1488
|
+
const result = await client.listCloudConnections();
|
|
1489
|
+
if (result.connections.length === 0) {
|
|
1490
|
+
return {
|
|
1491
|
+
content: [{
|
|
1492
|
+
type: "text",
|
|
1493
|
+
text: "No cloud storage accounts connected.\n\nConnect an account at https://converteverything.io/settings",
|
|
1494
|
+
}],
|
|
1495
|
+
};
|
|
1496
|
+
}
|
|
1497
|
+
let text = `Connected Cloud Accounts:\n\n`;
|
|
1498
|
+
for (const conn of result.connections) {
|
|
1499
|
+
text += `${conn.provider}: ${conn.account_email}\n`;
|
|
1500
|
+
text += ` Connected: ${conn.connected_at}\n\n`;
|
|
1501
|
+
}
|
|
1502
|
+
return { content: [{ type: "text", text }] };
|
|
1503
|
+
}
|
|
1504
|
+
async handleListCloudFiles(args) {
|
|
1505
|
+
const parsed = ListCloudFilesSchema.parse(args);
|
|
1506
|
+
const client = this.getClient();
|
|
1507
|
+
const result = await client.listCloudFiles(parsed.provider, parsed.folder_id, parsed.page_token);
|
|
1508
|
+
let text = `Files from ${parsed.provider}:\n\n`;
|
|
1509
|
+
if (result.files.length === 0) {
|
|
1510
|
+
text += "No files found in this folder.";
|
|
1511
|
+
}
|
|
1512
|
+
else {
|
|
1513
|
+
for (const file of result.files) {
|
|
1514
|
+
const icon = file.is_folder ? "📁" : "📄";
|
|
1515
|
+
const sizeStr = file.is_folder ? "" : ` (${(file.size / 1024).toFixed(1)} KB)`;
|
|
1516
|
+
text += `${icon} ${file.name}${sizeStr}\n`;
|
|
1517
|
+
text += ` ID: ${file.id}\n`;
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
if (result.next_page_token) {
|
|
1521
|
+
text += `\nMore files available. Use page_token: "${result.next_page_token}"`;
|
|
1522
|
+
}
|
|
1523
|
+
return { content: [{ type: "text", text }] };
|
|
1524
|
+
}
|
|
1525
|
+
async handleImportFromCloud(args) {
|
|
1526
|
+
const parsed = ImportFromCloudSchema.parse(args);
|
|
1527
|
+
const client = this.getClient();
|
|
1528
|
+
const result = await client.importFromCloud(parsed.provider, parsed.file_id, parsed.file_name);
|
|
1529
|
+
const text = result.success
|
|
1530
|
+
? `✓ File imported successfully!\n` +
|
|
1531
|
+
` File: ${result.file_name}\n` +
|
|
1532
|
+
` Size: ${(result.size / 1024).toFixed(1)} KB\n` +
|
|
1533
|
+
` Object: ${result.object_name}\n\n` +
|
|
1534
|
+
`The file is now available for conversion. Use convert_file with this file path.`
|
|
1535
|
+
: `✗ Failed to import file`;
|
|
1536
|
+
return { content: [{ type: "text", text }] };
|
|
1537
|
+
}
|
|
949
1538
|
handleGetPrompt(name, args) {
|
|
950
1539
|
switch (name) {
|
|
951
1540
|
case "convert-for-web":
|