@better-i18n/mcp-server 0.1.5 → 0.2.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 -9
- package/dist/base-tool.d.ts +43 -0
- package/dist/base-tool.d.ts.map +1 -0
- package/dist/base-tool.js +67 -0
- package/dist/base-tool.js.map +1 -0
- package/dist/helpers.d.ts +30 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/helpers.js +32 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index.js +12 -51
- package/dist/index.js.map +1 -1
- package/dist/tools/bulkCreateKeys.d.ts +0 -1
- package/dist/tools/bulkCreateKeys.d.ts.map +1 -1
- package/dist/tools/bulkCreateKeys.js +28 -79
- package/dist/tools/bulkCreateKeys.js.map +1 -1
- package/dist/tools/bulkUpdateTranslations.d.ts +0 -1
- package/dist/tools/bulkUpdateTranslations.d.ts.map +1 -1
- package/dist/tools/bulkUpdateTranslations.js +27 -78
- package/dist/tools/bulkUpdateTranslations.js.map +1 -1
- package/dist/tools/createTranslationKey.d.ts +0 -1
- package/dist/tools/createTranslationKey.d.ts.map +1 -1
- package/dist/tools/createTranslationKey.js +25 -76
- package/dist/tools/createTranslationKey.js.map +1 -1
- package/dist/tools/getProjectInfo.d.ts +0 -1
- package/dist/tools/getProjectInfo.d.ts.map +1 -1
- package/dist/tools/getProjectInfo.js +11 -62
- package/dist/tools/getProjectInfo.js.map +1 -1
- package/dist/tools/listKeys.d.ts +0 -1
- package/dist/tools/listKeys.d.ts.map +1 -1
- package/dist/tools/listKeys.js +17 -67
- package/dist/tools/listKeys.js.map +1 -1
- package/dist/tools/updateTranslation.d.ts +0 -1
- package/dist/tools/updateTranslation.d.ts.map +1 -1
- package/dist/tools/updateTranslation.js +26 -77
- package/dist/tools/updateTranslation.js.map +1 -1
- package/dist/types/index.d.ts +1 -8
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/context.d.ts +0 -23
- package/dist/context.d.ts.map +0 -1
- package/dist/context.js +0 -154
- package/dist/context.js.map +0 -1
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
* bulkUpdateTranslations MCP Tool
|
|
3
3
|
*
|
|
4
4
|
* Updates translations for multiple keys in a single request.
|
|
5
|
-
* Perfect for batch updating translations across multiple languages.
|
|
6
5
|
*/
|
|
7
|
-
import { z } from
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
import { executeTool, projectInputProperty, projectSchema, success, } from "../base-tool.js";
|
|
8
|
+
const inputSchema = projectSchema.extend({
|
|
10
9
|
updates: z.array(z.object({
|
|
11
10
|
key: z.string(),
|
|
12
11
|
namespace: z.string().optional(),
|
|
@@ -16,14 +15,11 @@ const inputSchema = z.object({
|
|
|
16
15
|
export const bulkUpdateTranslations = {
|
|
17
16
|
definition: {
|
|
18
17
|
name: "bulkUpdateTranslations",
|
|
19
|
-
description: "Update translations for multiple keys in a SINGLE efficient request. ALWAYS use this instead of calling updateTranslation multiple times
|
|
18
|
+
description: "Update translations for multiple keys in a SINGLE efficient request. ALWAYS use this instead of calling updateTranslation multiple times when updating 2 or more translations.",
|
|
20
19
|
inputSchema: {
|
|
21
20
|
type: "object",
|
|
22
21
|
properties: {
|
|
23
|
-
|
|
24
|
-
type: "string",
|
|
25
|
-
description: "Project slug (optional if i18n.config.ts exists)",
|
|
26
|
-
},
|
|
22
|
+
...projectInputProperty,
|
|
27
23
|
updates: {
|
|
28
24
|
type: "array",
|
|
29
25
|
description: "Array of translation updates",
|
|
@@ -32,88 +28,41 @@ export const bulkUpdateTranslations = {
|
|
|
32
28
|
properties: {
|
|
33
29
|
key: {
|
|
34
30
|
type: "string",
|
|
35
|
-
description: "Translation key WITHOUT namespace prefix when namespace is provided
|
|
31
|
+
description: "Translation key WITHOUT namespace prefix when namespace is provided.",
|
|
36
32
|
},
|
|
37
33
|
namespace: {
|
|
38
34
|
type: "string",
|
|
39
|
-
description: "Namespace for the key
|
|
35
|
+
description: "Namespace for the key. Defaults to 'default'.",
|
|
40
36
|
},
|
|
41
37
|
translations: {
|
|
42
38
|
type: "object",
|
|
43
|
-
description: "Translations for target languages. Keys are language codes
|
|
39
|
+
description: "Translations for target languages. Keys are language codes, values are translated text.",
|
|
44
40
|
},
|
|
45
41
|
},
|
|
46
42
|
required: ["key", "translations"],
|
|
47
43
|
},
|
|
48
44
|
},
|
|
49
45
|
},
|
|
50
|
-
required: ["updates"],
|
|
46
|
+
required: ["project", "updates"],
|
|
51
47
|
},
|
|
52
48
|
},
|
|
53
|
-
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
content: [
|
|
72
|
-
{
|
|
73
|
-
type: "text",
|
|
74
|
-
text: "Error: Project not specified. Use format 'org/project' (e.g., 'aliosman-co/personal')",
|
|
75
|
-
},
|
|
76
|
-
],
|
|
77
|
-
isError: true,
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
try {
|
|
81
|
-
// Format updates with default namespace
|
|
82
|
-
const formattedUpdates = input.updates.map((u) => ({
|
|
83
|
-
key: u.key,
|
|
84
|
-
namespace: u.namespace || "default",
|
|
85
|
-
translations: u.translations,
|
|
86
|
-
}));
|
|
87
|
-
const result = await client.mcp.bulkUpdateTranslations.mutate({
|
|
88
|
-
orgSlug,
|
|
89
|
-
projectSlug,
|
|
90
|
-
updates: formattedUpdates,
|
|
91
|
-
});
|
|
92
|
-
return {
|
|
93
|
-
content: [
|
|
94
|
-
{
|
|
95
|
-
type: "text",
|
|
96
|
-
text: JSON.stringify({
|
|
97
|
-
success: true,
|
|
98
|
-
project: `${orgSlug}/${projectSlug}`,
|
|
99
|
-
keysUpdated: result.keysUpdated,
|
|
100
|
-
updates: result.updates,
|
|
101
|
-
}, null, 2),
|
|
102
|
-
},
|
|
103
|
-
],
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
catch (error) {
|
|
107
|
-
return {
|
|
108
|
-
content: [
|
|
109
|
-
{
|
|
110
|
-
type: "text",
|
|
111
|
-
text: `Error updating translations: ${error instanceof Error ? error.message : String(error)}`,
|
|
112
|
-
},
|
|
113
|
-
],
|
|
114
|
-
isError: true,
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
},
|
|
49
|
+
execute: (client, args) => executeTool(args, inputSchema, async (input, { workspaceId, projectSlug }) => {
|
|
50
|
+
const formattedUpdates = input.updates.map((u) => ({
|
|
51
|
+
key: u.key,
|
|
52
|
+
namespace: u.namespace || "default",
|
|
53
|
+
translations: u.translations,
|
|
54
|
+
}));
|
|
55
|
+
const result = await client.mcp.bulkUpdateTranslations.mutate({
|
|
56
|
+
orgSlug: workspaceId,
|
|
57
|
+
projectSlug,
|
|
58
|
+
updates: formattedUpdates,
|
|
59
|
+
});
|
|
60
|
+
return success({
|
|
61
|
+
success: true,
|
|
62
|
+
project: input.project,
|
|
63
|
+
keysUpdated: result.keysUpdated,
|
|
64
|
+
updates: result.updates,
|
|
65
|
+
});
|
|
66
|
+
}),
|
|
118
67
|
};
|
|
119
68
|
//# sourceMappingURL=bulkUpdateTranslations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bulkUpdateTranslations.js","sourceRoot":"","sources":["../../src/tools/bulkUpdateTranslations.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"bulkUpdateTranslations.js","sourceRoot":"","sources":["../../src/tools/bulkUpdateTranslations.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,aAAa,EACb,OAAO,GACR,MAAM,iBAAiB,CAAC;AAGzB,MAAM,WAAW,GAAG,aAAa,CAAC,MAAM,CAAC;IACvC,OAAO,EAAE,CAAC,CAAC,KAAK,CACd,CAAC,CAAC,MAAM,CAAC;QACP,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;QACf,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAChC,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;KAC/C,CAAC,CACH;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAS;IAC1C,UAAU,EAAE;QACV,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EACT,gLAAgL;QAClL,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,GAAG,oBAAoB;gBACvB,OAAO,EAAE;oBACP,IAAI,EAAE,OAAO;oBACb,WAAW,EAAE,8BAA8B;oBAC3C,KAAK,EAAE;wBACL,IAAI,EAAE,QAAQ;wBACd,UAAU,EAAE;4BACV,GAAG,EAAE;gCACH,IAAI,EAAE,QAAQ;gCACd,WAAW,EAAE,sEAAsE;6BACpF;4BACD,SAAS,EAAE;gCACT,IAAI,EAAE,QAAQ;gCACd,WAAW,EAAE,+CAA+C;6BAC7D;4BACD,YAAY,EAAE;gCACZ,IAAI,EAAE,QAAQ;gCACd,WAAW,EAAE,yFAAyF;6BACvG;yBACF;wBACD,QAAQ,EAAE,CAAC,KAAK,EAAE,cAAc,CAAC;qBAClC;iBACF;aACF;YACD,QAAQ,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC;SACjC;KACF;IAED,OAAO,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CACxB,WAAW,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE,EAAE,EAAE;QAC3E,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACjD,GAAG,EAAE,CAAC,CAAC,GAAG;YACV,SAAS,EAAE,CAAC,CAAC,SAAS,IAAI,SAAS;YACnC,YAAY,EAAE,CAAC,CAAC,YAAY;SAC7B,CAAC,CAAC,CAAC;QAEJ,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,sBAAsB,CAAC,MAAM,CAAC;YAC5D,OAAO,EAAE,WAAW;YACpB,WAAW;YACX,OAAO,EAAE,gBAAgB;SAC1B,CAAC,CAAC;QAEH,OAAO,OAAO,CAAC;YACb,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,OAAO,EAAE,MAAM,CAAC,OAAO;SACxB,CAAC,CAAC;IACL,CAAC,CAAC;CACL,CAAC"}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* createTranslationKey MCP Tool
|
|
3
3
|
*
|
|
4
4
|
* Creates a new translation key with source text in the default language.
|
|
5
|
-
* Uses the MCP-specific API that works with org/project slugs.
|
|
6
5
|
*/
|
|
7
6
|
import type { Tool } from "../types/index.js";
|
|
8
7
|
export declare const createTranslationKey: Tool;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTranslationKey.d.ts","sourceRoot":"","sources":["../../src/tools/createTranslationKey.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"createTranslationKey.d.ts","sourceRoot":"","sources":["../../src/tools/createTranslationKey.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAQ9C,eAAO,MAAM,oBAAoB,EAAE,IA6ClC,CAAC"}
|
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
* createTranslationKey MCP Tool
|
|
3
3
|
*
|
|
4
4
|
* Creates a new translation key with source text in the default language.
|
|
5
|
-
* Uses the MCP-specific API that works with org/project slugs.
|
|
6
5
|
*/
|
|
7
|
-
import { z } from
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
import { executeTool, projectInputProperty, projectSchema, success, } from "../base-tool.js";
|
|
8
|
+
const inputSchema = projectSchema.extend({
|
|
10
9
|
key: z.string().min(1),
|
|
11
10
|
sourceValue: z.string().min(1),
|
|
12
11
|
namespace: z.string().optional(),
|
|
@@ -14,17 +13,14 @@ const inputSchema = z.object({
|
|
|
14
13
|
export const createTranslationKey = {
|
|
15
14
|
definition: {
|
|
16
15
|
name: "createTranslationKey",
|
|
17
|
-
description: "Create a SINGLE translation key with source text. IMPORTANT: If you need to create 2 or more keys, use bulkCreateKeys instead
|
|
16
|
+
description: "Create a SINGLE translation key with source text. IMPORTANT: If you need to create 2 or more keys, use bulkCreateKeys instead.",
|
|
18
17
|
inputSchema: {
|
|
19
18
|
type: "object",
|
|
20
19
|
properties: {
|
|
21
|
-
|
|
22
|
-
type: "string",
|
|
23
|
-
description: "Project slug (optional if i18n.config.ts exists)",
|
|
24
|
-
},
|
|
20
|
+
...projectInputProperty,
|
|
25
21
|
key: {
|
|
26
22
|
type: "string",
|
|
27
|
-
description: "Translation key WITHOUT namespace prefix when namespace is provided
|
|
23
|
+
description: "Translation key WITHOUT namespace prefix when namespace is provided.",
|
|
28
24
|
},
|
|
29
25
|
sourceValue: {
|
|
30
26
|
type: "string",
|
|
@@ -32,75 +28,28 @@ export const createTranslationKey = {
|
|
|
32
28
|
},
|
|
33
29
|
namespace: {
|
|
34
30
|
type: "string",
|
|
35
|
-
description: "Namespace for the key
|
|
31
|
+
description: "Namespace for the key. Defaults to 'default'.",
|
|
36
32
|
},
|
|
37
33
|
},
|
|
38
|
-
required: ["key", "sourceValue"],
|
|
34
|
+
required: ["project", "key", "sourceValue"],
|
|
39
35
|
},
|
|
40
36
|
},
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return {
|
|
59
|
-
content: [
|
|
60
|
-
{
|
|
61
|
-
type: "text",
|
|
62
|
-
text: "Error: Project not specified. Use format 'org/project' (e.g., 'aliosman-co/personal')",
|
|
63
|
-
},
|
|
64
|
-
],
|
|
65
|
-
isError: true,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
try {
|
|
69
|
-
// Use MCP-specific endpoint with slug-based lookup
|
|
70
|
-
const result = await client.mcp.createKey.mutate({
|
|
71
|
-
orgSlug,
|
|
72
|
-
projectSlug,
|
|
73
|
-
key: input.key,
|
|
74
|
-
namespace: input.namespace || "default",
|
|
75
|
-
sourceText: input.sourceValue,
|
|
76
|
-
});
|
|
77
|
-
return {
|
|
78
|
-
content: [
|
|
79
|
-
{
|
|
80
|
-
type: "text",
|
|
81
|
-
text: JSON.stringify({
|
|
82
|
-
success: true,
|
|
83
|
-
keyId: result.keyId,
|
|
84
|
-
key: input.key,
|
|
85
|
-
namespace: input.namespace || "default",
|
|
86
|
-
sourceText: input.sourceValue,
|
|
87
|
-
project: `${orgSlug}/${projectSlug}`,
|
|
88
|
-
}, null, 2),
|
|
89
|
-
},
|
|
90
|
-
],
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
catch (error) {
|
|
94
|
-
return {
|
|
95
|
-
content: [
|
|
96
|
-
{
|
|
97
|
-
type: "text",
|
|
98
|
-
text: `Error creating translation key: ${error instanceof Error ? error.message : String(error)}`,
|
|
99
|
-
},
|
|
100
|
-
],
|
|
101
|
-
isError: true,
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
},
|
|
37
|
+
execute: (client, args) => executeTool(args, inputSchema, async (input, { workspaceId, projectSlug }) => {
|
|
38
|
+
const result = await client.mcp.createKey.mutate({
|
|
39
|
+
orgSlug: workspaceId,
|
|
40
|
+
projectSlug,
|
|
41
|
+
key: input.key,
|
|
42
|
+
namespace: input.namespace || "default",
|
|
43
|
+
sourceText: input.sourceValue,
|
|
44
|
+
});
|
|
45
|
+
return success({
|
|
46
|
+
success: true,
|
|
47
|
+
keyId: result.keyId,
|
|
48
|
+
key: input.key,
|
|
49
|
+
namespace: input.namespace || "default",
|
|
50
|
+
sourceText: input.sourceValue,
|
|
51
|
+
project: input.project,
|
|
52
|
+
});
|
|
53
|
+
}),
|
|
105
54
|
};
|
|
106
55
|
//# sourceMappingURL=createTranslationKey.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTranslationKey.js","sourceRoot":"","sources":["../../src/tools/createTranslationKey.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"createTranslationKey.js","sourceRoot":"","sources":["../../src/tools/createTranslationKey.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,aAAa,EACb,OAAO,GACR,MAAM,iBAAiB,CAAC;AAGzB,MAAM,WAAW,GAAG,aAAa,CAAC,MAAM,CAAC;IACvC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACtB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACjC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,oBAAoB,GAAS;IACxC,UAAU,EAAE;QACV,IAAI,EAAE,sBAAsB;QAC5B,WAAW,EACT,gIAAgI;QAClI,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,GAAG,oBAAoB;gBACvB,GAAG,EAAE;oBACH,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,sEAAsE;iBACpF;gBACD,WAAW,EAAE;oBACX,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,mDAAmD;iBACjE;gBACD,SAAS,EAAE;oBACT,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,+CAA+C;iBAC7D;aACF;YACD,QAAQ,EAAE,CAAC,SAAS,EAAE,KAAK,EAAE,aAAa,CAAC;SAC5C;KACF;IAED,OAAO,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CACxB,WAAW,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE,EAAE,EAAE;QAC3E,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC;YAC/C,OAAO,EAAE,WAAW;YACpB,WAAW;YACX,GAAG,EAAE,KAAK,CAAC,GAAG;YACd,SAAS,EAAE,KAAK,CAAC,SAAS,IAAI,SAAS;YACvC,UAAU,EAAE,KAAK,CAAC,WAAW;SAC9B,CAAC,CAAC;QAEH,OAAO,OAAO,CAAC;YACb,OAAO,EAAE,IAAI;YACb,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,GAAG,EAAE,KAAK,CAAC,GAAG;YACd,SAAS,EAAE,KAAK,CAAC,SAAS,IAAI,SAAS;YACvC,UAAU,EAAE,KAAK,CAAC,WAAW;YAC7B,OAAO,EAAE,KAAK,CAAC,OAAO;SACvB,CAAC,CAAC;IACL,CAAC,CAAC;CACL,CAAC"}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* getProjectInfo MCP Tool
|
|
3
3
|
*
|
|
4
4
|
* Gets project information including available namespaces, languages, and stats.
|
|
5
|
-
* Useful for understanding the project structure before adding translations.
|
|
6
5
|
*/
|
|
7
6
|
import type { Tool } from "../types/index.js";
|
|
8
7
|
export declare const getProjectInfo: Tool;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getProjectInfo.d.ts","sourceRoot":"","sources":["../../src/tools/getProjectInfo.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"getProjectInfo.d.ts","sourceRoot":"","sources":["../../src/tools/getProjectInfo.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAI9C,eAAO,MAAM,cAAc,EAAE,IAsB5B,CAAC"}
|
|
@@ -2,12 +2,9 @@
|
|
|
2
2
|
* getProjectInfo MCP Tool
|
|
3
3
|
*
|
|
4
4
|
* Gets project information including available namespaces, languages, and stats.
|
|
5
|
-
* Useful for understanding the project structure before adding translations.
|
|
6
5
|
*/
|
|
7
|
-
import {
|
|
8
|
-
const inputSchema =
|
|
9
|
-
projectSlug: z.string().optional(),
|
|
10
|
-
});
|
|
6
|
+
import { executeTool, projectInputProperty, projectSchema, success, } from "../base-tool.js";
|
|
7
|
+
const inputSchema = projectSchema;
|
|
11
8
|
export const getProjectInfo = {
|
|
12
9
|
definition: {
|
|
13
10
|
name: "getProjectInfo",
|
|
@@ -15,65 +12,17 @@ export const getProjectInfo = {
|
|
|
15
12
|
inputSchema: {
|
|
16
13
|
type: "object",
|
|
17
14
|
properties: {
|
|
18
|
-
|
|
19
|
-
type: "string",
|
|
20
|
-
description: "Project slug (optional if i18n.config.ts exists)",
|
|
21
|
-
},
|
|
15
|
+
...projectInputProperty,
|
|
22
16
|
},
|
|
17
|
+
required: ["project"],
|
|
23
18
|
},
|
|
24
19
|
},
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const parts = input.projectSlug.split("/");
|
|
33
|
-
orgSlug = parts[0];
|
|
34
|
-
projectSlug = parts[1];
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
// Fall back to auto-detected context or explicit projectSlug
|
|
38
|
-
projectSlug = input.projectSlug || context.projectContext?.projectSlug;
|
|
39
|
-
orgSlug = context.projectContext?.workspaceId;
|
|
40
|
-
}
|
|
41
|
-
if (!projectSlug || !orgSlug) {
|
|
42
|
-
return {
|
|
43
|
-
content: [
|
|
44
|
-
{
|
|
45
|
-
type: "text",
|
|
46
|
-
text: "Error: Project not specified. Use format 'org/project' (e.g., 'aliosman-co/personal')",
|
|
47
|
-
},
|
|
48
|
-
],
|
|
49
|
-
isError: true,
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
try {
|
|
53
|
-
const result = await client.mcp.getProjectInfo.query({
|
|
54
|
-
orgSlug,
|
|
55
|
-
projectSlug,
|
|
56
|
-
});
|
|
57
|
-
return {
|
|
58
|
-
content: [
|
|
59
|
-
{
|
|
60
|
-
type: "text",
|
|
61
|
-
text: JSON.stringify(result, null, 2),
|
|
62
|
-
},
|
|
63
|
-
],
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
catch (error) {
|
|
67
|
-
return {
|
|
68
|
-
content: [
|
|
69
|
-
{
|
|
70
|
-
type: "text",
|
|
71
|
-
text: `Error getting project info: ${error instanceof Error ? error.message : String(error)}`,
|
|
72
|
-
},
|
|
73
|
-
],
|
|
74
|
-
isError: true,
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
},
|
|
20
|
+
execute: (client, args) => executeTool(args, inputSchema, async (input, { workspaceId, projectSlug }) => {
|
|
21
|
+
const result = await client.mcp.getProjectInfo.query({
|
|
22
|
+
orgSlug: workspaceId,
|
|
23
|
+
projectSlug,
|
|
24
|
+
});
|
|
25
|
+
return success(result);
|
|
26
|
+
}),
|
|
78
27
|
};
|
|
79
28
|
//# sourceMappingURL=getProjectInfo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getProjectInfo.js","sourceRoot":"","sources":["../../src/tools/getProjectInfo.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"getProjectInfo.js","sourceRoot":"","sources":["../../src/tools/getProjectInfo.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,aAAa,EACb,OAAO,GACR,MAAM,iBAAiB,CAAC;AAGzB,MAAM,WAAW,GAAG,aAAa,CAAC;AAElC,MAAM,CAAC,MAAM,cAAc,GAAS;IAClC,UAAU,EAAE;QACV,IAAI,EAAE,gBAAgB;QACtB,WAAW,EACT,wKAAwK;QAC1K,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,GAAG,oBAAoB;aACxB;YACD,QAAQ,EAAE,CAAC,SAAS,CAAC;SACtB;KACF;IAED,OAAO,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CACxB,WAAW,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE,EAAE,EAAE;QAC3E,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,CAAC;YACnD,OAAO,EAAE,WAAW;YACpB,WAAW;SACZ,CAAC,CAAC;QACH,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC;IACzB,CAAC,CAAC;CACL,CAAC"}
|
package/dist/tools/listKeys.d.ts
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* listKeys MCP Tool
|
|
3
3
|
*
|
|
4
4
|
* Lists ALL translation keys in a project with their source text and translations.
|
|
5
|
-
* Uses the MCP-specific getAllTranslations endpoint - no pagination needed.
|
|
6
5
|
*/
|
|
7
6
|
import type { Tool } from "../types/index.js";
|
|
8
7
|
export declare const listKeys: Tool;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listKeys.d.ts","sourceRoot":"","sources":["../../src/tools/listKeys.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"listKeys.d.ts","sourceRoot":"","sources":["../../src/tools/listKeys.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAO9C,eAAO,MAAM,QAAQ,EAAE,IAiCtB,CAAC"}
|
package/dist/tools/listKeys.js
CHANGED
|
@@ -2,92 +2,42 @@
|
|
|
2
2
|
* listKeys MCP Tool
|
|
3
3
|
*
|
|
4
4
|
* Lists ALL translation keys in a project with their source text and translations.
|
|
5
|
-
* Uses the MCP-specific getAllTranslations endpoint - no pagination needed.
|
|
6
5
|
*/
|
|
7
|
-
import { z } from
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
import { executeTool, projectInputProperty, projectSchema, success, } from "../base-tool.js";
|
|
8
|
+
const inputSchema = projectSchema.extend({
|
|
10
9
|
search: z.string().optional(),
|
|
11
10
|
namespaces: z.array(z.string()).optional(),
|
|
12
11
|
});
|
|
13
12
|
export const listKeys = {
|
|
14
13
|
definition: {
|
|
15
14
|
name: "listKeys",
|
|
16
|
-
description: "Get all translation keys with their source text and translations. Returns ALL keys in a single response
|
|
15
|
+
description: "Get all translation keys with their source text and translations. Returns ALL keys in a single response. Use 'namespaces' to filter by namespace or 'search' to search within key names and source text.",
|
|
17
16
|
inputSchema: {
|
|
18
17
|
type: "object",
|
|
19
18
|
properties: {
|
|
20
|
-
|
|
21
|
-
type: "string",
|
|
22
|
-
description: "Project slug (optional if i18n.config.ts exists)",
|
|
23
|
-
},
|
|
19
|
+
...projectInputProperty,
|
|
24
20
|
search: {
|
|
25
21
|
type: "string",
|
|
26
|
-
description: "Search term to find in key names or source text
|
|
22
|
+
description: "Search term to find in key names or source text.",
|
|
27
23
|
},
|
|
28
24
|
namespaces: {
|
|
29
25
|
type: "array",
|
|
30
26
|
items: { type: "string" },
|
|
31
|
-
description: "Filter by specific namespaces (e.g., ['nav', 'home']).
|
|
27
|
+
description: "Filter by specific namespaces (e.g., ['nav', 'home']).",
|
|
32
28
|
},
|
|
33
29
|
},
|
|
30
|
+
required: ["project"],
|
|
34
31
|
},
|
|
35
32
|
},
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
projectSlug = parts[1];
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
// Fall back to auto-detected context or explicit projectSlug
|
|
49
|
-
projectSlug = input.projectSlug || context.projectContext?.projectSlug;
|
|
50
|
-
orgSlug = context.projectContext?.workspaceId;
|
|
51
|
-
}
|
|
52
|
-
if (!projectSlug || !orgSlug) {
|
|
53
|
-
return {
|
|
54
|
-
content: [
|
|
55
|
-
{
|
|
56
|
-
type: "text",
|
|
57
|
-
text: "Error: Project not specified. Use format 'org/project' (e.g., 'aliosman-co/personal')",
|
|
58
|
-
},
|
|
59
|
-
],
|
|
60
|
-
isError: true,
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
try {
|
|
64
|
-
// Use getAllTranslations endpoint - no pagination, single request
|
|
65
|
-
const result = await client.mcp.getAllTranslations.query({
|
|
66
|
-
orgSlug,
|
|
67
|
-
projectSlug,
|
|
68
|
-
search: input.search,
|
|
69
|
-
namespaces: input.namespaces,
|
|
70
|
-
});
|
|
71
|
-
return {
|
|
72
|
-
content: [
|
|
73
|
-
{
|
|
74
|
-
type: "text",
|
|
75
|
-
text: JSON.stringify(result, null, 2),
|
|
76
|
-
},
|
|
77
|
-
],
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
catch (error) {
|
|
81
|
-
return {
|
|
82
|
-
content: [
|
|
83
|
-
{
|
|
84
|
-
type: "text",
|
|
85
|
-
text: `Error listing keys: ${error instanceof Error ? error.message : String(error)}`,
|
|
86
|
-
},
|
|
87
|
-
],
|
|
88
|
-
isError: true,
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
},
|
|
33
|
+
execute: (client, args) => executeTool(args, inputSchema, async (input, { workspaceId, projectSlug }) => {
|
|
34
|
+
const result = await client.mcp.getAllTranslations.query({
|
|
35
|
+
orgSlug: workspaceId,
|
|
36
|
+
projectSlug,
|
|
37
|
+
search: input.search,
|
|
38
|
+
namespaces: input.namespaces,
|
|
39
|
+
});
|
|
40
|
+
return success(result);
|
|
41
|
+
}),
|
|
92
42
|
};
|
|
93
43
|
//# sourceMappingURL=listKeys.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listKeys.js","sourceRoot":"","sources":["../../src/tools/listKeys.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"listKeys.js","sourceRoot":"","sources":["../../src/tools/listKeys.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,aAAa,EACb,OAAO,GACR,MAAM,iBAAiB,CAAC;AAGzB,MAAM,WAAW,GAAG,aAAa,CAAC,MAAM,CAAC;IACvC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;CAC3C,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,QAAQ,GAAS;IAC5B,UAAU,EAAE;QACV,IAAI,EAAE,UAAU;QAChB,WAAW,EACT,0MAA0M;QAC5M,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,GAAG,oBAAoB;gBACvB,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,kDAAkD;iBAChE;gBACD,UAAU,EAAE;oBACV,IAAI,EAAE,OAAO;oBACb,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;oBACzB,WAAW,EAAE,wDAAwD;iBACtE;aACF;YACD,QAAQ,EAAE,CAAC,SAAS,CAAC;SACtB;KACF;IAED,OAAO,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CACxB,WAAW,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE,EAAE,EAAE;QAC3E,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC,KAAK,CAAC;YACvD,OAAO,EAAE,WAAW;YACpB,WAAW;YACX,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,UAAU,EAAE,KAAK,CAAC,UAAU;SAC7B,CAAC,CAAC;QACH,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC;IACzB,CAAC,CAAC;CACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateTranslation.d.ts","sourceRoot":"","sources":["../../src/tools/updateTranslation.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"updateTranslation.d.ts","sourceRoot":"","sources":["../../src/tools/updateTranslation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAS9C,eAAO,MAAM,iBAAiB,EAAE,IAkD/B,CAAC"}
|