@i18n-agent/mcp-client 1.7.0 → 1.7.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/mcp-client.js +30 -15
- package/package.json +1 -1
package/mcp-client.js
CHANGED
|
@@ -289,14 +289,20 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
289
289
|
});
|
|
290
290
|
|
|
291
291
|
async function handleTranslateText(args) {
|
|
292
|
-
const { texts, targetLanguage, sourceLanguage, targetAudience = 'general', industry = 'technology', region, context } = args;
|
|
293
|
-
|
|
292
|
+
const { texts, targetLanguage, targetLanguages, sourceLanguage, targetAudience = 'general', industry = 'technology', region, context } = args;
|
|
293
|
+
|
|
294
294
|
if (!texts || !Array.isArray(texts) || texts.length === 0) {
|
|
295
295
|
throw new Error('texts must be a non-empty array');
|
|
296
296
|
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
297
|
+
|
|
298
|
+
// Support both single and multi-language: targetLanguage OR targetLanguages
|
|
299
|
+
if (!targetLanguage && !targetLanguages?.length) {
|
|
300
|
+
throw new Error('Either targetLanguage or targetLanguages must be provided');
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// Ensure both are not provided at the same time
|
|
304
|
+
if (targetLanguage && targetLanguages?.length) {
|
|
305
|
+
throw new Error('Cannot specify both targetLanguage and targetLanguages');
|
|
300
306
|
}
|
|
301
307
|
|
|
302
308
|
// Check if this is a large translation request
|
|
@@ -314,6 +320,7 @@ async function handleTranslateText(args) {
|
|
|
314
320
|
apiKey: API_KEY,
|
|
315
321
|
texts: texts,
|
|
316
322
|
targetLanguage: targetLanguage,
|
|
323
|
+
targetLanguages: targetLanguages,
|
|
317
324
|
sourceLanguage: sourceLanguage && sourceLanguage !== 'auto' ? sourceLanguage : undefined,
|
|
318
325
|
targetAudience: targetAudience,
|
|
319
326
|
industry: industry,
|
|
@@ -567,12 +574,13 @@ async function handleListLanguages(args) {
|
|
|
567
574
|
}
|
|
568
575
|
|
|
569
576
|
async function handleTranslateFile(args) {
|
|
570
|
-
const {
|
|
571
|
-
filePath,
|
|
572
|
-
fileContent,
|
|
573
|
-
fileType = 'auto',
|
|
574
|
-
targetLanguage,
|
|
575
|
-
|
|
577
|
+
const {
|
|
578
|
+
filePath,
|
|
579
|
+
fileContent,
|
|
580
|
+
fileType = 'auto',
|
|
581
|
+
targetLanguage,
|
|
582
|
+
targetLanguages,
|
|
583
|
+
targetAudience = 'general',
|
|
576
584
|
industry = 'technology',
|
|
577
585
|
preserveKeys = true,
|
|
578
586
|
outputFormat = 'same',
|
|
@@ -580,13 +588,19 @@ async function handleTranslateFile(args) {
|
|
|
580
588
|
region,
|
|
581
589
|
context
|
|
582
590
|
} = args;
|
|
583
|
-
|
|
591
|
+
|
|
584
592
|
if (!filePath && !fileContent) {
|
|
585
593
|
throw new Error('Either filePath or fileContent must be provided');
|
|
586
594
|
}
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
595
|
+
|
|
596
|
+
// Support both single and multi-language: targetLanguage OR targetLanguages
|
|
597
|
+
if (!targetLanguage && !targetLanguages?.length) {
|
|
598
|
+
throw new Error('Either targetLanguage or targetLanguages must be provided');
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
// Ensure both are not provided at the same time
|
|
602
|
+
if (targetLanguage && targetLanguages?.length) {
|
|
603
|
+
throw new Error('Cannot specify both targetLanguage and targetLanguages');
|
|
590
604
|
}
|
|
591
605
|
|
|
592
606
|
// Read file content if path provided and no content given
|
|
@@ -616,6 +630,7 @@ async function handleTranslateFile(args) {
|
|
|
616
630
|
fileContent: content,
|
|
617
631
|
fileType,
|
|
618
632
|
targetLanguage,
|
|
633
|
+
targetLanguages,
|
|
619
634
|
sourceLanguage,
|
|
620
635
|
targetAudience,
|
|
621
636
|
industry,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@i18n-agent/mcp-client",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.2",
|
|
4
4
|
"description": "MCP client for i18n-agent translation service with async job support and enhanced progress tracking - supports Claude, Cursor, VS Code, and other AI IDEs",
|
|
5
5
|
"main": "mcp-client.js",
|
|
6
6
|
"bin": {
|