@better-i18n/mcp-types 0.6.0 → 0.7.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 +1 -1
- package/src/client-types.ts +85 -8
- package/src/compact-types.ts +115 -1
- package/src/content-compact-types.ts +296 -0
- package/src/content-schemas.ts +166 -0
- package/src/content-types.ts +276 -0
- package/src/index.ts +9 -0
package/package.json
CHANGED
package/src/client-types.ts
CHANGED
|
@@ -20,13 +20,21 @@ import type {
|
|
|
20
20
|
PublishInput,
|
|
21
21
|
} from "./schemas";
|
|
22
22
|
|
|
23
|
+
import type {
|
|
24
|
+
ListContentModelsInput,
|
|
25
|
+
GetContentModelInput,
|
|
26
|
+
ListContentEntriesInput,
|
|
27
|
+
GetContentEntryInput,
|
|
28
|
+
CreateContentEntryInput,
|
|
29
|
+
UpdateContentEntryInput,
|
|
30
|
+
PublishContentEntryInput,
|
|
31
|
+
DeleteContentEntryInput,
|
|
32
|
+
} from "./content-schemas";
|
|
33
|
+
|
|
23
34
|
import type {
|
|
24
35
|
ListProjectsResponse,
|
|
25
36
|
GetAllTranslationsResponse,
|
|
26
37
|
ListKeysResponse,
|
|
27
|
-
CreateKeysResponse,
|
|
28
|
-
UpdateKeysResponse,
|
|
29
|
-
DeleteKeysResponse,
|
|
30
38
|
AddLanguageResponse,
|
|
31
39
|
PublishResponse,
|
|
32
40
|
} from "./types";
|
|
@@ -36,8 +44,22 @@ import type {
|
|
|
36
44
|
CompactGetPendingChangesResponse,
|
|
37
45
|
CompactGetSyncsResponse,
|
|
38
46
|
CompactGetSyncResponse,
|
|
47
|
+
CompactCreateKeysResponse,
|
|
48
|
+
CompactUpdateKeysResponse,
|
|
49
|
+
CompactDeleteKeysResponse,
|
|
39
50
|
} from "./compact-types";
|
|
40
51
|
|
|
52
|
+
import type {
|
|
53
|
+
CompactListContentModelsResponse,
|
|
54
|
+
CompactGetContentModelResponse,
|
|
55
|
+
CompactListContentEntriesResponse,
|
|
56
|
+
CompactContentEntryDetail,
|
|
57
|
+
CompactCreateContentEntryResponse,
|
|
58
|
+
CompactUpdateContentEntryResponse,
|
|
59
|
+
CompactPublishContentEntryResponse,
|
|
60
|
+
CompactDeleteContentEntryResponse,
|
|
61
|
+
} from "./content-compact-types";
|
|
62
|
+
|
|
41
63
|
/**
|
|
42
64
|
* MCP API client interface.
|
|
43
65
|
*
|
|
@@ -59,7 +81,6 @@ import type {
|
|
|
59
81
|
* - getSync - Returns CompactGetSyncResponse
|
|
60
82
|
*
|
|
61
83
|
* **Verbose Endpoints (unchanged):**
|
|
62
|
-
* - All write operations (createKeys, updateKeys, deleteKeys)
|
|
63
84
|
* - listProjects, getAllTranslations, listKeys
|
|
64
85
|
* - publishTranslations
|
|
65
86
|
*/
|
|
@@ -79,13 +100,13 @@ export interface MCPClient {
|
|
|
79
100
|
query: (input: ListKeysInput) => Promise<ListKeysResponse>;
|
|
80
101
|
};
|
|
81
102
|
createKeys: {
|
|
82
|
-
mutate: (input: CreateKeysInput) => Promise<
|
|
103
|
+
mutate: (input: CreateKeysInput) => Promise<CompactCreateKeysResponse>;
|
|
83
104
|
};
|
|
84
105
|
updateKeys: {
|
|
85
|
-
mutate: (input: UpdateKeysInput) => Promise<
|
|
106
|
+
mutate: (input: UpdateKeysInput) => Promise<CompactUpdateKeysResponse>;
|
|
86
107
|
};
|
|
87
108
|
deleteKeys: {
|
|
88
|
-
mutate: (input: DeleteKeysInput) => Promise<
|
|
109
|
+
mutate: (input: DeleteKeysInput) => Promise<CompactDeleteKeysResponse>;
|
|
89
110
|
};
|
|
90
111
|
addLanguage: {
|
|
91
112
|
mutate: (input: AddLanguageInput) => Promise<AddLanguageResponse>;
|
|
@@ -107,8 +128,64 @@ export interface MCPClient {
|
|
|
107
128
|
}
|
|
108
129
|
|
|
109
130
|
/**
|
|
110
|
-
*
|
|
131
|
+
* MCP Content API client interface.
|
|
132
|
+
*
|
|
133
|
+
* Provides type-safe access to content MCP endpoints.
|
|
134
|
+
* All responses use compact format for AI token efficiency.
|
|
135
|
+
*
|
|
136
|
+
* **Read endpoints:**
|
|
137
|
+
* - listContentModels, getContentModel, listContentEntries, getContentEntry
|
|
138
|
+
*
|
|
139
|
+
* **Write endpoints:**
|
|
140
|
+
* - createContentEntry, updateContentEntry, publishContentEntry, deleteContentEntry
|
|
141
|
+
*/
|
|
142
|
+
export interface MCPContentClient {
|
|
143
|
+
listContentModels: {
|
|
144
|
+
query: (
|
|
145
|
+
input: ListContentModelsInput,
|
|
146
|
+
) => Promise<CompactListContentModelsResponse>;
|
|
147
|
+
};
|
|
148
|
+
getContentModel: {
|
|
149
|
+
query: (
|
|
150
|
+
input: GetContentModelInput,
|
|
151
|
+
) => Promise<CompactGetContentModelResponse>;
|
|
152
|
+
};
|
|
153
|
+
listContentEntries: {
|
|
154
|
+
query: (
|
|
155
|
+
input: ListContentEntriesInput,
|
|
156
|
+
) => Promise<CompactListContentEntriesResponse>;
|
|
157
|
+
};
|
|
158
|
+
getContentEntry: {
|
|
159
|
+
query: (
|
|
160
|
+
input: GetContentEntryInput,
|
|
161
|
+
) => Promise<CompactContentEntryDetail>;
|
|
162
|
+
};
|
|
163
|
+
createContentEntry: {
|
|
164
|
+
mutate: (
|
|
165
|
+
input: CreateContentEntryInput,
|
|
166
|
+
) => Promise<CompactCreateContentEntryResponse>;
|
|
167
|
+
};
|
|
168
|
+
updateContentEntry: {
|
|
169
|
+
mutate: (
|
|
170
|
+
input: UpdateContentEntryInput,
|
|
171
|
+
) => Promise<CompactUpdateContentEntryResponse>;
|
|
172
|
+
};
|
|
173
|
+
publishContentEntry: {
|
|
174
|
+
mutate: (
|
|
175
|
+
input: PublishContentEntryInput,
|
|
176
|
+
) => Promise<CompactPublishContentEntryResponse>;
|
|
177
|
+
};
|
|
178
|
+
deleteContentEntry: {
|
|
179
|
+
mutate: (
|
|
180
|
+
input: DeleteContentEntryInput,
|
|
181
|
+
) => Promise<CompactDeleteContentEntryResponse>;
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Full API client interface with mcp and mcpContent namespaces.
|
|
111
187
|
*/
|
|
112
188
|
export interface APIClient {
|
|
113
189
|
mcp: MCPClient;
|
|
190
|
+
mcpContent: MCPContentClient;
|
|
114
191
|
}
|
package/src/compact-types.ts
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* { prj: "acme/main", sl: "en", tk: 150 }
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import type { SyncJobType, SyncJobStatus } from "./types";
|
|
20
|
+
import type { SyncJobType, SyncJobStatus, PendingPublishHint } from "./types";
|
|
21
21
|
|
|
22
22
|
// ============================================================================
|
|
23
23
|
// Compact Project Types
|
|
@@ -319,3 +319,117 @@ export interface CompactGetSyncResponse {
|
|
|
319
319
|
/** Affected keys */
|
|
320
320
|
aff_k: CompactAffectedKey[];
|
|
321
321
|
}
|
|
322
|
+
|
|
323
|
+
// ============================================================================
|
|
324
|
+
// Compact Write Response Types (createKeys, updateKeys, deleteKeys)
|
|
325
|
+
// ============================================================================
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Compact pending publish hint.
|
|
329
|
+
*
|
|
330
|
+
* Field Mappings:
|
|
331
|
+
* - has: hasChanges
|
|
332
|
+
* - cnt: count
|
|
333
|
+
* - hint: hint (unchanged - already useful)
|
|
334
|
+
*/
|
|
335
|
+
export interface CompactPendingPublishHint {
|
|
336
|
+
/** Whether there are unpublished changes */
|
|
337
|
+
has: boolean;
|
|
338
|
+
/** Number of pending changes */
|
|
339
|
+
cnt: number;
|
|
340
|
+
/** Hint message for AI */
|
|
341
|
+
hint: string;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Compact response from createKeys endpoint.
|
|
346
|
+
*
|
|
347
|
+
* Field Mappings:
|
|
348
|
+
* - ok: success
|
|
349
|
+
* - cnt: keysCreated
|
|
350
|
+
* - new: created
|
|
351
|
+
* - ren: renamed
|
|
352
|
+
* - dup: duplicates
|
|
353
|
+
* - k: keys array [{ k, id, tr }]
|
|
354
|
+
* - skip: skipped
|
|
355
|
+
* - pub: pendingPublish
|
|
356
|
+
*/
|
|
357
|
+
export interface CompactCreateKeysResponse {
|
|
358
|
+
/** Operation success */
|
|
359
|
+
ok: boolean;
|
|
360
|
+
/** Total keys created */
|
|
361
|
+
cnt: number;
|
|
362
|
+
/** New keys inserted */
|
|
363
|
+
new: number;
|
|
364
|
+
/** Soft-deleted keys renamed */
|
|
365
|
+
ren: number;
|
|
366
|
+
/** Duplicate keys skipped */
|
|
367
|
+
dup: number;
|
|
368
|
+
/** Created keys */
|
|
369
|
+
k: Array<{
|
|
370
|
+
/** Key name */
|
|
371
|
+
k: string;
|
|
372
|
+
/** Key UUID */
|
|
373
|
+
id: string;
|
|
374
|
+
/** Translations added count */
|
|
375
|
+
tr: number;
|
|
376
|
+
}>;
|
|
377
|
+
/** Skipped keys */
|
|
378
|
+
skip?: Array<{ k: string; reason: string }>;
|
|
379
|
+
/** Pending publish hint */
|
|
380
|
+
pub?: CompactPendingPublishHint;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Compact response from updateKeys endpoint.
|
|
385
|
+
*
|
|
386
|
+
* Field Mappings:
|
|
387
|
+
* - ok: success
|
|
388
|
+
* - cnt: keysUpdated
|
|
389
|
+
* - upd: updates array [{ k, lng, src }]
|
|
390
|
+
* - pub: pendingPublish
|
|
391
|
+
*/
|
|
392
|
+
export interface CompactUpdateKeysResponse {
|
|
393
|
+
/** Operation success */
|
|
394
|
+
ok: boolean;
|
|
395
|
+
/** Number of keys updated */
|
|
396
|
+
cnt: number;
|
|
397
|
+
/** Updated key details */
|
|
398
|
+
upd: Array<{
|
|
399
|
+
/** Key name */
|
|
400
|
+
k: string;
|
|
401
|
+
/** Languages updated */
|
|
402
|
+
lng: string[];
|
|
403
|
+
/** Source text updated */
|
|
404
|
+
src: boolean;
|
|
405
|
+
}>;
|
|
406
|
+
/** Pending publish hint */
|
|
407
|
+
pub?: CompactPendingPublishHint;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Compact response from deleteKeys endpoint.
|
|
412
|
+
*
|
|
413
|
+
* Field Mappings:
|
|
414
|
+
* - ok: success
|
|
415
|
+
* - cnt: markedCount
|
|
416
|
+
* - mk: marked keys [{ id, k, ns }]
|
|
417
|
+
* - skip: skipped key IDs
|
|
418
|
+
*/
|
|
419
|
+
export interface CompactDeleteKeysResponse {
|
|
420
|
+
/** Operation success */
|
|
421
|
+
ok: boolean;
|
|
422
|
+
/** Number of keys marked for deletion */
|
|
423
|
+
cnt: number;
|
|
424
|
+
/** Marked keys */
|
|
425
|
+
mk: Array<{
|
|
426
|
+
/** Key UUID */
|
|
427
|
+
id: string;
|
|
428
|
+
/** Key name */
|
|
429
|
+
k: string;
|
|
430
|
+
/** Namespace */
|
|
431
|
+
ns: string | null;
|
|
432
|
+
}>;
|
|
433
|
+
/** Skipped key IDs (not found) */
|
|
434
|
+
skip?: string[];
|
|
435
|
+
}
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Content API Compact Types
|
|
3
|
+
*
|
|
4
|
+
* Compact field name versions of content MCP API response types
|
|
5
|
+
* for optimal AI token efficiency. 40-60% token reduction.
|
|
6
|
+
*
|
|
7
|
+
* Field Naming Convention:
|
|
8
|
+
* - dn: displayName
|
|
9
|
+
* - sl: slug
|
|
10
|
+
* - ec: entryCount
|
|
11
|
+
* - slang: sourceLanguage
|
|
12
|
+
* - langs: availableLanguages
|
|
13
|
+
* - cfv: customFieldValues
|
|
14
|
+
* - tr: translations
|
|
15
|
+
* - mdl: contentModel
|
|
16
|
+
* - pub_at: publishedAt
|
|
17
|
+
* - img: featuredImage
|
|
18
|
+
* - c_at: createdAt
|
|
19
|
+
* - u_at: updatedAt
|
|
20
|
+
* - desc: description
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
// ============================================================================
|
|
24
|
+
// Compact Content Model Types
|
|
25
|
+
// ============================================================================
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Compact field definition.
|
|
29
|
+
*
|
|
30
|
+
* Field Mappings:
|
|
31
|
+
* - id: id (unchanged)
|
|
32
|
+
* - nm: name
|
|
33
|
+
* - dn: displayName
|
|
34
|
+
* - tp: type
|
|
35
|
+
* - loc: localized
|
|
36
|
+
* - req: required
|
|
37
|
+
* - ph: placeholder
|
|
38
|
+
* - ht: helpText
|
|
39
|
+
* - pos: position
|
|
40
|
+
*/
|
|
41
|
+
export interface CompactContentModelField {
|
|
42
|
+
id: string;
|
|
43
|
+
nm: string;
|
|
44
|
+
dn: string;
|
|
45
|
+
tp: string;
|
|
46
|
+
loc: boolean;
|
|
47
|
+
req: boolean;
|
|
48
|
+
ph: string | null;
|
|
49
|
+
ht: string | null;
|
|
50
|
+
pos: number;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Compact content model summary.
|
|
55
|
+
*
|
|
56
|
+
* Field Mappings:
|
|
57
|
+
* - id: id (unchanged)
|
|
58
|
+
* - sl: slug
|
|
59
|
+
* - dn: displayName
|
|
60
|
+
* - desc: description
|
|
61
|
+
* - kind: kind (unchanged - already short)
|
|
62
|
+
* - ico: icon
|
|
63
|
+
* - ec: entryCount
|
|
64
|
+
* - flds: fields
|
|
65
|
+
*/
|
|
66
|
+
export interface CompactContentModelSummary {
|
|
67
|
+
id: string;
|
|
68
|
+
sl: string;
|
|
69
|
+
dn: string;
|
|
70
|
+
desc: string | null;
|
|
71
|
+
kind: string;
|
|
72
|
+
ico: string | null;
|
|
73
|
+
ec: number;
|
|
74
|
+
flds: CompactContentModelField[];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Compact response from listContentModels.
|
|
79
|
+
*/
|
|
80
|
+
export interface CompactListContentModelsResponse {
|
|
81
|
+
mdls: CompactContentModelSummary[];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Compact response from getContentModel.
|
|
86
|
+
*
|
|
87
|
+
* Field Mappings:
|
|
88
|
+
* - id: id
|
|
89
|
+
* - sl: slug
|
|
90
|
+
* - dn: displayName
|
|
91
|
+
* - desc: description
|
|
92
|
+
* - kind: kind
|
|
93
|
+
* - ico: icon
|
|
94
|
+
* - vh: enableVersionHistory
|
|
95
|
+
* - flds: fields
|
|
96
|
+
*/
|
|
97
|
+
export interface CompactGetContentModelResponse {
|
|
98
|
+
id: string;
|
|
99
|
+
sl: string;
|
|
100
|
+
dn: string;
|
|
101
|
+
desc: string | null;
|
|
102
|
+
kind: string;
|
|
103
|
+
ico: string | null;
|
|
104
|
+
vh: boolean;
|
|
105
|
+
flds: CompactContentModelField[];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// ============================================================================
|
|
109
|
+
// Compact Content Entry Types
|
|
110
|
+
// ============================================================================
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Compact source translation summary.
|
|
114
|
+
*
|
|
115
|
+
* Field Mappings:
|
|
116
|
+
* - t: title
|
|
117
|
+
* - ex: excerpt
|
|
118
|
+
*/
|
|
119
|
+
export interface CompactSourceTranslationSummary {
|
|
120
|
+
t: string;
|
|
121
|
+
ex: string | null;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Compact author info.
|
|
126
|
+
*
|
|
127
|
+
* Field Mappings:
|
|
128
|
+
* - id: id
|
|
129
|
+
* - nm: name
|
|
130
|
+
* - img: image
|
|
131
|
+
*/
|
|
132
|
+
export interface CompactContentAuthor {
|
|
133
|
+
id: string;
|
|
134
|
+
nm: string | null;
|
|
135
|
+
img: string | null;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Compact content model reference.
|
|
140
|
+
*
|
|
141
|
+
* Field Mappings:
|
|
142
|
+
* - sl: slug
|
|
143
|
+
* - dn: displayName
|
|
144
|
+
* - kind: kind
|
|
145
|
+
*/
|
|
146
|
+
export interface CompactContentModelRef {
|
|
147
|
+
sl: string;
|
|
148
|
+
dn: string;
|
|
149
|
+
kind: string;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Compact content entry summary from listContentEntries.
|
|
154
|
+
*
|
|
155
|
+
* Field Mappings:
|
|
156
|
+
* - id: id
|
|
157
|
+
* - sl: slug
|
|
158
|
+
* - st: status
|
|
159
|
+
* - pub_at: publishedAt
|
|
160
|
+
* - c_at: createdAt
|
|
161
|
+
* - u_at: updatedAt
|
|
162
|
+
* - img: featuredImage
|
|
163
|
+
* - tags: tags (unchanged - already short)
|
|
164
|
+
* - mdl: contentModel
|
|
165
|
+
* - slang: sourceLanguage
|
|
166
|
+
* - src_tr: sourceTranslation
|
|
167
|
+
* - langs: availableLanguages
|
|
168
|
+
* - auth: author
|
|
169
|
+
* - cfv: customFieldValues
|
|
170
|
+
*/
|
|
171
|
+
export interface CompactContentEntrySummary {
|
|
172
|
+
id: string;
|
|
173
|
+
sl: string;
|
|
174
|
+
st: string;
|
|
175
|
+
pub_at: string | null;
|
|
176
|
+
c_at: string;
|
|
177
|
+
u_at: string;
|
|
178
|
+
img: string | null;
|
|
179
|
+
tags: string[];
|
|
180
|
+
mdl: CompactContentModelRef;
|
|
181
|
+
slang: string;
|
|
182
|
+
src_tr: CompactSourceTranslationSummary;
|
|
183
|
+
langs: string[];
|
|
184
|
+
auth: CompactContentAuthor | null;
|
|
185
|
+
cfv: Record<string, string | null>;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Compact response from listContentEntries.
|
|
190
|
+
*
|
|
191
|
+
* Field Mappings:
|
|
192
|
+
* - items: items (unchanged - standard pagination)
|
|
193
|
+
* - tot: total
|
|
194
|
+
* - more: hasMore
|
|
195
|
+
*/
|
|
196
|
+
export interface CompactListContentEntriesResponse {
|
|
197
|
+
items: CompactContentEntrySummary[];
|
|
198
|
+
tot: number;
|
|
199
|
+
more: boolean;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Compact full translation for a single language.
|
|
204
|
+
*
|
|
205
|
+
* Field Mappings:
|
|
206
|
+
* - id: id
|
|
207
|
+
* - lc: languageCode
|
|
208
|
+
* - t: title
|
|
209
|
+
* - ex: excerpt
|
|
210
|
+
* - body: body (unchanged - content payload)
|
|
211
|
+
* - mt: metaTitle
|
|
212
|
+
* - md: metaDescription
|
|
213
|
+
* - st: status
|
|
214
|
+
*/
|
|
215
|
+
export interface CompactContentEntryTranslation {
|
|
216
|
+
id: string;
|
|
217
|
+
lc: string;
|
|
218
|
+
t: string;
|
|
219
|
+
ex: string | null;
|
|
220
|
+
body: unknown;
|
|
221
|
+
mt: string | null;
|
|
222
|
+
md: string | null;
|
|
223
|
+
st: string;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Compact version history entry.
|
|
228
|
+
*
|
|
229
|
+
* Field Mappings:
|
|
230
|
+
* - id: id
|
|
231
|
+
* - v: version
|
|
232
|
+
* - lc: languageCode
|
|
233
|
+
* - chg: changeDescription
|
|
234
|
+
* - c_at: createdAt
|
|
235
|
+
* - by: createdBy
|
|
236
|
+
*/
|
|
237
|
+
export interface CompactContentEntryVersionInfo {
|
|
238
|
+
id: string;
|
|
239
|
+
v: number;
|
|
240
|
+
lc: string | null;
|
|
241
|
+
chg: string | null;
|
|
242
|
+
c_at: string;
|
|
243
|
+
by: CompactContentAuthor | null;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Compact full content entry detail from getContentEntry.
|
|
248
|
+
*
|
|
249
|
+
* Field Mappings:
|
|
250
|
+
* - id: id
|
|
251
|
+
* - sl: slug
|
|
252
|
+
* - st: status
|
|
253
|
+
* - pub_at: publishedAt
|
|
254
|
+
* - c_at: createdAt
|
|
255
|
+
* - u_at: updatedAt
|
|
256
|
+
* - img: featuredImage
|
|
257
|
+
* - tags: tags
|
|
258
|
+
* - slang: sourceLanguage
|
|
259
|
+
* - langs: availableLanguages
|
|
260
|
+
* - mdl: contentModel
|
|
261
|
+
* - auth: author
|
|
262
|
+
* - cfv: customFieldValues
|
|
263
|
+
* - tr: translations
|
|
264
|
+
* - vers: versions
|
|
265
|
+
*/
|
|
266
|
+
export interface CompactContentEntryDetail {
|
|
267
|
+
id: string;
|
|
268
|
+
sl: string;
|
|
269
|
+
st: string;
|
|
270
|
+
pub_at: string | null;
|
|
271
|
+
c_at: string;
|
|
272
|
+
u_at: string;
|
|
273
|
+
img: string | null;
|
|
274
|
+
tags: string[];
|
|
275
|
+
slang: string;
|
|
276
|
+
langs: string[];
|
|
277
|
+
mdl: CompactContentModelSummary;
|
|
278
|
+
auth: CompactContentAuthor | null;
|
|
279
|
+
cfv: Record<string, string | null>;
|
|
280
|
+
tr: Record<string, CompactContentEntryTranslation>;
|
|
281
|
+
vers: CompactContentEntryVersionInfo[];
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Compact response from createContentEntry / updateContentEntry / publishContentEntry.
|
|
286
|
+
*/
|
|
287
|
+
export type CompactCreateContentEntryResponse = CompactContentEntryDetail;
|
|
288
|
+
export type CompactUpdateContentEntryResponse = CompactContentEntryDetail;
|
|
289
|
+
export type CompactPublishContentEntryResponse = CompactContentEntryDetail;
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Compact response from deleteContentEntry.
|
|
293
|
+
*/
|
|
294
|
+
export interface CompactDeleteContentEntryResponse {
|
|
295
|
+
ok: true;
|
|
296
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Content API Schemas
|
|
3
|
+
*
|
|
4
|
+
* Zod validation schemas for content MCP router endpoints.
|
|
5
|
+
* These schemas use the projectIdentifierSchema base and add
|
|
6
|
+
* content-specific fields with .describe() for MCP tool descriptions.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
import { projectIdentifierSchema } from "./schemas";
|
|
11
|
+
|
|
12
|
+
// ============================================================================
|
|
13
|
+
// Read Schemas
|
|
14
|
+
// ============================================================================
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Input schema for listContentModels endpoint.
|
|
18
|
+
* Lists all content models for a project with entry counts.
|
|
19
|
+
*/
|
|
20
|
+
export const listContentModelsInput = projectIdentifierSchema;
|
|
21
|
+
export type ListContentModelsInput = z.input<typeof listContentModelsInput>;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Input schema for getContentModel endpoint.
|
|
25
|
+
* Gets a single content model by slug with its field definitions.
|
|
26
|
+
*/
|
|
27
|
+
export const getContentModelInput = projectIdentifierSchema.extend({
|
|
28
|
+
/** Content model slug (e.g., "blog-posts", "changelog") */
|
|
29
|
+
modelSlug: z.string().describe("Content model slug"),
|
|
30
|
+
});
|
|
31
|
+
export type GetContentModelInput = z.input<typeof getContentModelInput>;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Input schema for listContentEntries endpoint.
|
|
35
|
+
* Paginated listing of content entries with filtering.
|
|
36
|
+
*/
|
|
37
|
+
export const listContentEntriesInput = projectIdentifierSchema.extend({
|
|
38
|
+
/** Filter by content model slug */
|
|
39
|
+
modelSlug: z
|
|
40
|
+
.string()
|
|
41
|
+
.optional()
|
|
42
|
+
.describe("Filter by content model slug"),
|
|
43
|
+
/** Search in title/excerpt */
|
|
44
|
+
search: z
|
|
45
|
+
.string()
|
|
46
|
+
.optional()
|
|
47
|
+
.describe("Search in title or excerpt"),
|
|
48
|
+
/** Filter by entry status */
|
|
49
|
+
status: z
|
|
50
|
+
.enum(["draft", "published", "archived"])
|
|
51
|
+
.optional()
|
|
52
|
+
.describe("Filter by entry status"),
|
|
53
|
+
/** Filter by language code */
|
|
54
|
+
language: z
|
|
55
|
+
.string()
|
|
56
|
+
.optional()
|
|
57
|
+
.describe("Filter by language code (entries with this translation)"),
|
|
58
|
+
/** Page number (1-indexed) */
|
|
59
|
+
page: z.number().min(1).default(1).describe("Page number (1-indexed)"),
|
|
60
|
+
/** Results per page */
|
|
61
|
+
limit: z.number().min(1).max(50).default(20).describe("Results per page (max 50)"),
|
|
62
|
+
});
|
|
63
|
+
export type ListContentEntriesInput = z.input<typeof listContentEntriesInput>;
|
|
64
|
+
export type ListContentEntriesOutput = z.infer<typeof listContentEntriesInput>;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Input schema for getContentEntry endpoint.
|
|
68
|
+
* Gets a single content entry with all translations and field values.
|
|
69
|
+
*/
|
|
70
|
+
export const getContentEntryInput = projectIdentifierSchema.extend({
|
|
71
|
+
/** Content entry UUID */
|
|
72
|
+
entryId: z.string().uuid().describe("Content entry UUID"),
|
|
73
|
+
});
|
|
74
|
+
export type GetContentEntryInput = z.input<typeof getContentEntryInput>;
|
|
75
|
+
|
|
76
|
+
// ============================================================================
|
|
77
|
+
// Write Schemas
|
|
78
|
+
// ============================================================================
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Input schema for createContentEntry endpoint.
|
|
82
|
+
* Creates a new content entry with source translation.
|
|
83
|
+
*/
|
|
84
|
+
export const createContentEntryInput = projectIdentifierSchema.extend({
|
|
85
|
+
/** Content model slug to create entry in */
|
|
86
|
+
modelSlug: z.string().describe("Content model slug"),
|
|
87
|
+
/** Entry title (source language) */
|
|
88
|
+
title: z.string().describe("Entry title"),
|
|
89
|
+
/** URL slug for the entry */
|
|
90
|
+
slug: z.string().describe("URL slug"),
|
|
91
|
+
/** Short excerpt/summary */
|
|
92
|
+
excerpt: z.string().optional().describe("Short excerpt or summary"),
|
|
93
|
+
/** Plate editor JSON content */
|
|
94
|
+
body: z.unknown().optional().describe("Plate editor JSON content"),
|
|
95
|
+
/** Featured image URL */
|
|
96
|
+
featuredImage: z.string().url().optional().nullable().describe("Featured image URL"),
|
|
97
|
+
/** Tags for categorization */
|
|
98
|
+
tags: z.array(z.string()).optional().describe("Tags for categorization"),
|
|
99
|
+
/** Initial status */
|
|
100
|
+
status: z.enum(["draft", "published"]).default("draft").describe("Initial entry status"),
|
|
101
|
+
/** Custom field values (field_name → value) */
|
|
102
|
+
customFields: z
|
|
103
|
+
.record(z.string(), z.string().nullable())
|
|
104
|
+
.optional()
|
|
105
|
+
.default({})
|
|
106
|
+
.describe("Custom field values as { fieldName: value }"),
|
|
107
|
+
});
|
|
108
|
+
export type CreateContentEntryInput = z.input<typeof createContentEntryInput>;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Input schema for updateContentEntry endpoint.
|
|
112
|
+
* Updates a content entry's translation and/or metadata.
|
|
113
|
+
*/
|
|
114
|
+
export const updateContentEntryInput = projectIdentifierSchema.extend({
|
|
115
|
+
/** Content entry UUID */
|
|
116
|
+
entryId: z.string().uuid().describe("Content entry UUID"),
|
|
117
|
+
/** Language to update translation for */
|
|
118
|
+
languageCode: z.string().describe("Language to update translation for"),
|
|
119
|
+
/** Updated title */
|
|
120
|
+
title: z.string().optional().describe("Updated title"),
|
|
121
|
+
/** Updated slug */
|
|
122
|
+
slug: z.string().optional().describe("Updated URL slug"),
|
|
123
|
+
/** Updated excerpt */
|
|
124
|
+
excerpt: z.string().optional().describe("Updated excerpt"),
|
|
125
|
+
/** Updated body content */
|
|
126
|
+
body: z.unknown().optional().describe("Updated Plate editor JSON content"),
|
|
127
|
+
/** SEO meta title */
|
|
128
|
+
metaTitle: z.string().optional().describe("SEO meta title"),
|
|
129
|
+
/** SEO meta description */
|
|
130
|
+
metaDescription: z.string().optional().describe("SEO meta description"),
|
|
131
|
+
/** Updated featured image */
|
|
132
|
+
featuredImage: z.string().url().optional().nullable().describe("Updated featured image URL"),
|
|
133
|
+
/** Updated tags */
|
|
134
|
+
tags: z.array(z.string()).optional().describe("Updated tags"),
|
|
135
|
+
/** Updated status */
|
|
136
|
+
status: z
|
|
137
|
+
.enum(["draft", "published", "archived"])
|
|
138
|
+
.optional()
|
|
139
|
+
.describe("Updated entry status"),
|
|
140
|
+
/** Updated custom field values */
|
|
141
|
+
customFields: z
|
|
142
|
+
.record(z.string(), z.string().nullable())
|
|
143
|
+
.optional()
|
|
144
|
+
.describe("Updated custom field values"),
|
|
145
|
+
});
|
|
146
|
+
export type UpdateContentEntryInput = z.input<typeof updateContentEntryInput>;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Input schema for publishContentEntry endpoint.
|
|
150
|
+
* Sets entry status to published and approves source translation.
|
|
151
|
+
*/
|
|
152
|
+
export const publishContentEntryInput = projectIdentifierSchema.extend({
|
|
153
|
+
/** Content entry UUID */
|
|
154
|
+
entryId: z.string().uuid().describe("Content entry UUID"),
|
|
155
|
+
});
|
|
156
|
+
export type PublishContentEntryInput = z.input<typeof publishContentEntryInput>;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Input schema for deleteContentEntry endpoint.
|
|
160
|
+
* Hard-deletes a content entry and all its translations.
|
|
161
|
+
*/
|
|
162
|
+
export const deleteContentEntryInput = projectIdentifierSchema.extend({
|
|
163
|
+
/** Content entry UUID */
|
|
164
|
+
entryId: z.string().uuid().describe("Content entry UUID"),
|
|
165
|
+
});
|
|
166
|
+
export type DeleteContentEntryInput = z.input<typeof deleteContentEntryInput>;
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Content API Types (Verbose)
|
|
3
|
+
*
|
|
4
|
+
* TypeScript interfaces for content MCP router responses.
|
|
5
|
+
* These types define the contract between the API and MCP clients.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// ============================================================================
|
|
9
|
+
// Content Model Types
|
|
10
|
+
// ============================================================================
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Field definition within a content model.
|
|
14
|
+
*/
|
|
15
|
+
export interface ContentModelField {
|
|
16
|
+
/** Field UUID */
|
|
17
|
+
id: string;
|
|
18
|
+
/** Field name (snake_case identifier) */
|
|
19
|
+
name: string;
|
|
20
|
+
/** Display name */
|
|
21
|
+
displayName: string;
|
|
22
|
+
/** Field type */
|
|
23
|
+
type: string;
|
|
24
|
+
/** Whether field is localized per language */
|
|
25
|
+
localized: boolean;
|
|
26
|
+
/** Whether field is required */
|
|
27
|
+
required: boolean;
|
|
28
|
+
/** Placeholder text */
|
|
29
|
+
placeholder: string | null;
|
|
30
|
+
/** Help text */
|
|
31
|
+
helpText: string | null;
|
|
32
|
+
/** Sort position */
|
|
33
|
+
position: number;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Content model summary from listContentModels endpoint.
|
|
38
|
+
*/
|
|
39
|
+
export interface ContentModelSummary {
|
|
40
|
+
/** Model UUID */
|
|
41
|
+
id: string;
|
|
42
|
+
/** URL slug */
|
|
43
|
+
slug: string;
|
|
44
|
+
/** Display name */
|
|
45
|
+
displayName: string;
|
|
46
|
+
/** Description */
|
|
47
|
+
description: string | null;
|
|
48
|
+
/** Model kind (collection or single) */
|
|
49
|
+
kind: string;
|
|
50
|
+
/** Icon identifier */
|
|
51
|
+
icon: string | null;
|
|
52
|
+
/** Number of entries in this model */
|
|
53
|
+
entryCount: number;
|
|
54
|
+
/** Field definitions */
|
|
55
|
+
fields: ContentModelField[];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Response from listContentModels endpoint.
|
|
60
|
+
*/
|
|
61
|
+
export interface ListContentModelsResponse {
|
|
62
|
+
/** Content models */
|
|
63
|
+
models: ContentModelSummary[];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Response from getContentModel endpoint.
|
|
68
|
+
*/
|
|
69
|
+
export interface GetContentModelResponse {
|
|
70
|
+
/** Model UUID */
|
|
71
|
+
id: string;
|
|
72
|
+
/** URL slug */
|
|
73
|
+
slug: string;
|
|
74
|
+
/** Display name */
|
|
75
|
+
displayName: string;
|
|
76
|
+
/** Description */
|
|
77
|
+
description: string | null;
|
|
78
|
+
/** Model kind */
|
|
79
|
+
kind: string;
|
|
80
|
+
/** Icon identifier */
|
|
81
|
+
icon: string | null;
|
|
82
|
+
/** Whether version history is enabled */
|
|
83
|
+
enableVersionHistory: boolean;
|
|
84
|
+
/** Field definitions */
|
|
85
|
+
fields: ContentModelField[];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// ============================================================================
|
|
89
|
+
// Content Entry Types
|
|
90
|
+
// ============================================================================
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Source translation summary for list view.
|
|
94
|
+
*/
|
|
95
|
+
export interface SourceTranslationSummary {
|
|
96
|
+
/** Entry title */
|
|
97
|
+
title: string;
|
|
98
|
+
/** Entry excerpt */
|
|
99
|
+
excerpt: string | null;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Author info.
|
|
104
|
+
*/
|
|
105
|
+
export interface ContentAuthor {
|
|
106
|
+
/** User UUID */
|
|
107
|
+
id: string;
|
|
108
|
+
/** Display name */
|
|
109
|
+
name: string | null;
|
|
110
|
+
/** Avatar URL */
|
|
111
|
+
image: string | null;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Content model reference within an entry.
|
|
116
|
+
*/
|
|
117
|
+
export interface ContentModelRef {
|
|
118
|
+
/** Model slug */
|
|
119
|
+
slug: string;
|
|
120
|
+
/** Model display name */
|
|
121
|
+
displayName: string;
|
|
122
|
+
/** Model kind */
|
|
123
|
+
kind: string;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Content entry summary from listContentEntries endpoint.
|
|
128
|
+
*/
|
|
129
|
+
export interface ContentEntrySummary {
|
|
130
|
+
/** Entry UUID */
|
|
131
|
+
id: string;
|
|
132
|
+
/** URL slug */
|
|
133
|
+
slug: string;
|
|
134
|
+
/** Entry status */
|
|
135
|
+
status: string;
|
|
136
|
+
/** Published timestamp (ISO) or null */
|
|
137
|
+
publishedAt: string | null;
|
|
138
|
+
/** Created timestamp (ISO) */
|
|
139
|
+
createdAt: string;
|
|
140
|
+
/** Updated timestamp (ISO) */
|
|
141
|
+
updatedAt: string;
|
|
142
|
+
/** Featured image URL */
|
|
143
|
+
featuredImage: string | null;
|
|
144
|
+
/** Tags */
|
|
145
|
+
tags: string[];
|
|
146
|
+
/** Content model reference */
|
|
147
|
+
contentModel: ContentModelRef;
|
|
148
|
+
/** Source language code */
|
|
149
|
+
sourceLanguage: string;
|
|
150
|
+
/** Source translation (title + excerpt) */
|
|
151
|
+
sourceTranslation: SourceTranslationSummary;
|
|
152
|
+
/** Languages with translations */
|
|
153
|
+
availableLanguages: string[];
|
|
154
|
+
/** Author info */
|
|
155
|
+
author: ContentAuthor | null;
|
|
156
|
+
/** Custom field values (field_name → value) */
|
|
157
|
+
customFieldValues: Record<string, string | null>;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Response from listContentEntries endpoint.
|
|
162
|
+
*/
|
|
163
|
+
export interface ListContentEntriesResponse {
|
|
164
|
+
/** Content entries */
|
|
165
|
+
items: ContentEntrySummary[];
|
|
166
|
+
/** Total matching entries */
|
|
167
|
+
total: number;
|
|
168
|
+
/** Whether more pages exist */
|
|
169
|
+
hasMore: boolean;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Full translation for a single language within an entry.
|
|
174
|
+
*/
|
|
175
|
+
export interface ContentEntryTranslation {
|
|
176
|
+
/** Translation UUID */
|
|
177
|
+
id: string;
|
|
178
|
+
/** Language code */
|
|
179
|
+
languageCode: string;
|
|
180
|
+
/** Title */
|
|
181
|
+
title: string;
|
|
182
|
+
/** Excerpt */
|
|
183
|
+
excerpt: string | null;
|
|
184
|
+
/** Plate editor JSON body */
|
|
185
|
+
body: unknown;
|
|
186
|
+
/** SEO meta title */
|
|
187
|
+
metaTitle: string | null;
|
|
188
|
+
/** SEO meta description */
|
|
189
|
+
metaDescription: string | null;
|
|
190
|
+
/** Translation status */
|
|
191
|
+
status: string;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Version history entry.
|
|
196
|
+
*/
|
|
197
|
+
export interface ContentEntryVersionInfo {
|
|
198
|
+
/** Version UUID */
|
|
199
|
+
id: string;
|
|
200
|
+
/** Version number */
|
|
201
|
+
version: number;
|
|
202
|
+
/** Language code (null if applies to all languages) */
|
|
203
|
+
languageCode: string | null;
|
|
204
|
+
/** Change description */
|
|
205
|
+
changeDescription: string | null;
|
|
206
|
+
/** Created timestamp (ISO) */
|
|
207
|
+
createdAt: string;
|
|
208
|
+
/** Creator info */
|
|
209
|
+
createdBy: ContentAuthor | null;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Full content entry detail from getContentEntry endpoint.
|
|
214
|
+
*/
|
|
215
|
+
export interface ContentEntryDetail {
|
|
216
|
+
/** Entry UUID */
|
|
217
|
+
id: string;
|
|
218
|
+
/** URL slug */
|
|
219
|
+
slug: string;
|
|
220
|
+
/** Entry status */
|
|
221
|
+
status: string;
|
|
222
|
+
/** Published timestamp (ISO) or null */
|
|
223
|
+
publishedAt: string | null;
|
|
224
|
+
/** Created timestamp (ISO) */
|
|
225
|
+
createdAt: string;
|
|
226
|
+
/** Updated timestamp (ISO) */
|
|
227
|
+
updatedAt: string;
|
|
228
|
+
/** Featured image URL */
|
|
229
|
+
featuredImage: string | null;
|
|
230
|
+
/** Tags */
|
|
231
|
+
tags: string[];
|
|
232
|
+
/** Source language code */
|
|
233
|
+
sourceLanguage: string;
|
|
234
|
+
/** Languages with translations */
|
|
235
|
+
availableLanguages: string[];
|
|
236
|
+
/** Content model with fields */
|
|
237
|
+
contentModel: ContentModelSummary;
|
|
238
|
+
/** Author info */
|
|
239
|
+
author: ContentAuthor | null;
|
|
240
|
+
/** Custom field values */
|
|
241
|
+
customFieldValues: Record<string, string | null>;
|
|
242
|
+
/** Translations by language code */
|
|
243
|
+
translations: Record<string, ContentEntryTranslation>;
|
|
244
|
+
/** Version history */
|
|
245
|
+
versions: ContentEntryVersionInfo[];
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// ============================================================================
|
|
249
|
+
// Write Response Types
|
|
250
|
+
// ============================================================================
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Response from createContentEntry endpoint.
|
|
254
|
+
* Returns the full entry detail.
|
|
255
|
+
*/
|
|
256
|
+
export type CreateContentEntryResponse = ContentEntryDetail;
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Response from updateContentEntry endpoint.
|
|
260
|
+
* Returns the full entry detail.
|
|
261
|
+
*/
|
|
262
|
+
export type UpdateContentEntryResponse = ContentEntryDetail;
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Response from publishContentEntry endpoint.
|
|
266
|
+
* Returns the full entry detail.
|
|
267
|
+
*/
|
|
268
|
+
export type PublishContentEntryResponse = ContentEntryDetail;
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Response from deleteContentEntry endpoint.
|
|
272
|
+
*/
|
|
273
|
+
export interface DeleteContentEntryResponse {
|
|
274
|
+
/** Operation success */
|
|
275
|
+
success: true;
|
|
276
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -19,3 +19,12 @@ export * from "./compact-types";
|
|
|
19
19
|
|
|
20
20
|
// Re-export client types
|
|
21
21
|
export * from "./client-types";
|
|
22
|
+
|
|
23
|
+
// Re-export content schemas
|
|
24
|
+
export * from "./content-schemas";
|
|
25
|
+
|
|
26
|
+
// Re-export content types
|
|
27
|
+
export * from "./content-types";
|
|
28
|
+
|
|
29
|
+
// Re-export content compact types
|
|
30
|
+
export * from "./content-compact-types";
|