@better-i18n/mcp 0.3.0 → 0.4.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/tools/listKeys.d.ts
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
* listKeys MCP Tool
|
|
3
3
|
*
|
|
4
4
|
* Lists ALL translation keys with source text and translations.
|
|
5
|
+
* Supports full-text search in source and target languages.
|
|
6
|
+
*
|
|
7
|
+
* EXAMPLES:
|
|
8
|
+
* - Find "login" in source: { search: "login" }
|
|
9
|
+
* - Find "Giriş" in Turkish: { search: "Giriş", languages: ["tr"] }
|
|
10
|
+
* - Get Turkish translations: { languages: ["tr"] }
|
|
11
|
+
* - Get specific keys: { keys: ["auth.login.title", "auth.login.button"] }
|
|
5
12
|
*/
|
|
6
13
|
import type { Tool } from "../types/index.js";
|
|
7
14
|
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;;;;;;;;;;;GAWG;AASH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAU9C,eAAO,MAAM,QAAQ,EAAE,IAyEtB,CAAC"}
|
package/dist/tools/listKeys.js
CHANGED
|
@@ -2,25 +2,70 @@
|
|
|
2
2
|
* listKeys MCP Tool
|
|
3
3
|
*
|
|
4
4
|
* Lists ALL translation keys with source text and translations.
|
|
5
|
+
* Supports full-text search in source and target languages.
|
|
6
|
+
*
|
|
7
|
+
* EXAMPLES:
|
|
8
|
+
* - Find "login" in source: { search: "login" }
|
|
9
|
+
* - Find "Giriş" in Turkish: { search: "Giriş", languages: ["tr"] }
|
|
10
|
+
* - Get Turkish translations: { languages: ["tr"] }
|
|
11
|
+
* - Get specific keys: { keys: ["auth.login.title", "auth.login.button"] }
|
|
5
12
|
*/
|
|
6
13
|
import { z } from "zod";
|
|
7
14
|
import { executeTool, projectInputProperty, projectSchema, success, } from "../base-tool.js";
|
|
8
15
|
const inputSchema = projectSchema.extend({
|
|
9
16
|
search: z.string().optional(),
|
|
17
|
+
languages: z.array(z.string()).optional(),
|
|
10
18
|
namespaces: z.array(z.string()).optional(),
|
|
19
|
+
keys: z.array(z.string()).optional(),
|
|
20
|
+
status: z.enum(["missing", "draft", "approved", "all"]).optional(),
|
|
11
21
|
});
|
|
12
22
|
export const listKeys = {
|
|
13
23
|
definition: {
|
|
14
24
|
name: "listKeys",
|
|
15
|
-
description:
|
|
25
|
+
description: `Get all translation keys with their id, source text, and translations.
|
|
26
|
+
|
|
27
|
+
SEARCH + FILTER:
|
|
28
|
+
- search: Text to search for (in source text or specified languages)
|
|
29
|
+
- languages: Languages to search in AND return translations for
|
|
30
|
+
|
|
31
|
+
FILTER OPTIONS:
|
|
32
|
+
- namespaces: Filter by namespace(s)
|
|
33
|
+
- keys: Fetch specific keys by exact name
|
|
34
|
+
- status: Filter by translation status ("missing", "draft", "approved", "all")
|
|
35
|
+
|
|
36
|
+
EXAMPLES:
|
|
37
|
+
- Find "login" in source: { search: "login" }
|
|
38
|
+
- Find "Giriş" in Turkish: { search: "Giriş", languages: ["tr"] }
|
|
39
|
+
- Get all Turkish translations: { languages: ["tr"] }
|
|
40
|
+
- Get missing Turkish translations: { languages: ["tr"], status: "missing" }
|
|
41
|
+
- Get specific keys: { keys: ["auth.login.title", "auth.login.button"] }`,
|
|
16
42
|
inputSchema: {
|
|
17
43
|
type: "object",
|
|
18
44
|
properties: {
|
|
19
45
|
...projectInputProperty,
|
|
20
|
-
search: {
|
|
46
|
+
search: {
|
|
47
|
+
type: "string",
|
|
48
|
+
description: "Text to search for in source text or translations (case-insensitive). If languages is specified, searches in those languages; otherwise searches source text.",
|
|
49
|
+
},
|
|
50
|
+
languages: {
|
|
51
|
+
type: "array",
|
|
52
|
+
items: { type: "string" },
|
|
53
|
+
description: "Language codes to search in and return (e.g., ['tr', 'de']). If omitted with search, searches source text. If omitted without search, returns all languages.",
|
|
54
|
+
},
|
|
21
55
|
namespaces: {
|
|
22
56
|
type: "array",
|
|
23
57
|
items: { type: "string" },
|
|
58
|
+
description: "Filter by namespace(s)",
|
|
59
|
+
},
|
|
60
|
+
keys: {
|
|
61
|
+
type: "array",
|
|
62
|
+
items: { type: "string" },
|
|
63
|
+
description: "Fetch specific keys by exact name",
|
|
64
|
+
},
|
|
65
|
+
status: {
|
|
66
|
+
type: "string",
|
|
67
|
+
enum: ["missing", "draft", "approved", "all"],
|
|
68
|
+
description: "Filter by translation status (default: all). Requires languages to be specified for filtering.",
|
|
24
69
|
},
|
|
25
70
|
},
|
|
26
71
|
required: ["project"],
|
|
@@ -31,7 +76,10 @@ export const listKeys = {
|
|
|
31
76
|
orgSlug: workspaceId,
|
|
32
77
|
projectSlug,
|
|
33
78
|
search: input.search,
|
|
79
|
+
languages: input.languages,
|
|
34
80
|
namespaces: input.namespaces,
|
|
81
|
+
keys: input.keys,
|
|
82
|
+
status: input.status,
|
|
35
83
|
});
|
|
36
84
|
return success(result);
|
|
37
85
|
}),
|
|
@@ -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;;;;;;;;;;;GAWG;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,SAA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