@better-i18n/mcp 0.17.0 → 0.19.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/dist/server.d.ts.map +1 -1
- package/dist/server.js +48 -0
- package/dist/server.js.map +1 -1
- package/dist/tools/cancelSync.d.ts +3 -0
- package/dist/tools/cancelSync.d.ts.map +1 -0
- package/dist/tools/cancelSync.js +73 -0
- package/dist/tools/cancelSync.js.map +1 -0
- package/dist/tools/createKeys.js +2 -2
- package/dist/tools/createKeys.js.map +1 -1
- package/dist/tools/getSync.d.ts +4 -0
- package/dist/tools/getSync.d.ts.map +1 -1
- package/dist/tools/getSync.js +32 -3
- package/dist/tools/getSync.js.map +1 -1
- package/dist/tools/getTranslationContext.d.ts +17 -0
- package/dist/tools/getTranslationContext.d.ts.map +1 -0
- package/dist/tools/getTranslationContext.js +108 -0
- package/dist/tools/getTranslationContext.js.map +1 -0
- package/dist/tools/listProjects.d.ts.map +1 -1
- package/dist/tools/listProjects.js +5 -2
- package/dist/tools/listProjects.js.map +1 -1
- package/dist/tools/publishTranslations.d.ts.map +1 -1
- package/dist/tools/publishTranslations.js +12 -2
- package/dist/tools/publishTranslations.js.map +1 -1
- package/dist/tools/setTranslations.d.ts +24 -0
- package/dist/tools/setTranslations.d.ts.map +1 -0
- package/dist/tools/setTranslations.js +114 -0
- package/dist/tools/setTranslations.js.map +1 -0
- package/dist/tools/updateKeys.d.ts.map +1 -1
- package/dist/tools/updateKeys.js +3 -1
- package/dist/tools/updateKeys.js.map +1 -1
- package/package.json +3 -2
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAEA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAMnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAEA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAMnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAoBrD,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;;;GAGG;AACH,wBAAgB,aAAa,IAAI,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,GAAG;IAC9D,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B,CAaA;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,UAAU,CAAC,OAAO,sBAAsB,CAAC,EACpD,OAAO,CAAC,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GACnD,MAAM,CAiMR;AAED,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
|
package/dist/server.js
CHANGED
|
@@ -15,12 +15,15 @@ import { createKeys } from "./tools/createKeys.js";
|
|
|
15
15
|
import { deleteKeys } from "./tools/deleteKeys.js";
|
|
16
16
|
import { getPendingChanges } from "./tools/getPendingChanges.js";
|
|
17
17
|
import { getProject } from "./tools/getProject.js";
|
|
18
|
+
import { cancelSync } from "./tools/cancelSync.js";
|
|
18
19
|
import { getSync } from "./tools/getSync.js";
|
|
19
20
|
import { getSyncs } from "./tools/getSyncs.js";
|
|
21
|
+
import { getTranslationContext } from "./tools/getTranslationContext.js";
|
|
20
22
|
import { getTranslations } from "./tools/getTranslations.js";
|
|
21
23
|
import { listKeys } from "./tools/listKeys.js";
|
|
22
24
|
import { listProjects } from "./tools/listProjects.js";
|
|
23
25
|
import { publishTranslations } from "./tools/publishTranslations.js";
|
|
26
|
+
import { setTranslations } from "./tools/setTranslations.js";
|
|
24
27
|
import { updateKeys } from "./tools/updateKeys.js";
|
|
25
28
|
/**
|
|
26
29
|
* Resolves configuration from environment variables.
|
|
@@ -51,6 +54,39 @@ export function createConfiguredServer(apiClient, options) {
|
|
|
51
54
|
tools: {},
|
|
52
55
|
logging: {},
|
|
53
56
|
},
|
|
57
|
+
instructions: `Better i18n MCP — manages translation keys and publishes localized content for the Better i18n platform.
|
|
58
|
+
|
|
59
|
+
## Character encoding (UTF-8) — CRITICAL
|
|
60
|
+
|
|
61
|
+
All string inputs are UTF-8. Send non-ASCII characters in every language (diacritics, CJK, Cyrillic, Arabic, Hebrew, emoji, etc.) exactly as the user wrote them. Do NOT transliterate, strip, or "simplify" them to ASCII — stored values are served verbatim through the CDN and corrupt end-user translations. If your JSON serializer mangles characters, use Unicode escapes (e.g. \u00f6) instead. Lossy encoding is always a client-side bug, never a limitation of this MCP.
|
|
62
|
+
|
|
63
|
+
## Key creation safety
|
|
64
|
+
|
|
65
|
+
Before calling createKeys, always listKeys first. If the key already exists in any namespace, use updateKeys — not createKeys — to avoid duplicates. (Reference incident: an AI agent once created 1005 phantom keys by calling createKeys with a wrong namespace when updateKeys was the correct tool.)
|
|
66
|
+
|
|
67
|
+
## Choosing between translation-write tools
|
|
68
|
+
|
|
69
|
+
Three tools can write translation data. Pick the narrowest one for the task:
|
|
70
|
+
|
|
71
|
+
- **setTranslations** — FAST PATH for bulk target translations. Shape: t=[{ id, t: { lang: "...", lang: "..." } }]. One entry per KEY, map of languages inside. Use this when an AI has translated N keys into M languages in one shot — roughly 55-65% smaller payload than updateKeys for the same work. Only writes target languages at status="approved". Source-language entries in the map are silently ignored.
|
|
72
|
+
- **updateKeys** — Use when editing source text (s=true), changing status (st), or doing single-language edits. Shape: t=[{ id, l, t, s?, st? }], one entry per (key × language).
|
|
73
|
+
- **createKeys** — Only when the key does not yet exist.
|
|
74
|
+
|
|
75
|
+
For translation batches in particular: prefer **setTranslations** over **updateKeys**. Both require UUIDs from listKeys / getAllTranslations.
|
|
76
|
+
|
|
77
|
+
## Translating with project context
|
|
78
|
+
|
|
79
|
+
Before translating non-trivial content, call **getTranslationContext({ project })** ONCE and inject the result into your system prompt. You get the owner-configured instructions, brand voice / tone, and the approved glossary — including locked translations and must-not-translate terms. Treat gl[].mnt === true as a hard rule: never translate those terms. When gl[].tr[lang] is present, prefer the locked translation over free translation. Cache the response in-process; it rarely changes within a session.
|
|
80
|
+
|
|
81
|
+
For a sharper signal, pass **keys: string[]** (UUIDs from listKeys, max 50) alongside the call. You get back rules[] — per-key pgvector RAG retrieval of the most similar past translations, glossary hits, preferences, and instructions for THIS project. Use rules[i].sim[] entries (scored 0-1) as the authoritative source for terminology consistency: if a past translation for a similar key was "Panel" (score 0.91), reuse that term rather than inventing a new one.
|
|
82
|
+
|
|
83
|
+
## Finding untranslated content
|
|
84
|
+
|
|
85
|
+
Use getPendingChanges to inspect unpublished edits before calling publishTranslations. Published translations reach the CDN immediately.
|
|
86
|
+
|
|
87
|
+
## Recovering from a wrong publish
|
|
88
|
+
|
|
89
|
+
If publishTranslations was called with wrong data, call **cancelSync(syncId)** as early as possible — only jobs still in status="pending" can be cancelled. Once the worker has picked the job up (status="in_progress") or it has reached a terminal state, cancelSync returns can=false and the agent should compensate with a corrective publish instead of trying to abort.`,
|
|
54
90
|
});
|
|
55
91
|
// Version check state — cached at initialization, shown once in first tool response
|
|
56
92
|
let updateWarning = null;
|
|
@@ -91,11 +127,14 @@ export function createConfiguredServer(apiClient, options) {
|
|
|
91
127
|
annotate(getTranslations.definition, readOnly),
|
|
92
128
|
annotate(createKeys.definition, write),
|
|
93
129
|
annotate(updateKeys.definition, write),
|
|
130
|
+
annotate(setTranslations.definition, write),
|
|
94
131
|
annotate(deleteKeys.definition, destructive),
|
|
95
132
|
annotate(getPendingChanges.definition, readOnly),
|
|
96
133
|
annotate(publishTranslations.definition, write),
|
|
97
134
|
annotate(getSyncs.definition, readOnly),
|
|
98
135
|
annotate(getSync.definition, readOnly),
|
|
136
|
+
annotate(cancelSync.definition, write),
|
|
137
|
+
annotate(getTranslationContext.definition, readOnly),
|
|
99
138
|
],
|
|
100
139
|
}));
|
|
101
140
|
// Execute tools
|
|
@@ -128,6 +167,9 @@ export function createConfiguredServer(apiClient, options) {
|
|
|
128
167
|
case "updateKeys":
|
|
129
168
|
result = await updateKeys.execute(apiClient, args);
|
|
130
169
|
break;
|
|
170
|
+
case "setTranslations":
|
|
171
|
+
result = await setTranslations.execute(apiClient, args);
|
|
172
|
+
break;
|
|
131
173
|
case "deleteKeys":
|
|
132
174
|
result = await deleteKeys.execute(apiClient, args);
|
|
133
175
|
break;
|
|
@@ -143,6 +185,12 @@ export function createConfiguredServer(apiClient, options) {
|
|
|
143
185
|
case "getSync":
|
|
144
186
|
result = await getSync.execute(apiClient, args);
|
|
145
187
|
break;
|
|
188
|
+
case "cancelSync":
|
|
189
|
+
result = await cancelSync.execute(apiClient, args);
|
|
190
|
+
break;
|
|
191
|
+
case "getTranslationContext":
|
|
192
|
+
result = await getTranslationContext.execute(apiClient, args);
|
|
193
|
+
break;
|
|
146
194
|
default:
|
|
147
195
|
throw new Error(`Unknown tool: ${name}`);
|
|
148
196
|
}
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAEA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,M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AAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;qBAC3F;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cancelSync.d.ts","sourceRoot":"","sources":["../../src/tools/cancelSync.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAU9C,eAAO,MAAM,UAAU,EAAE,IAwDxB,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* cancelSync MCP Tool
|
|
3
|
+
*
|
|
4
|
+
* Cancel a queued (pending) sync job before the worker picks it up. Use when
|
|
5
|
+
* a publish was triggered with wrong data or you decided to abort before
|
|
6
|
+
* anything is written to CDN/GitHub.
|
|
7
|
+
*
|
|
8
|
+
* Semantics (IMPORTANT):
|
|
9
|
+
* - Only sync jobs in status="pending" can be cancelled. Once the worker
|
|
10
|
+
* has picked up the job (status="in_progress") or it has reached a terminal
|
|
11
|
+
* state, this is a no-op and the response explains why via `prev` and `rsn`.
|
|
12
|
+
* - Cancellation prevents the job from being processed — it does NOT roll
|
|
13
|
+
* back partial work. No CDN files are deleted, no GitHub commits reverted.
|
|
14
|
+
* - Call as soon as possible after publishTranslations returns a syncId you
|
|
15
|
+
* want to abort.
|
|
16
|
+
*/
|
|
17
|
+
import { z } from "zod";
|
|
18
|
+
import { executeTool, projectInputProperty, projectSchema, success, } from "../base-tool.js";
|
|
19
|
+
const inputSchema = projectSchema.extend({
|
|
20
|
+
syncId: z
|
|
21
|
+
.string()
|
|
22
|
+
.describe("Sync job ID to cancel — returned by publishTranslations in syncJobIds[] or listed by getSyncs."),
|
|
23
|
+
});
|
|
24
|
+
export const cancelSync = {
|
|
25
|
+
definition: {
|
|
26
|
+
name: "cancelSync",
|
|
27
|
+
description: `Cancel a queued sync job before the worker picks it up.
|
|
28
|
+
|
|
29
|
+
WHEN TO USE:
|
|
30
|
+
- You called publishTranslations with the wrong data and want to abort before CDN/GitHub is touched.
|
|
31
|
+
- You want to prevent a queued sync from running at all.
|
|
32
|
+
|
|
33
|
+
SEMANTICS:
|
|
34
|
+
- Only jobs in status="pending" can be cancelled.
|
|
35
|
+
- If the worker already picked the job up (status="in_progress") or the job has reached a terminal
|
|
36
|
+
state (completed/failed/cancelled), this returns can=false with rsn explaining why.
|
|
37
|
+
- Cancellation does NOT roll back partial work. If bytes already made it to CDN/GitHub, they stay.
|
|
38
|
+
The next publish produces a consistent state.
|
|
39
|
+
- Call this as EARLY as possible — the window between publish and worker pickup is short.
|
|
40
|
+
|
|
41
|
+
TYPICAL AGENT WORKFLOW:
|
|
42
|
+
1. publishTranslations → returns syncJobIds[]
|
|
43
|
+
2. You realize the input was wrong.
|
|
44
|
+
3. cancelSync({ syncId }) ASAP.
|
|
45
|
+
4. If can=true → fix data → publishTranslations again.
|
|
46
|
+
5. If can=false and prev="in_progress" → too late, use getSync(syncId) to watch it finish,
|
|
47
|
+
then compensate with a corrective publish.
|
|
48
|
+
|
|
49
|
+
RESPONSE SHAPE (compact):
|
|
50
|
+
{ id: "<syncId>", can: boolean, prev: "pending"|"in_progress"|"completed"|"failed"|"cancelled",
|
|
51
|
+
rsn: string, hint?: string }`,
|
|
52
|
+
inputSchema: {
|
|
53
|
+
type: "object",
|
|
54
|
+
properties: {
|
|
55
|
+
...projectInputProperty,
|
|
56
|
+
syncId: {
|
|
57
|
+
type: "string",
|
|
58
|
+
description: "Sync job ID to cancel (returned by publishTranslations in syncJobIds[], or from getSyncs).",
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
required: ["project", "syncId"],
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
execute: (client, args) => executeTool(args, inputSchema, async (input, { workspaceId, projectSlug }) => {
|
|
65
|
+
const result = await client.mcp.cancelSync.mutate({
|
|
66
|
+
orgSlug: workspaceId,
|
|
67
|
+
projectSlug,
|
|
68
|
+
syncId: input.syncId,
|
|
69
|
+
});
|
|
70
|
+
return success(result);
|
|
71
|
+
}),
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=cancelSync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cancelSync.js","sourceRoot":"","sources":["../../src/tools/cancelSync.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,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;SACN,MAAM,EAAE;SACR,QAAQ,CACP,gGAAgG,CACjG;CACJ,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,UAAU,GAAS;IAC9B,UAAU,EAAE;QACV,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE;;;;;;;;;;;;;;;;;;;;;;;;iCAwBgB;QAC7B,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,GAAG,oBAAoB;gBACvB,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,4FAA4F;iBAC/F;aACF;YACD,QAAQ,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC;SAChC;KACF;IAED,OAAO,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CACxB,WAAW,CACT,IAAI,EACJ,WAAW,EACX,KAAK,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE,EAAE,EAAE;QAC5C,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC;YAChD,OAAO,EAAE,WAAW;YACpB,WAAW;YACX,MAAM,EAAE,KAAK,CAAC,MAAM;SACrB,CAAC,CAAC;QAEH,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC;IACzB,CAAC,CACF;CACJ,CAAC"}
|
package/dist/tools/createKeys.js
CHANGED
|
@@ -68,8 +68,8 @@ To add translations to EXISTING keys, use listKeys + updateKeys instead.`,
|
|
|
68
68
|
properties: {
|
|
69
69
|
n: { type: "string", description: "Key name (e.g., 'submit_button', 'nav.home')" },
|
|
70
70
|
ns: { type: "string", description: "Namespace (default: 'default'). MUST match existing keys' namespace — wrong namespace creates duplicate keys." },
|
|
71
|
-
v: { type: "string", description: "Source language text" },
|
|
72
|
-
t: { type: "object", description: "Target translations as {langCode: text}" },
|
|
71
|
+
v: { type: "string", description: "Source language text. UTF-8 — send non-ASCII as-is, never transliterate to ASCII." },
|
|
72
|
+
t: { type: "object", description: "Target translations as {langCode: text}. UTF-8 — send non-ASCII as-is, never transliterate." },
|
|
73
73
|
nc: {
|
|
74
74
|
type: "object",
|
|
75
75
|
description: "Optional context for the namespace (description, team, domain, aiPrompt, tags). Applied once per namespace.",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createKeys.js","sourceRoot":"","sources":["../../src/tools/createKeys.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,aAAa,EACb,OAAO,GACR,MAAM,iBAAiB,CAAC;AAGzB,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,QAAQ,EAAE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EAAE,CAAC;QACnC,CAAC,CAAC,CAAC;QAEH,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC;YAChD,OAAO,EAAE,WAAW;YACpB,WAAW;YACX,CAAC;YACD,GAAG,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;SACpC,CAAC,CAAC;QAEH,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC;IACzB,CAAC,CACF;CACJ,CAAC"}
|
package/dist/tools/getSync.d.ts
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
* getSync MCP Tool
|
|
3
3
|
*
|
|
4
4
|
* Get detailed information about a specific sync operation.
|
|
5
|
+
*
|
|
6
|
+
* Supports optional server-side blocking wait (waitMs) that collapses the
|
|
7
|
+
* typical 3-6 round-trip polling loop into a single call for publishes
|
|
8
|
+
* that finish within the window.
|
|
5
9
|
*/
|
|
6
10
|
import type { Tool } from "../types/index.js";
|
|
7
11
|
export declare const getSync: Tool;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSync.d.ts","sourceRoot":"","sources":["../../src/tools/getSync.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"getSync.d.ts","sourceRoot":"","sources":["../../src/tools/getSync.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAO9C,eAAO,MAAM,OAAO,EAAE,IA4CrB,CAAC"}
|
package/dist/tools/getSync.js
CHANGED
|
@@ -2,26 +2,55 @@
|
|
|
2
2
|
* getSync MCP Tool
|
|
3
3
|
*
|
|
4
4
|
* Get detailed information about a specific sync operation.
|
|
5
|
+
*
|
|
6
|
+
* Supports optional server-side blocking wait (waitMs) that collapses the
|
|
7
|
+
* typical 3-6 round-trip polling loop into a single call for publishes
|
|
8
|
+
* that finish within the window.
|
|
5
9
|
*/
|
|
6
10
|
import { z } from "zod";
|
|
7
11
|
import { executeSimpleTool, success } from "../base-tool.js";
|
|
8
12
|
const inputSchema = z.object({
|
|
9
13
|
syncId: z.string(),
|
|
14
|
+
waitMs: z.number().int().min(0).max(25000).optional(),
|
|
10
15
|
});
|
|
11
16
|
export const getSync = {
|
|
12
17
|
definition: {
|
|
13
18
|
name: "getSync",
|
|
14
|
-
description:
|
|
19
|
+
description: `Get details about a specific sync operation — logs, affected keys, current status. Use syncId from publishTranslations or getSyncs.
|
|
20
|
+
|
|
21
|
+
BLOCKING WAIT (waitMs):
|
|
22
|
+
Pass waitMs to let the server block until the job reaches a terminal state
|
|
23
|
+
(completed / failed / cancelled) or the timeout elapses — whichever happens first.
|
|
24
|
+
|
|
25
|
+
- Omit waitMs (or pass 0) → instant snapshot (original behavior).
|
|
26
|
+
- Pass waitMs=15000 → server polls every ~2s and returns as soon as the job
|
|
27
|
+
is done, or after 15s with the latest snapshot.
|
|
28
|
+
- Max 25000 (25s). Larger publishes (30s+) need a second call.
|
|
29
|
+
|
|
30
|
+
PREFER blocking wait right after publishTranslations — it replaces the 3-6
|
|
31
|
+
polling round-trips an agent otherwise makes. If the wait times out with the
|
|
32
|
+
job still running, the response hint tells you to call again with waitMs=25000
|
|
33
|
+
or fall back to polling.`,
|
|
15
34
|
inputSchema: {
|
|
16
35
|
type: "object",
|
|
17
36
|
properties: {
|
|
18
|
-
syncId: {
|
|
37
|
+
syncId: {
|
|
38
|
+
type: "string",
|
|
39
|
+
description: "Sync job ID — from publishTranslations syncJobIds[] or getSyncs.",
|
|
40
|
+
},
|
|
41
|
+
waitMs: {
|
|
42
|
+
type: "number",
|
|
43
|
+
description: "Optional server-side blocking wait in milliseconds (0-25000). Returns as soon as the job reaches a terminal state, or with the latest snapshot after the timeout.",
|
|
44
|
+
},
|
|
19
45
|
},
|
|
20
46
|
required: ["syncId"],
|
|
21
47
|
},
|
|
22
48
|
},
|
|
23
49
|
execute: (client, args) => executeSimpleTool(args, inputSchema, async (input) => {
|
|
24
|
-
const result = await client.mcp.getSync.query({
|
|
50
|
+
const result = await client.mcp.getSync.query({
|
|
51
|
+
syncId: input.syncId,
|
|
52
|
+
...(input.waitMs !== undefined ? { waitMs: input.waitMs } : {}),
|
|
53
|
+
});
|
|
25
54
|
return success(result);
|
|
26
55
|
}),
|
|
27
56
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSync.js","sourceRoot":"","sources":["../../src/tools/getSync.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"getSync.js","sourceRoot":"","sources":["../../src/tools/getSync.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAG7D,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE;CACtD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,OAAO,GAAS;IAC3B,UAAU,EAAE;QACV,IAAI,EAAE,SAAS;QACf,WAAW,EAAE;;;;;;;;;;;;;;yBAcQ;QACrB,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,kEAAkE;iBACrE;gBACD,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,mKAAmK;iBACtK;aACF;YACD,QAAQ,EAAE,CAAC,QAAQ,CAAC;SACrB;KACF;IAED,OAAO,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CACxB,iBAAiB,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;QACnD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC;YAC5C,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,GAAG,CAAC,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAChE,CAAC,CAAC;QACH,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC;IACzB,CAAC,CAAC;CACL,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* getTranslationContext MCP Tool
|
|
3
|
+
*
|
|
4
|
+
* Returns the translation-relevant project context — brand voice, glossary
|
|
5
|
+
* (with locked translations), tone preferences, and the owner-configured
|
|
6
|
+
* system prompt — so external AI agents translate with the same guidance
|
|
7
|
+
* the in-platform AI drawer uses.
|
|
8
|
+
*
|
|
9
|
+
* v2: passing `keys: string[]` triggers per-key RAG retrieval over pgvector.
|
|
10
|
+
* Each key receives its own top-K similar passages (past approved translations,
|
|
11
|
+
* glossary, preferences, instructions, content) attributed back to its UUID
|
|
12
|
+
* in `rules[]`. Gracefully degrades to the v1 project-wide snapshot when
|
|
13
|
+
* the embedding service is unavailable.
|
|
14
|
+
*/
|
|
15
|
+
import type { Tool } from "../types/index.js";
|
|
16
|
+
export declare const getTranslationContext: Tool;
|
|
17
|
+
//# sourceMappingURL=getTranslationContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTranslationContext.d.ts","sourceRoot":"","sources":["../../src/tools/getTranslationContext.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AASH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AA2B9C,eAAO,MAAM,qBAAqB,EAAE,IAiFnC,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* getTranslationContext MCP Tool
|
|
3
|
+
*
|
|
4
|
+
* Returns the translation-relevant project context — brand voice, glossary
|
|
5
|
+
* (with locked translations), tone preferences, and the owner-configured
|
|
6
|
+
* system prompt — so external AI agents translate with the same guidance
|
|
7
|
+
* the in-platform AI drawer uses.
|
|
8
|
+
*
|
|
9
|
+
* v2: passing `keys: string[]` triggers per-key RAG retrieval over pgvector.
|
|
10
|
+
* Each key receives its own top-K similar passages (past approved translations,
|
|
11
|
+
* glossary, preferences, instructions, content) attributed back to its UUID
|
|
12
|
+
* in `rules[]`. Gracefully degrades to the v1 project-wide snapshot when
|
|
13
|
+
* the embedding service is unavailable.
|
|
14
|
+
*/
|
|
15
|
+
import { z } from "zod";
|
|
16
|
+
import { executeTool, projectInputProperty, projectSchema, success, } from "../base-tool.js";
|
|
17
|
+
const inputSchema = projectSchema.extend({
|
|
18
|
+
keys: z
|
|
19
|
+
.array(z.string().uuid())
|
|
20
|
+
.max(50)
|
|
21
|
+
.optional()
|
|
22
|
+
.describe("Optional — key UUIDs (max 50) for per-key RAG retrieval. Omit for project-wide context only."),
|
|
23
|
+
kPerKey: z
|
|
24
|
+
.number()
|
|
25
|
+
.int()
|
|
26
|
+
.min(1)
|
|
27
|
+
.max(20)
|
|
28
|
+
.optional()
|
|
29
|
+
.describe("Top-K similar passages per key (1-20, default 5). Only used with `keys`."),
|
|
30
|
+
languages: z
|
|
31
|
+
.array(z.string())
|
|
32
|
+
.optional()
|
|
33
|
+
.describe("Optional BCP 47 language codes. Narrows glossary customTranslation entries and RAG retrieval to these languages."),
|
|
34
|
+
});
|
|
35
|
+
export const getTranslationContext = {
|
|
36
|
+
definition: {
|
|
37
|
+
name: "getTranslationContext",
|
|
38
|
+
description: `Fetch the translation-relevant project context for a Better i18n project — the same brand voice, glossary, locked translations, and past-decision RAG the platform's own AI drawer uses. Call ONCE per translation session and inject into your system prompt.
|
|
39
|
+
|
|
40
|
+
WHAT YOU GET (always):
|
|
41
|
+
- inst — owner-configured system prompt (treat as high-priority).
|
|
42
|
+
- ctx — brand voice, tone (formality / emotionalTone / technicalLevel / pacing / voiceCharacteristics), product description, target audience.
|
|
43
|
+
- gl — up to 30 approved glossary terms, each with:
|
|
44
|
+
• tp: brand | product | technical | terminology
|
|
45
|
+
• d: short definition
|
|
46
|
+
• mnt: true ⇒ NEVER translate this term (brand names, product names)
|
|
47
|
+
• tr: { [langCode]: lockedTranslation } — human-approved, prefer over free translation
|
|
48
|
+
- src / tgt — source language + active target languages (BCP 47, lowercase).
|
|
49
|
+
|
|
50
|
+
V2 — PER-KEY RAG RETRIEVAL (optional):
|
|
51
|
+
Pass \`keys: string[]\` (UUIDs from listKeys) to get attributed past-decision context for each key in \`rules[]\`. Each rules[i] is:
|
|
52
|
+
{ id: "<keyUuid>", k: "<keyName>", sim: [{ tp, c, s, l }, ...] }
|
|
53
|
+
- tp: translation | glossary | preference | instruction | content — what the retrieved passage IS
|
|
54
|
+
- c: the passage text (truncated at 200 chars)
|
|
55
|
+
- s: cosine similarity score in [0, 1] — higher = more relevant
|
|
56
|
+
- l: language code (null for language-agnostic entries)
|
|
57
|
+
|
|
58
|
+
Passages are pgvector-retrieved from this project's embeddings and ranked per-key. Use them for terminology consistency across sessions: if a past translation for a similar key was "Panel" (score 0.91), reuse that term rather than inventing a new one.
|
|
59
|
+
|
|
60
|
+
HOW TO USE:
|
|
61
|
+
1. Call getTranslationContext({ project, keys? }) at the start of the session.
|
|
62
|
+
2. Inject inst + ctx.tone into your system prompt.
|
|
63
|
+
3. Treat gl[].mnt === true as a HARD rule — never translate those terms.
|
|
64
|
+
4. For glossary terms with gl[].tr[lang] present, use that locked translation instead of free translation.
|
|
65
|
+
5. For each rules[i], read sim[] — re-use the best-scoring past translations as the source of truth for terminology in that key.
|
|
66
|
+
6. Cache the response in-process — it rarely changes within a session.
|
|
67
|
+
|
|
68
|
+
DEGRADATION:
|
|
69
|
+
If the embedding service is unavailable (no API key, circuit breaker open, no embeddings seeded), \`rules\` is omitted and \`hint\` explains. The v1 project-wide context always returns — you are never blocked.
|
|
70
|
+
|
|
71
|
+
PERFORMANCE:
|
|
72
|
+
- Without keys: single DB hit.
|
|
73
|
+
- With keys: +1 batched Gemini embed API call + N parallel pgvector searches (LIMIT kPerKey). Budget ~500ms-1s for 10 keys.
|
|
74
|
+
- Max 50 keys per call. Do NOT call once per key — batch them.`,
|
|
75
|
+
inputSchema: {
|
|
76
|
+
type: "object",
|
|
77
|
+
properties: {
|
|
78
|
+
...projectInputProperty,
|
|
79
|
+
keys: {
|
|
80
|
+
type: "array",
|
|
81
|
+
description: "Optional — key UUIDs (max 50) from listKeys for per-key RAG retrieval. Omit for project-wide context only.",
|
|
82
|
+
items: { type: "string" },
|
|
83
|
+
},
|
|
84
|
+
kPerKey: {
|
|
85
|
+
type: "number",
|
|
86
|
+
description: "Top-K similar passages per key (1-20, default 5). Only used when `keys` is provided.",
|
|
87
|
+
},
|
|
88
|
+
languages: {
|
|
89
|
+
type: "array",
|
|
90
|
+
description: "Optional list of BCP 47 language codes. Narrows glossary customTranslation entries and RAG retrieval to these languages.",
|
|
91
|
+
items: { type: "string" },
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
required: ["project"],
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
execute: (client, args) => executeTool(args, inputSchema, async (input, { workspaceId, projectSlug }) => {
|
|
98
|
+
const result = await client.mcp.getTranslationContext.query({
|
|
99
|
+
orgSlug: workspaceId,
|
|
100
|
+
projectSlug,
|
|
101
|
+
...(input.keys ? { keys: input.keys } : {}),
|
|
102
|
+
...(input.kPerKey !== undefined ? { kPerKey: input.kPerKey } : {}),
|
|
103
|
+
...(input.languages ? { languages: input.languages } : {}),
|
|
104
|
+
});
|
|
105
|
+
return success(result);
|
|
106
|
+
}),
|
|
107
|
+
};
|
|
108
|
+
//# sourceMappingURL=getTranslationContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTranslationContext.js","sourceRoot":"","sources":["../../src/tools/getTranslationContext.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;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,IAAI,EAAE,CAAC;SACJ,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC;SACxB,GAAG,CAAC,EAAE,CAAC;SACP,QAAQ,EAAE;SACV,QAAQ,CACP,8FAA8F,CAC/F;IACH,OAAO,EAAE,CAAC;SACP,MAAM,EAAE;SACR,GAAG,EAAE;SACL,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,EAAE,CAAC;SACP,QAAQ,EAAE;SACV,QAAQ,CACP,0EAA0E,CAC3E;IACH,SAAS,EAAE,CAAC;SACT,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;SACjB,QAAQ,EAAE;SACV,QAAQ,CACP,kHAAkH,CACnH;CACJ,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAS;IACzC,UAAU,EAAE;QACV,IAAI,EAAE,uBAAuB;QAC7B,WAAW,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DAoC8C;QAC3D,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,GAAG,oBAAoB;gBACvB,IAAI,EAAE;oBACJ,IAAI,EAAE,OAAO;oBACb,WAAW,EACT,4GAA4G;oBAC9G,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;iBAC1B;gBACD,OAAO,EAAE;oBACP,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,sFAAsF;iBACzF;gBACD,SAAS,EAAE;oBACT,IAAI,EAAE,OAAO;oBACb,WAAW,EACT,0HAA0H;oBAC5H,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;iBAC1B;aACF;YACD,QAAQ,EAAE,CAAC,SAAS,CAAC;SACtB;KACF;IAED,OAAO,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CACxB,WAAW,CACT,IAAI,EACJ,WAAW,EACX,KAAK,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE,EAAE,EAAE;QAC5C,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,qBAAqB,CAAC,KAAK,CAAC;YAC1D,OAAO,EAAE,WAAW;YACpB,WAAW;YACX,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3C,GAAG,CAAC,KAAK,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAClE,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC3D,CAAC,CAAC;QACH,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC;IACzB,CAAC,CACF;CACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listProjects.d.ts","sourceRoot":"","sources":["../../src/tools/listProjects.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAK9C,eAAO,MAAM,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"listProjects.d.ts","sourceRoot":"","sources":["../../src/tools/listProjects.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAK9C,eAAO,MAAM,YAAY,EAAE,IAqB1B,CAAC"}
|
|
@@ -10,8 +10,11 @@ export const listProjects = {
|
|
|
10
10
|
definition: {
|
|
11
11
|
name: "listProjects",
|
|
12
12
|
description: "List all projects you have access to. Call this first to discover available projects before using other tools. " +
|
|
13
|
-
"
|
|
14
|
-
|
|
13
|
+
"Response: { cdnBaseUrl, projects[] }. Build CDN URLs as `${cdnBaseUrl}/${slug}/${locale}/${ns}.json`. " +
|
|
14
|
+
"Per-project fileStructure and keyFormat control CDN layout and JSON shape: " +
|
|
15
|
+
'fileStructure="single_file" → one file per language, use "translations" as ns literal (/en/translations.json). ' +
|
|
16
|
+
'fileStructure="namespaced_folders" → one file per namespace (/en/common.json, /en/auth.json). ' +
|
|
17
|
+
'keyFormat="flat" → dot-notation string keys. keyFormat="nested" → tree-shaped objects (parent paths become objects, not leaf strings).',
|
|
15
18
|
inputSchema: {
|
|
16
19
|
type: "object",
|
|
17
20
|
properties: {},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listProjects.js","sourceRoot":"","sources":["../../src/tools/listProjects.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE7D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAEjC,MAAM,CAAC,MAAM,YAAY,GAAS;IAChC,UAAU,EAAE;QACV,IAAI,EAAE,cAAc;QACpB,WAAW,EACT,iHAAiH;YACjH,
|
|
1
|
+
{"version":3,"file":"listProjects.js","sourceRoot":"","sources":["../../src/tools/listProjects.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE7D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAEjC,MAAM,CAAC,MAAM,YAAY,GAAS;IAChC,UAAU,EAAE;QACV,IAAI,EAAE,cAAc;QACpB,WAAW,EACT,iHAAiH;YACjH,wGAAwG;YACxG,6EAA6E;YAC7E,iHAAiH;YACjH,gGAAgG;YAChG,wIAAwI;QAC1I,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,EAAE;SACf;KACF;IAED,OAAO,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CACxB,iBAAiB,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,IAAI,EAAE;QAC9C,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;QACrD,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC;IACzB,CAAC,CAAC;CACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publishTranslations.d.ts","sourceRoot":"","sources":["../../src/tools/publishTranslations.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAa9C,eAAO,MAAM,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"publishTranslations.d.ts","sourceRoot":"","sources":["../../src/tools/publishTranslations.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAa9C,eAAO,MAAM,mBAAmB,EAAE,IAsEjC,CAAC"}
|
|
@@ -25,8 +25,18 @@ REQUIRED WORKFLOW (follow in order):
|
|
|
25
25
|
|
|
26
26
|
⚠️ PERMANENT DELETION: Soft-deleted keys (from deleteKeys) become permanently deleted after publish. There is NO way to recover them. Verify with getPendingChanges → deletedKeys before publishing.
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
DEFAULT BEHAVIOR (what you almost always want):
|
|
29
|
+
Omit the 'translations' parameter. Everything returned by getPendingChanges
|
|
30
|
+
is published in one go. Don't track UUIDs across tool calls — just
|
|
31
|
+
getPendingChanges to review, then publishTranslations with no filter.
|
|
32
|
+
|
|
33
|
+
THE 'translations' FILTER IS A NARROW OPT-IN:
|
|
34
|
+
Only use it when you explicitly need to publish a SUBSET of pending
|
|
35
|
+
changes (e.g. the user said "publish only the German translations",
|
|
36
|
+
or a reviewer wants to ship one language while leaving others in draft).
|
|
37
|
+
Passing hundreds of (keyId, languageCode) pairs you just wrote back into
|
|
38
|
+
this call is an anti-pattern — bloats payload and adds state-tracking
|
|
39
|
+
burden for no benefit over the default.
|
|
30
40
|
|
|
31
41
|
Returns syncJobIds — use getSync(syncId) to verify deployment completed successfully.`,
|
|
32
42
|
inputSchema: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publishTranslations.js","sourceRoot":"","sources":["../../src/tools/publishTranslations.ts"],"names":[],"mappings":"AAAA,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,YAAY,EAAE,CAAC;SACZ,KAAK,CACJ,CAAC,CAAC,MAAM,CAAC;QACP,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;QACjB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;KACzB,CAAC,CACH;SACA,QAAQ,EAAE;CACd,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAS;IACvC,UAAU,EAAE;QACV,IAAI,EAAE,qBAAqB;QAC3B,WAAW,EAAE
|
|
1
|
+
{"version":3,"file":"publishTranslations.js","sourceRoot":"","sources":["../../src/tools/publishTranslations.ts"],"names":[],"mapp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AAY,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YACjD,GAAG,CAAC;YACJ,YAAY,EAAE,CAAC,CAAC,YAAY,CAAC,WAAW,EAAE;SAC3C,CAAC,CAAC,CAAC;QAEJ,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,MAAM,CAAC;YACzD,OAAO,EAAE,WAAW;YACpB,WAAW;YACX,YAAY;SACb,CAAC,CAAC;QACH,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC;IACzB,CAAC,CAAC;CACL,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* setTranslations MCP Tool
|
|
3
|
+
*
|
|
4
|
+
* Narrow-purpose write: upsert TARGET translations for existing keys in bulk,
|
|
5
|
+
* with a minimal payload shape optimized for AI agents that translate many
|
|
6
|
+
* keys into many languages in one shot.
|
|
7
|
+
*
|
|
8
|
+
* Shape: t=[{ id, t: { langCode: text, ... } }] — key-grouped, not flat.
|
|
9
|
+
*
|
|
10
|
+
* Use this INSTEAD of updateKeys when:
|
|
11
|
+
* - You have UUIDs (from listKeys / getTranslations) for existing keys
|
|
12
|
+
* - You want to write translations for several languages per key
|
|
13
|
+
* - You don't need to edit source text or change status
|
|
14
|
+
*
|
|
15
|
+
* Use updateKeys (NOT this) when:
|
|
16
|
+
* - Editing source-language text (s=true)
|
|
17
|
+
* - Changing translation status (st)
|
|
18
|
+
*
|
|
19
|
+
* Use createKeys (NOT this) when:
|
|
20
|
+
* - The key does not yet exist
|
|
21
|
+
*/
|
|
22
|
+
import type { Tool } from "../types/index.js";
|
|
23
|
+
export declare const setTranslations: Tool;
|
|
24
|
+
//# sourceMappingURL=setTranslations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setTranslations.d.ts","sourceRoot":"","sources":["../../src/tools/setTranslations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AASH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAuB9C,eAAO,MAAM,eAAe,EAAE,IAsF7B,CAAC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* setTranslations MCP Tool
|
|
3
|
+
*
|
|
4
|
+
* Narrow-purpose write: upsert TARGET translations for existing keys in bulk,
|
|
5
|
+
* with a minimal payload shape optimized for AI agents that translate many
|
|
6
|
+
* keys into many languages in one shot.
|
|
7
|
+
*
|
|
8
|
+
* Shape: t=[{ id, t: { langCode: text, ... } }] — key-grouped, not flat.
|
|
9
|
+
*
|
|
10
|
+
* Use this INSTEAD of updateKeys when:
|
|
11
|
+
* - You have UUIDs (from listKeys / getTranslations) for existing keys
|
|
12
|
+
* - You want to write translations for several languages per key
|
|
13
|
+
* - You don't need to edit source text or change status
|
|
14
|
+
*
|
|
15
|
+
* Use updateKeys (NOT this) when:
|
|
16
|
+
* - Editing source-language text (s=true)
|
|
17
|
+
* - Changing translation status (st)
|
|
18
|
+
*
|
|
19
|
+
* Use createKeys (NOT this) when:
|
|
20
|
+
* - The key does not yet exist
|
|
21
|
+
*/
|
|
22
|
+
import { z } from "zod";
|
|
23
|
+
import { executeTool, projectInputProperty, projectSchema, success, } from "../base-tool.js";
|
|
24
|
+
const inputSchema = projectSchema.extend({
|
|
25
|
+
t: z
|
|
26
|
+
.array(z.object({
|
|
27
|
+
id: z
|
|
28
|
+
.string()
|
|
29
|
+
.uuid()
|
|
30
|
+
.describe("Translation key UUID — get from listKeys or getAllTranslations id field."),
|
|
31
|
+
t: z
|
|
32
|
+
.record(z.string(), z.string())
|
|
33
|
+
.describe("Map of { languageCode: translationText }. Target languages only. Language codes are lowercased server-side (BCP 47: 'zh-Hans' becomes 'zh-hans')."),
|
|
34
|
+
}))
|
|
35
|
+
.min(1)
|
|
36
|
+
.max(500),
|
|
37
|
+
});
|
|
38
|
+
export const setTranslations = {
|
|
39
|
+
definition: {
|
|
40
|
+
name: "setTranslations",
|
|
41
|
+
description: `Upsert target translations for existing keys in bulk. Minimal payload — use this for AI translation batches.
|
|
42
|
+
|
|
43
|
+
INPUT SHAPE (≈55-65% smaller than updateKeys for N-language batches):
|
|
44
|
+
{ t: [
|
|
45
|
+
{ id: "<uuid>", t: { tr: "Modüllerim", de: "Meine Module", fr: "Mes modules" } },
|
|
46
|
+
{ id: "<uuid>", t: { tr: "Başlık", de: "Titel" } }
|
|
47
|
+
]}
|
|
48
|
+
|
|
49
|
+
WORKFLOW:
|
|
50
|
+
1. listKeys({ missingLanguage: 'tr', fields: ['id'] }) → get UUIDs needing translation
|
|
51
|
+
2. (AI generates translations for multiple languages per key)
|
|
52
|
+
3. setTranslations({ t: [{ id: '<uuid>', t: { tr: '...', de: '...' } }, ...] })
|
|
53
|
+
4. getPendingChanges → publishTranslations
|
|
54
|
+
|
|
55
|
+
SEMANTICS:
|
|
56
|
+
- Merge at language level: unlisted languages are untouched.
|
|
57
|
+
- Upsert at value level: insert if missing, overwrite if present.
|
|
58
|
+
- All writes land at status='approved'.
|
|
59
|
+
- Source language entries in the map are silently IGNORED — use updateKeys
|
|
60
|
+
with s=true to edit source text.
|
|
61
|
+
- Unknown UUIDs are returned in errors[], NEVER silent-created.
|
|
62
|
+
- Max 500 keys per call.
|
|
63
|
+
|
|
64
|
+
WHEN TO USE WHICH TOOL:
|
|
65
|
+
- Translate N keys into M languages in bulk → setTranslations (this one)
|
|
66
|
+
- Edit source text / change status → updateKeys
|
|
67
|
+
- Create new keys → createKeys
|
|
68
|
+
|
|
69
|
+
CHARACTER ENCODING: UTF-8 — send non-ASCII (ö, ş, 中, é, ñ, etc.) as-is,
|
|
70
|
+
never transliterate to ASCII. See server instructions for details.`,
|
|
71
|
+
inputSchema: {
|
|
72
|
+
type: "object",
|
|
73
|
+
properties: {
|
|
74
|
+
...projectInputProperty,
|
|
75
|
+
t: {
|
|
76
|
+
type: "array",
|
|
77
|
+
description: "Array of per-key translation batches. Each item: { id: UUID, t: { languageCode: text } }. Max 500 keys per call.",
|
|
78
|
+
items: {
|
|
79
|
+
type: "object",
|
|
80
|
+
properties: {
|
|
81
|
+
id: {
|
|
82
|
+
type: "string",
|
|
83
|
+
description: "Translation key UUID (required). Get from listKeys or getAllTranslations id field.",
|
|
84
|
+
},
|
|
85
|
+
t: {
|
|
86
|
+
type: "object",
|
|
87
|
+
description: "Map of { languageCode: translationText }, e.g. { tr: \"Modüllerim\", de: \"Meine Module\" }. Target languages only. UTF-8 — send non-ASCII as-is, never transliterate to ASCII.",
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
required: ["id", "t"],
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
required: ["project", "t"],
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
execute: (client, args) => executeTool(args, inputSchema, async (input, { workspaceId, projectSlug }) => {
|
|
98
|
+
// Normalize language codes to lowercase (matches CDN + platform convention)
|
|
99
|
+
const t = input.t.map((item) => {
|
|
100
|
+
const normalized = {};
|
|
101
|
+
for (const [lang, text] of Object.entries(item.t)) {
|
|
102
|
+
normalized[lang.toLowerCase()] = text;
|
|
103
|
+
}
|
|
104
|
+
return { id: item.id, t: normalized };
|
|
105
|
+
});
|
|
106
|
+
const result = await client.mcp.setTranslations.mutate({
|
|
107
|
+
orgSlug: workspaceId,
|
|
108
|
+
projectSlug,
|
|
109
|
+
t,
|
|
110
|
+
});
|
|
111
|
+
return success(result);
|
|
112
|
+
}),
|
|
113
|
+
};
|
|
114
|
+
//# sourceMappingURL=setTranslations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setTranslations.js","sourceRoot":"","sources":["../../src/tools/setTranslations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,aAAa,EACb,OAA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WAAW,EAAE,EAAE,EAAE;QAC5C,4EAA4E;QAC5E,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YAC7B,MAAM,UAAU,GAA2B,EAAE,CAAC;YAC9C,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;gBAClD,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,GAAG,IAAI,CAAC;YACxC,CAAC;YACD,OAAO,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC;QACxC,CAAC,CAAC,CAAC;QAEH,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,MAAM,CAAC;YACrD,OAAO,EAAE,WAAW;YACpB,WAAW;YACX,CAAC;SACF,CAAC,CAAC;QAEH,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC;IACzB,CAAC,CACF;CACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateKeys.d.ts","sourceRoot":"","sources":["../../src/tools/updateKeys.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AASH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAc9C,eAAO,MAAM,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"updateKeys.d.ts","sourceRoot":"","sources":["../../src/tools/updateKeys.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AASH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAc9C,eAAO,MAAM,UAAU,EAAE,IA6DxB,CAAC"}
|
package/dist/tools/updateKeys.js
CHANGED
|
@@ -23,6 +23,8 @@ export const updateKeys = {
|
|
|
23
23
|
name: "updateKeys",
|
|
24
24
|
description: `Update translations for existing keys. UUID required — do NOT use createKeys for existing keys.
|
|
25
25
|
|
|
26
|
+
For bulk translation writes (multiple languages per key, or many keys at once), prefer setTranslations — same result with ~55-65% smaller payload. Use updateKeys only for source-text edits (s=true), status changes (st), or single-language edits.
|
|
27
|
+
|
|
26
28
|
WORKFLOW to add missing translations:
|
|
27
29
|
1. listKeys({ missingLanguage: 'hr', fields: ['id'] }) → get UUIDs
|
|
28
30
|
2. updateKeys({ t: [{ id: '<uuid>', l: 'hr', t: '<translation>' }] })
|
|
@@ -45,7 +47,7 @@ IMPORTANT:
|
|
|
45
47
|
properties: {
|
|
46
48
|
id: { type: "string", description: "Translation key UUID (required). Get from getAllTranslations or listKeys response." },
|
|
47
49
|
l: { type: "string", description: "Language code (e.g., 'tr', 'de')" },
|
|
48
|
-
t: { type: "string", description: "Translation text" },
|
|
50
|
+
t: { type: "string", description: "Translation text. UTF-8 — send non-ASCII characters as-is, never transliterate to ASCII." },
|
|
49
51
|
s: { type: "boolean", description: "true if updating source language text" },
|
|
50
52
|
st: { type: "string", description: "Translation status (e.g., 'published')" },
|
|
51
53
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateKeys.js","sourceRoot":"","sources":["../../src/tools/updateKeys.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;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,CAAC,EAAE,CAAC,CAAC,KAAK,CACR,CAAC,CAAC,MAAM,CAAC;QACP,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oFAAoF,CAAC;QAC7G,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;QAC1D,CAAC,EAAE,CAAC,CAAC,MAAM,E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AM,MAAM,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC;YAChD,OAAO,EAAE,WAAW;YACpB,WAAW;YACX,CAAC;SACF,CAAC,CAAC;QAEH,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC;IACzB,CAAC,CACF;CACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-i18n/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"description": "MCP server for Better i18n translation management - AI-powered translation workflow for Cursor, Claude, and other AI assistants",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"start": "node ./dist/index.js",
|
|
47
47
|
"dev": "bun run src/index.ts",
|
|
48
48
|
"typecheck": "tsc --noEmit",
|
|
49
|
+
"smoke": "bun run scripts/smoke.ts",
|
|
49
50
|
"clean": "rm -rf dist",
|
|
50
51
|
"deploy": "npm run build && wrangler deploy -c wrangler.jsonc",
|
|
51
52
|
"prepublishOnly": "npm run clean && npm run build && chmod +x ./dist/index.js ./dist/http.js"
|
|
@@ -56,7 +57,7 @@
|
|
|
56
57
|
"zod": "^3.25.1"
|
|
57
58
|
},
|
|
58
59
|
"devDependencies": {
|
|
59
|
-
"@better-i18n/mcp-types": "0.0.
|
|
60
|
+
"@better-i18n/mcp-types": "0.0.2",
|
|
60
61
|
"@types/node": "^20.0.0",
|
|
61
62
|
"typescript": "~5.9.2"
|
|
62
63
|
},
|