@better-i18n/mcp-types 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@better-i18n/mcp-types",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Type definitions and schemas for Better i18n MCP API",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
package/src/schemas.ts CHANGED
@@ -63,7 +63,10 @@ export const listKeysInput = projectIdentifierSchema.extend({
63
63
  /** Number of results per page (max 100) */
64
64
  limit: z.number().min(1).max(100).default(50),
65
65
  });
66
- export type ListKeysInput = z.infer<typeof listKeysInput>;
66
+ /** Output type (after defaults applied - server side) */
67
+ export type ListKeysOutput = z.infer<typeof listKeysInput>;
68
+ /** Input type (before defaults - client side) */
69
+ export type ListKeysInput = z.input<typeof listKeysInput>;
67
70
 
68
71
  /**
69
72
  * Input schema for getAllTranslations endpoint.
@@ -112,12 +115,48 @@ export const getAllTranslationsInput = projectIdentifierSchema.extend({
112
115
  "Filter by status: 'missing' (no translation), 'draft', 'approved', 'all'",
113
116
  ),
114
117
  });
115
- export type GetAllTranslationsInput = z.infer<typeof getAllTranslationsInput>;
118
+ /** Output type (after defaults applied - server side) */
119
+ export type GetAllTranslationsOutput = z.infer<typeof getAllTranslationsInput>;
120
+ /** Input type (before defaults - client side) */
121
+ export type GetAllTranslationsInput = z.input<typeof getAllTranslationsInput>;
116
122
 
117
123
  // ============================================================================
118
124
  // Write Endpoint Schemas - COMPACT FORMAT
119
125
  // ============================================================================
120
126
 
127
+ /**
128
+ * Namespace context object for enriching namespace metadata.
129
+ * Provide this on any key to set context on its namespace.
130
+ * If multiple keys share a namespace, the last context wins.
131
+ */
132
+ const namespaceContextSchema = z.object({
133
+ /** Human-readable description of the namespace */
134
+ description: z
135
+ .string()
136
+ .optional()
137
+ .describe("What this namespace contains (e.g., 'Authentication flow strings')"),
138
+ /** Owning team */
139
+ team: z
140
+ .string()
141
+ .optional()
142
+ .describe("Team responsible (e.g., 'auth-team')"),
143
+ /** Business domain */
144
+ domain: z
145
+ .string()
146
+ .optional()
147
+ .describe("Business domain (e.g., 'authentication', 'payments')"),
148
+ /** AI translation guidance specific to this namespace */
149
+ aiPrompt: z
150
+ .string()
151
+ .optional()
152
+ .describe("Extra AI translation instructions for this namespace"),
153
+ /** Organizational tags */
154
+ tags: z
155
+ .array(z.string())
156
+ .optional()
157
+ .describe("Tags for categorization (e.g., ['critical', 'user-facing'])"),
158
+ });
159
+
121
160
  /**
122
161
  * Compact key item for createKeys endpoint.
123
162
  *
@@ -126,6 +165,7 @@ export type GetAllTranslationsInput = z.infer<typeof getAllTranslationsInput>;
126
165
  * - ns: namespace (default: "default")
127
166
  * - v: source value (source language text)
128
167
  * - t: translations object { langCode: text }
168
+ * - nc: namespace context (optional, enriches the namespace)
129
169
  */
130
170
  const compactCreateKeyItem = z.object({
131
171
  /** Key name (e.g., "submit_button", "nav.home") */
@@ -139,6 +179,12 @@ const compactCreateKeyItem = z.object({
139
179
  .record(z.string(), z.string())
140
180
  .optional()
141
181
  .describe("Target translations object"),
182
+ /** Namespace context - enriches the namespace with metadata */
183
+ nc: namespaceContextSchema
184
+ .optional()
185
+ .describe(
186
+ "Namespace context: description, team, domain, aiPrompt, tags. Sets metadata on the namespace.",
187
+ ),
142
188
  });
143
189
 
144
190
  /**
@@ -151,7 +197,8 @@ export const createKeysInput = projectIdentifierSchema.extend({
151
197
  /** Array of keys to create */
152
198
  k: z.array(compactCreateKeyItem).min(1).describe("Array of keys to create"),
153
199
  });
154
- export type CreateKeysInput = z.infer<typeof createKeysInput>;
200
+ export type CreateKeysOutput = z.infer<typeof createKeysInput>;
201
+ export type CreateKeysInput = z.input<typeof createKeysInput>;
155
202
 
156
203
  /**
157
204
  * Compact translation update item for updateKeys endpoint.
@@ -180,6 +227,12 @@ const compactUpdateItem = z.object({
180
227
  s: z.boolean().optional().describe("Is source language"),
181
228
  /** Status */
182
229
  st: z.string().optional().describe("Translation status"),
230
+ /** Namespace context - enriches the namespace with metadata */
231
+ nc: namespaceContextSchema
232
+ .optional()
233
+ .describe(
234
+ "Namespace context: description, team, domain, aiPrompt, tags. Sets metadata on the namespace.",
235
+ ),
183
236
  });
184
237
 
185
238
  /**
@@ -192,7 +245,8 @@ export const updateKeysInput = projectIdentifierSchema.extend({
192
245
  /** Array of translation updates */
193
246
  t: z.array(compactUpdateItem).min(1).describe("Array of translation updates"),
194
247
  });
195
- export type UpdateKeysInput = z.infer<typeof updateKeysInput>;
248
+ export type UpdateKeysOutput = z.infer<typeof updateKeysInput>;
249
+ export type UpdateKeysInput = z.input<typeof updateKeysInput>;
196
250
 
197
251
  /**
198
252
  * Input schema for deleteKeys endpoint.
@@ -202,7 +256,7 @@ export const deleteKeysInput = projectIdentifierSchema.extend({
202
256
  /** Array of key IDs (UUIDs) to delete */
203
257
  keyIds: z.array(z.string().uuid()).min(1).max(100),
204
258
  });
205
- export type DeleteKeysInput = z.infer<typeof deleteKeysInput>;
259
+ export type DeleteKeysInput = z.input<typeof deleteKeysInput>;
206
260
 
207
261
  /**
208
262
  * Input schema for addLanguage endpoint.
@@ -211,7 +265,7 @@ export const addLanguageInput = projectIdentifierSchema.extend({
211
265
  /** ISO 639-1 language code (e.g., "fr", "ja", "de") */
212
266
  languageCode: z.string().min(2).max(5),
213
267
  });
214
- export type AddLanguageInput = z.infer<typeof addLanguageInput>;
268
+ export type AddLanguageInput = z.input<typeof addLanguageInput>;
215
269
 
216
270
  // ============================================================================
217
271
  // Sync Endpoint Schemas
@@ -240,7 +294,8 @@ export const getSyncsInput = projectIdentifierSchema.extend({
240
294
  .optional()
241
295
  .describe("Filter syncs by job type"),
242
296
  });
243
- export type GetSyncsInput = z.infer<typeof getSyncsInput>;
297
+ export type GetSyncsOutput = z.infer<typeof getSyncsInput>;
298
+ export type GetSyncsInput = z.input<typeof getSyncsInput>;
244
299
 
245
300
  /**
246
301
  * Input schema for getSync endpoint.
@@ -250,4 +305,4 @@ export const getSyncInput = z.object({
250
305
  /** Sync job ID */
251
306
  syncId: z.string().describe("The sync job ID to retrieve details for"),
252
307
  });
253
- export type GetSyncInput = z.infer<typeof getSyncInput>;
308
+ export type GetSyncInput = z.input<typeof getSyncInput>;
package/src/types.ts CHANGED
@@ -42,6 +42,25 @@ export interface LanguageCoverage {
42
42
  percentage: number;
43
43
  }
44
44
 
45
+ /**
46
+ * Namespace metadata returned from read endpoints.
47
+ */
48
+ export interface NamespaceInfo {
49
+ /** Namespace name ("default" for root keys) */
50
+ name: string;
51
+ /** Number of keys in this namespace */
52
+ keyCount: number;
53
+ /** Human-readable description */
54
+ description: string | null;
55
+ /** Structured context (team, domain, aiPrompt, tags) */
56
+ context: {
57
+ team?: string;
58
+ domain?: string;
59
+ aiPrompt?: string;
60
+ tags?: string[];
61
+ } | null;
62
+ }
63
+
45
64
  /**
46
65
  * Response from getProject endpoint.
47
66
  */
@@ -50,8 +69,8 @@ export interface GetProjectResponse {
50
69
  project: string;
51
70
  /** Source language code */
52
71
  sourceLanguage: string;
53
- /** Available namespaces */
54
- namespaces: string[];
72
+ /** Available namespaces with metadata */
73
+ namespaces: NamespaceInfo[];
55
74
  /** Available target languages */
56
75
  languages: string[];
57
76
  /** Total number of translation keys */
@@ -112,6 +131,8 @@ export interface GetAllTranslationsResponse {
112
131
  status?: string;
113
132
  /** Translation keys with their translations */
114
133
  keys: KeyWithFullTranslations[];
134
+ /** Namespace metadata for namespaces present in results */
135
+ namespaceDetails?: Record<string, NamespaceInfo>;
115
136
  }
116
137
 
117
138
  /**
@@ -140,6 +161,8 @@ export interface ListKeysResponse {
140
161
  page: number;
141
162
  limit: number;
142
163
  keys: KeyWithTranslations[];
164
+ /** Namespace metadata for namespaces present in results */
165
+ namespaceDetails?: Record<string, NamespaceInfo>;
143
166
  }
144
167
 
145
168
  // ============================================================================