@opencx/mcp 1.15.39 → 1.15.41
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/help-center-content-tools.spec.d.ts +2 -0
- package/dist/help-center-content-tools.spec.d.ts.map +1 -0
- package/dist/help-center-content-tools.spec.js +399 -0
- package/dist/help-center-content-tools.spec.js.map +1 -0
- package/dist/schema.d.ts +3394 -2666
- package/dist/schema.d.ts.map +1 -1
- package/dist/tools/help-center.d.ts.map +1 -1
- package/dist/tools/help-center.js +588 -78
- package/dist/tools/help-center.js.map +1 -1
- package/package.json +1 -1
|
@@ -7,108 +7,618 @@ export function registerHelpCenterTools(server, client) {
|
|
|
7
7
|
const data = (await client.GET('/hc')).data;
|
|
8
8
|
return jsonContent(data);
|
|
9
9
|
});
|
|
10
|
-
server.registerTool('
|
|
11
|
-
description: '
|
|
10
|
+
server.registerTool('list_help_center_media', {
|
|
11
|
+
description: 'List all media files (images, documents) uploaded to a help center.',
|
|
12
12
|
inputSchema: {
|
|
13
13
|
help_center_id: z.string().describe('The help center ID'),
|
|
14
14
|
},
|
|
15
15
|
}, async ({ help_center_id }) => {
|
|
16
|
-
const data = (await client.GET('/hc/{id}/
|
|
16
|
+
const data = (await client.GET('/hc/{id}/media', {
|
|
17
17
|
params: { path: { id: help_center_id } },
|
|
18
18
|
})).data;
|
|
19
19
|
return jsonContent(data);
|
|
20
20
|
});
|
|
21
|
-
server.registerTool('
|
|
22
|
-
description: '
|
|
23
|
-
inputSchema: {
|
|
24
|
-
help_center_id: z.string().describe('The help center ID'),
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
21
|
+
server.registerTool('delete_help_center_media', {
|
|
22
|
+
description: 'Delete a media file from a help center.',
|
|
23
|
+
inputSchema: {
|
|
24
|
+
help_center_id: z.string().describe('The help center ID'),
|
|
25
|
+
media_id: z.string().describe('The media file ID to delete'),
|
|
26
|
+
},
|
|
27
|
+
}, async ({ help_center_id, media_id }) => {
|
|
28
|
+
const data = (await client.DELETE('/hc/{id}/media/{mediaId}', {
|
|
29
|
+
params: { path: { id: help_center_id, mediaId: media_id } },
|
|
30
|
+
})).data;
|
|
31
|
+
return jsonContent(data);
|
|
32
|
+
});
|
|
33
|
+
registerHelpCenterSiteTools(server, client);
|
|
34
|
+
registerHelpCenterGlossaryTools(server, client);
|
|
35
|
+
registerHelpCenterArticleTools(server, client);
|
|
36
|
+
registerHelpCenterTopicTools(server, client);
|
|
37
|
+
registerHelpCenterStructureTools(server, client);
|
|
38
|
+
}
|
|
39
|
+
/** One article at a time. */
|
|
40
|
+
function registerHelpCenterArticleTools(server, client) {
|
|
41
|
+
server.registerTool('list_help_center_articles', {
|
|
42
|
+
description: 'List the articles in a help center, with their topic and publish state. Start here to find the entity id of the article you want to read or change.',
|
|
43
|
+
inputSchema: {
|
|
44
|
+
help_center_id: z.string().describe('The help center ID'),
|
|
45
|
+
language_code: z
|
|
46
|
+
.string()
|
|
47
|
+
.optional()
|
|
48
|
+
.describe("Which language to list; defaults to the help center's primary language."),
|
|
49
|
+
},
|
|
50
|
+
}, async ({ help_center_id, language_code }) => {
|
|
51
|
+
const data = (await client.GET('/hc/{helpCenterId}/articles', {
|
|
52
|
+
params: {
|
|
53
|
+
path: { helpCenterId: help_center_id },
|
|
54
|
+
query: language_code ? { language_code } : {},
|
|
55
|
+
},
|
|
56
|
+
})).data;
|
|
57
|
+
return jsonContent(data);
|
|
58
|
+
});
|
|
59
|
+
server.registerTool('get_help_center_article', {
|
|
60
|
+
description: 'Read one article: its entity, the published version, the latest version, and the locale being asked for. Read this before any update so the content you send back is built on what is actually stored.',
|
|
61
|
+
inputSchema: {
|
|
62
|
+
help_center_id: z.string().describe('The help center ID'),
|
|
63
|
+
entity_id: z.string().describe('The article entity ID'),
|
|
64
|
+
language_code: z
|
|
65
|
+
.string()
|
|
66
|
+
.optional()
|
|
67
|
+
.describe("Which language to read; defaults to the help center's primary language."),
|
|
68
|
+
},
|
|
69
|
+
}, async ({ help_center_id, entity_id, language_code }) => {
|
|
70
|
+
const data = (await client.GET('/hc/{helpCenterId}/articles/{entityId}', {
|
|
71
|
+
params: {
|
|
72
|
+
path: { helpCenterId: help_center_id, entityId: entity_id },
|
|
73
|
+
query: language_code ? { language_code } : {},
|
|
74
|
+
},
|
|
75
|
+
})).data;
|
|
76
|
+
return jsonContent(data);
|
|
77
|
+
});
|
|
78
|
+
server.registerTool('list_help_center_article_versions', {
|
|
79
|
+
description: 'List the saved versions of an article in one language, newest first. Use it to see what changed and when, or to find a version to publish.',
|
|
80
|
+
inputSchema: {
|
|
81
|
+
help_center_id: z.string().describe('The help center ID'),
|
|
82
|
+
entity_id: z.string().describe('The article entity ID'),
|
|
83
|
+
language_code: z.string().optional().describe('Which language to list versions for.'),
|
|
84
|
+
},
|
|
85
|
+
}, async ({ help_center_id, entity_id, language_code }) => {
|
|
86
|
+
const data = (await client.GET('/hc/{helpCenterId}/articles/{entityId}/versions', {
|
|
87
|
+
params: {
|
|
88
|
+
path: { helpCenterId: help_center_id, entityId: entity_id },
|
|
89
|
+
query: language_code ? { language_code } : {},
|
|
90
|
+
},
|
|
91
|
+
})).data;
|
|
92
|
+
return jsonContent(data);
|
|
93
|
+
});
|
|
94
|
+
server.registerTool('create_help_center_article', {
|
|
95
|
+
description: 'Create an article in a topic. It is created unpublished: nothing reaches readers until someone publishes it. Content is markdown.',
|
|
96
|
+
inputSchema: {
|
|
97
|
+
help_center_id: z.string().describe('The help center ID'),
|
|
98
|
+
category_entity_id: z.string().describe('The topic to create the article in'),
|
|
99
|
+
title: z.string().describe('The article title'),
|
|
100
|
+
slug: z.string().optional().describe('URL path; derived from the title when omitted.'),
|
|
101
|
+
content_markdown: z.string().optional().describe('The article body, in markdown.'),
|
|
102
|
+
meta_title: z.string().optional().describe('Title tag for search engines.'),
|
|
103
|
+
meta_description: z.string().optional().describe('Meta description for search engines.'),
|
|
104
|
+
language_code: z
|
|
105
|
+
.string()
|
|
106
|
+
.optional()
|
|
107
|
+
.describe("The language the article is written in; defaults to the help center's primary language."),
|
|
108
|
+
},
|
|
109
|
+
}, async ({ help_center_id, ...body }) => {
|
|
110
|
+
const data = (await client.POST('/hc/{helpCenterId}/articles', {
|
|
111
|
+
params: { path: { helpCenterId: help_center_id } },
|
|
112
|
+
body,
|
|
113
|
+
})).data;
|
|
114
|
+
return jsonContent(data);
|
|
115
|
+
});
|
|
116
|
+
server.registerTool('update_help_center_article', {
|
|
117
|
+
description: "Replace an article's content with a new saved version. Read the article first with get_help_center_article and send the complete body back, not just the part you changed — this overwrites. The new version is unpublished until someone publishes it.",
|
|
118
|
+
inputSchema: {
|
|
119
|
+
help_center_id: z.string().describe('The help center ID'),
|
|
120
|
+
entity_id: z.string().describe('The article entity ID'),
|
|
121
|
+
title: z.string().describe('The article title'),
|
|
122
|
+
content_markdown: z.string().optional().describe('The complete article body, in markdown.'),
|
|
123
|
+
meta_title: z.string().optional().describe('Title tag for search engines.'),
|
|
124
|
+
meta_description: z.string().optional().describe('Meta description for search engines.'),
|
|
125
|
+
language_code: z.string().optional().describe('Which language version to write.'),
|
|
126
|
+
},
|
|
127
|
+
}, async ({ help_center_id, entity_id, ...body }) => {
|
|
128
|
+
const data = (await client.PUT('/hc/{helpCenterId}/articles/{entityId}', {
|
|
129
|
+
params: { path: { helpCenterId: help_center_id, entityId: entity_id } },
|
|
130
|
+
body,
|
|
131
|
+
})).data;
|
|
132
|
+
return jsonContent(data);
|
|
133
|
+
});
|
|
134
|
+
server.registerTool('publish_help_center_article', {
|
|
135
|
+
description: 'Publish an article, so readers can see it. Name a language to publish only that one; leave it out to publish every language the article has. ONLY call this when the person has asked for the article to go live — never as the tail end of an edit.',
|
|
136
|
+
inputSchema: {
|
|
137
|
+
help_center_id: z.string().describe('The help center ID'),
|
|
138
|
+
entity_id: z.string().describe('The article entity ID'),
|
|
139
|
+
language_code: z
|
|
140
|
+
.string()
|
|
141
|
+
.optional()
|
|
142
|
+
.describe('Publish only this language; omit to publish every language.'),
|
|
143
|
+
version_id: z
|
|
144
|
+
.string()
|
|
145
|
+
.optional()
|
|
146
|
+
.describe('Publish this specific version; defaults to the latest.'),
|
|
147
|
+
},
|
|
148
|
+
}, async ({ help_center_id, entity_id, language_code, version_id }) => {
|
|
149
|
+
// One language and all languages are two routes; which one the person
|
|
150
|
+
// meant is the presence of a language, not a second tool to choose from.
|
|
151
|
+
if (language_code) {
|
|
152
|
+
const data = (await client.POST('/hc/{helpCenterId}/articles/{entityId}/locales/{languageCode}/publish', {
|
|
153
|
+
params: {
|
|
154
|
+
path: {
|
|
155
|
+
helpCenterId: help_center_id,
|
|
156
|
+
entityId: entity_id,
|
|
157
|
+
languageCode: language_code,
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
body: version_id ? { locale_version_id: version_id } : {},
|
|
161
|
+
})).data;
|
|
162
|
+
return jsonContent(data);
|
|
163
|
+
}
|
|
164
|
+
const data = (await client.POST('/hc/{helpCenterId}/articles/{entityId}/publish', {
|
|
165
|
+
params: { path: { helpCenterId: help_center_id, entityId: entity_id } },
|
|
166
|
+
body: version_id ? { source_version_id: version_id } : {},
|
|
167
|
+
})).data;
|
|
168
|
+
return jsonContent(data);
|
|
169
|
+
});
|
|
170
|
+
server.registerTool('unpublish_help_center_article', {
|
|
171
|
+
description: 'Take an article off the live help center, in one language or in all of them. The content and its history are kept. ONLY on an explicit request.',
|
|
172
|
+
inputSchema: {
|
|
173
|
+
help_center_id: z.string().describe('The help center ID'),
|
|
174
|
+
entity_id: z.string().describe('The article entity ID'),
|
|
175
|
+
language_code: z
|
|
176
|
+
.string()
|
|
177
|
+
.optional()
|
|
178
|
+
.describe('Unpublish only this language; omit to unpublish every language.'),
|
|
179
|
+
},
|
|
180
|
+
}, async ({ help_center_id, entity_id, language_code }) => {
|
|
181
|
+
const data = (await client.POST('/hc/{helpCenterId}/articles/{entityId}/unpublish', {
|
|
182
|
+
params: { path: { helpCenterId: help_center_id, entityId: entity_id } },
|
|
183
|
+
body: language_code ? { language_code } : {},
|
|
184
|
+
})).data;
|
|
185
|
+
return jsonContent(data);
|
|
186
|
+
});
|
|
187
|
+
server.registerTool('delete_help_center_article', {
|
|
188
|
+
description: 'Delete an article. ONLY on an explicit request to delete — never to tidy up after another change. Ask first.',
|
|
189
|
+
inputSchema: {
|
|
190
|
+
help_center_id: z.string().describe('The help center ID'),
|
|
191
|
+
entity_id: z.string().describe('The article entity ID'),
|
|
192
|
+
},
|
|
193
|
+
}, async ({ help_center_id, entity_id }) => {
|
|
194
|
+
const data = (await client.DELETE('/hc/{helpCenterId}/articles/{entityId}', {
|
|
195
|
+
params: { path: { helpCenterId: help_center_id, entityId: entity_id } },
|
|
196
|
+
})).data;
|
|
197
|
+
return jsonContent(data);
|
|
198
|
+
});
|
|
199
|
+
server.registerTool('restore_help_center_article', {
|
|
200
|
+
description: 'Bring a deleted article back with its content and put it back in the tree. Only works while it is still recoverable.',
|
|
201
|
+
inputSchema: {
|
|
202
|
+
help_center_id: z.string().describe('The help center ID'),
|
|
203
|
+
entity_id: z.string().describe('The article entity ID'),
|
|
204
|
+
},
|
|
205
|
+
}, async ({ help_center_id, entity_id }) => {
|
|
206
|
+
const data = (await client.POST('/hc/{helpCenterId}/articles/{entityId}/restore-deleted', {
|
|
207
|
+
params: { path: { helpCenterId: help_center_id, entityId: entity_id } },
|
|
208
|
+
})).data;
|
|
209
|
+
return jsonContent(data);
|
|
210
|
+
});
|
|
211
|
+
server.registerTool('get_help_center_article_language_states', {
|
|
212
|
+
description: 'For each language of an article: whether it is live, whether it has changes nobody has published, and whether its translation is behind the source. Read this before publishing to know what will actually change.',
|
|
213
|
+
inputSchema: {
|
|
214
|
+
help_center_id: z.string().describe('The help center ID'),
|
|
215
|
+
entity_id: z.string().describe('The article entity ID'),
|
|
216
|
+
},
|
|
217
|
+
}, async ({ help_center_id, entity_id }) => {
|
|
218
|
+
const data = (await client.GET('/hc/{helpCenterId}/articles/{entityId}/language-states', {
|
|
219
|
+
params: { path: { helpCenterId: help_center_id, entityId: entity_id } },
|
|
220
|
+
})).data;
|
|
221
|
+
return jsonContent(data);
|
|
222
|
+
});
|
|
223
|
+
server.registerTool('retranslate_help_center_article', {
|
|
224
|
+
description: 'Translate an article again from its source language. Name a language to redo only that one; leave it out to redo every other language. This OVERWRITES what is there, including a translation someone wrote by hand. ONLY on an explicit request.',
|
|
225
|
+
inputSchema: {
|
|
226
|
+
help_center_id: z.string().describe('The help center ID'),
|
|
227
|
+
entity_id: z.string().describe('The article entity ID'),
|
|
228
|
+
language_code: z
|
|
229
|
+
.string()
|
|
230
|
+
.optional()
|
|
231
|
+
.describe('Redo only this language; omit to redo every other language.'),
|
|
232
|
+
},
|
|
233
|
+
}, async ({ help_center_id, entity_id, language_code }) => {
|
|
234
|
+
const path = { helpCenterId: help_center_id, entityId: entity_id };
|
|
235
|
+
const data = language_code
|
|
236
|
+
? (await client.POST('/hc/{helpCenterId}/articles/{entityId}/retranslate', {
|
|
237
|
+
params: { path },
|
|
238
|
+
body: { language_code },
|
|
239
|
+
})).data
|
|
240
|
+
: (await client.POST('/hc/{helpCenterId}/articles/{entityId}/retranslate-all', {
|
|
241
|
+
params: { path },
|
|
242
|
+
})).data;
|
|
243
|
+
return jsonContent(data);
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
/** Topics are the folders of a help center; every article lives in one. */
|
|
247
|
+
function registerHelpCenterTopicTools(server, client) {
|
|
248
|
+
server.registerTool('list_help_center_topics', {
|
|
249
|
+
description: 'List the topics of a help center. Topics can nest, so each one carries its parent.',
|
|
250
|
+
inputSchema: {
|
|
251
|
+
help_center_id: z.string().describe('The help center ID'),
|
|
252
|
+
language_code: z
|
|
253
|
+
.string()
|
|
254
|
+
.optional()
|
|
255
|
+
.describe("Which language to list; defaults to the help center's primary language."),
|
|
256
|
+
},
|
|
257
|
+
}, async ({ help_center_id, language_code }) => {
|
|
258
|
+
const data = (await client.GET('/hc/{helpCenterId}/categories', {
|
|
259
|
+
params: {
|
|
260
|
+
path: { helpCenterId: help_center_id },
|
|
261
|
+
query: language_code ? { language_code } : {},
|
|
262
|
+
},
|
|
263
|
+
})).data;
|
|
264
|
+
return jsonContent(data);
|
|
265
|
+
});
|
|
266
|
+
server.registerTool('get_help_center_topic', {
|
|
267
|
+
description: 'Read one topic and the names it has in each language.',
|
|
268
|
+
inputSchema: {
|
|
269
|
+
help_center_id: z.string().describe('The help center ID'),
|
|
270
|
+
category_entity_id: z.string().describe('The topic entity ID'),
|
|
271
|
+
language_code: z.string().optional().describe('Which language to read.'),
|
|
272
|
+
},
|
|
273
|
+
}, async ({ help_center_id, category_entity_id, language_code }) => {
|
|
274
|
+
const data = (await client.GET('/hc/{helpCenterId}/categories/{categoryEntityId}', {
|
|
275
|
+
params: {
|
|
276
|
+
path: { helpCenterId: help_center_id, categoryEntityId: category_entity_id },
|
|
277
|
+
query: language_code ? { language_code } : {},
|
|
278
|
+
},
|
|
279
|
+
})).data;
|
|
280
|
+
return jsonContent(data);
|
|
281
|
+
});
|
|
282
|
+
server.registerTool('create_help_center_topic', {
|
|
283
|
+
description: 'Create a topic, at the top level or inside another topic.',
|
|
284
|
+
inputSchema: {
|
|
285
|
+
help_center_id: z.string().describe('The help center ID'),
|
|
286
|
+
name: z.string().describe('The topic name'),
|
|
287
|
+
slug: z.string().optional().describe('URL path; derived from the name when omitted.'),
|
|
288
|
+
description: z
|
|
289
|
+
.string()
|
|
290
|
+
.optional()
|
|
291
|
+
.describe('Short blurb shown under the topic name on the help-center home grid.'),
|
|
292
|
+
icon: z
|
|
293
|
+
.string()
|
|
294
|
+
.optional()
|
|
295
|
+
.describe("Lucide icon name in kebab-case (e.g. 'folder', 'credit-card' — see lucide.dev/icons). An unknown name renders no icon."),
|
|
296
|
+
parent_id: z
|
|
297
|
+
.string()
|
|
298
|
+
.nullable()
|
|
299
|
+
.optional()
|
|
300
|
+
.describe('Create it inside this topic; omit or null for a top-level topic.'),
|
|
301
|
+
},
|
|
302
|
+
}, async ({ help_center_id, ...body }) => {
|
|
303
|
+
const data = (await client.POST('/hc/{helpCenterId}/categories', {
|
|
304
|
+
params: { path: { helpCenterId: help_center_id } },
|
|
305
|
+
body,
|
|
306
|
+
})).data;
|
|
307
|
+
return jsonContent(data);
|
|
308
|
+
});
|
|
309
|
+
server.registerTool('update_help_center_topic', {
|
|
310
|
+
description: 'Rename a topic or change its blurb or icon. Omitting the description CLEARS it, so send the current one back if you only mean to change something else. Writing the primary language re-translates the others; writing another language edits that translation only. Use move_help_center_topic to move it.',
|
|
311
|
+
inputSchema: {
|
|
312
|
+
help_center_id: z.string().describe('The help center ID'),
|
|
313
|
+
category_entity_id: z.string().describe('The topic entity ID'),
|
|
314
|
+
name: z.string().describe('The topic name'),
|
|
315
|
+
description: z
|
|
316
|
+
.string()
|
|
317
|
+
.optional()
|
|
318
|
+
.describe('Short blurb shown under the topic name. Omitting it CLEARS the stored one.'),
|
|
319
|
+
icon: z
|
|
320
|
+
.string()
|
|
321
|
+
.nullable()
|
|
322
|
+
.optional()
|
|
323
|
+
.describe('Lucide icon name in kebab-case; null clears it, omitted leaves it alone.'),
|
|
324
|
+
language_code: z
|
|
325
|
+
.string()
|
|
326
|
+
.optional()
|
|
327
|
+
.describe("Which language's name and blurb to write; defaults to the help center's primary language."),
|
|
328
|
+
},
|
|
329
|
+
}, async ({ help_center_id, category_entity_id, ...body }) => {
|
|
330
|
+
const data = (await client.PUT('/hc/{helpCenterId}/categories/{categoryEntityId}', {
|
|
331
|
+
params: {
|
|
332
|
+
path: { helpCenterId: help_center_id, categoryEntityId: category_entity_id },
|
|
333
|
+
},
|
|
334
|
+
body,
|
|
335
|
+
})).data;
|
|
336
|
+
return jsonContent(data);
|
|
337
|
+
});
|
|
338
|
+
server.registerTool('delete_help_center_topic', {
|
|
339
|
+
description: 'Delete a topic. Everything inside it — articles and subtopics — is deleted with it unless you name a topic to move them to. ONLY on an explicit request, and say what will go with it before you do.',
|
|
340
|
+
inputSchema: {
|
|
341
|
+
help_center_id: z.string().describe('The help center ID'),
|
|
342
|
+
category_entity_id: z.string().describe('The topic entity ID'),
|
|
343
|
+
move_contents_to: z
|
|
344
|
+
.string()
|
|
345
|
+
.optional()
|
|
346
|
+
.describe("Move this topic's articles and subtopics under this topic instead of deleting them."),
|
|
347
|
+
},
|
|
348
|
+
}, async ({ help_center_id, category_entity_id, move_contents_to }) => {
|
|
349
|
+
const data = (await client.DELETE('/hc/{helpCenterId}/categories/{categoryEntityId}', {
|
|
350
|
+
params: {
|
|
351
|
+
path: { helpCenterId: help_center_id, categoryEntityId: category_entity_id },
|
|
352
|
+
query: move_contents_to ? { move_contents_to } : {},
|
|
353
|
+
},
|
|
354
|
+
})).data;
|
|
355
|
+
return jsonContent(data);
|
|
356
|
+
});
|
|
357
|
+
server.registerTool('restore_help_center_topic', {
|
|
358
|
+
description: 'Bring a deleted topic back and put it back in the tree. Only works while it is still recoverable.',
|
|
359
|
+
inputSchema: {
|
|
360
|
+
help_center_id: z.string().describe('The help center ID'),
|
|
361
|
+
category_entity_id: z.string().describe('The topic entity ID'),
|
|
362
|
+
},
|
|
363
|
+
}, async ({ help_center_id, category_entity_id }) => {
|
|
364
|
+
const data = (await client.POST('/hc/{helpCenterId}/categories/{categoryEntityId}/restore-deleted', {
|
|
365
|
+
params: {
|
|
366
|
+
path: { helpCenterId: help_center_id, categoryEntityId: category_entity_id },
|
|
367
|
+
},
|
|
368
|
+
})).data;
|
|
369
|
+
return jsonContent(data);
|
|
370
|
+
});
|
|
371
|
+
server.registerTool('retranslate_help_center_topic', {
|
|
372
|
+
description: "Translate a topic's name and blurb again. Name a language to redo only that one; leave it out to redo every other language. This OVERWRITES what is there. ONLY on an explicit request.",
|
|
373
|
+
inputSchema: {
|
|
374
|
+
help_center_id: z.string().describe('The help center ID'),
|
|
375
|
+
category_entity_id: z.string().describe('The topic entity ID'),
|
|
376
|
+
language_code: z
|
|
377
|
+
.string()
|
|
378
|
+
.optional()
|
|
379
|
+
.describe('Redo only this language; omit to redo every other language.'),
|
|
380
|
+
},
|
|
381
|
+
}, async ({ help_center_id, category_entity_id, language_code }) => {
|
|
382
|
+
const path = { helpCenterId: help_center_id, categoryEntityId: category_entity_id };
|
|
383
|
+
const data = language_code
|
|
384
|
+
? (await client.POST('/hc/{helpCenterId}/categories/{categoryEntityId}/retranslate', {
|
|
385
|
+
params: { path },
|
|
386
|
+
body: { language_code },
|
|
387
|
+
})).data
|
|
388
|
+
: (await client.POST('/hc/{helpCenterId}/categories/{categoryEntityId}/retranslate-all', {
|
|
389
|
+
params: { path },
|
|
390
|
+
})).data;
|
|
391
|
+
return jsonContent(data);
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* The help center itself: how it is branded, what it injects into the page,
|
|
396
|
+
* and which languages it serves. Not its content — that is the article and
|
|
397
|
+
* topic tools above.
|
|
398
|
+
*/
|
|
399
|
+
function registerHelpCenterSiteTools(server, client) {
|
|
400
|
+
server.registerTool('get_help_center', {
|
|
401
|
+
description: 'Read one help center: name, description, domain, logo, theme, custom CSS and head scripts, sidebar layout, translation prompt, the languages it serves, whether it auto-translates, and the per-language title/description overrides. Read this before changing anything on it.',
|
|
402
|
+
inputSchema: {
|
|
403
|
+
help_center_id: z.string().describe('The help center ID'),
|
|
404
|
+
},
|
|
405
|
+
}, async ({ help_center_id }) => {
|
|
406
|
+
const data = (await client.GET('/hc/{id}', { params: { path: { id: help_center_id } } }))
|
|
407
|
+
.data;
|
|
408
|
+
return jsonContent(data);
|
|
409
|
+
});
|
|
410
|
+
server.registerTool('update_help_center', {
|
|
411
|
+
description: 'Change the help center itself. Only the fields you send are changed, except localizations, which REPLACE what is stored — read the help center first and send the whole map back. Custom CSS and head scripts run on every page for every reader, so treat them as production changes and say what you are injecting before you do it.',
|
|
412
|
+
inputSchema: {
|
|
413
|
+
help_center_id: z.string().describe('The help center ID'),
|
|
414
|
+
name: z.string().optional().describe('The help center name, in the primary language.'),
|
|
415
|
+
description: z.string().optional().describe('Tagline shown under the name.'),
|
|
416
|
+
domain: z
|
|
417
|
+
.string()
|
|
418
|
+
.optional()
|
|
419
|
+
.describe('Custom domain, e.g. help.example.com — no scheme, no path.'),
|
|
420
|
+
logo_url: z.string().nullable().optional().describe('Logo image URL; null removes it.'),
|
|
421
|
+
translation_prompt: z
|
|
422
|
+
.string()
|
|
423
|
+
.nullable()
|
|
424
|
+
.optional()
|
|
425
|
+
.describe('Extra standing instructions for the translator — tone, formality, what never to translate. Applies to translations made from now on; null clears it.'),
|
|
426
|
+
custom_css: z
|
|
427
|
+
.string()
|
|
428
|
+
.nullable()
|
|
429
|
+
.optional()
|
|
430
|
+
.describe('CSS injected into every page; null removes it.'),
|
|
431
|
+
custom_head_scripts: z
|
|
432
|
+
.string()
|
|
433
|
+
.nullable()
|
|
434
|
+
.optional()
|
|
435
|
+
.describe('HTML injected into <head> on every page — analytics, fonts, verification tags. null removes it.'),
|
|
436
|
+
sidebar_variant: z
|
|
437
|
+
.enum(['sidebar', 'floating', 'inset'])
|
|
438
|
+
.optional()
|
|
439
|
+
.describe('How the navigation sidebar is laid out.'),
|
|
440
|
+
localizations: z
|
|
441
|
+
.record(z.string(), z.object({
|
|
442
|
+
title: z.string().optional(),
|
|
443
|
+
description: z.string().nullable().optional(),
|
|
59
444
|
}))
|
|
60
|
-
.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
name: sub.title,
|
|
75
|
-
slug: sub.slug,
|
|
76
|
-
description: sub.description,
|
|
77
|
-
articles: (sub.articles ?? []).map((a) => ({
|
|
78
|
-
title: a.title,
|
|
79
|
-
slug: a.slug,
|
|
80
|
-
content_markdown: a.content,
|
|
81
|
-
})),
|
|
82
|
-
})),
|
|
83
|
-
}));
|
|
84
|
-
const data = (await client.POST('/hc/{id}/sync', {
|
|
445
|
+
.optional()
|
|
446
|
+
.describe('Per-language site title and description, keyed by language code. REPLACES the stored map: a language you leave out loses its override and falls back to the primary-language name.'),
|
|
447
|
+
},
|
|
448
|
+
}, async ({ help_center_id, ...body }) => {
|
|
449
|
+
const data = (await client.PUT('/hc/{id}', { params: { path: { id: help_center_id } }, body })).data;
|
|
450
|
+
return jsonContent(data);
|
|
451
|
+
});
|
|
452
|
+
server.registerTool('list_help_center_translation_jobs', {
|
|
453
|
+
description: 'Translations that have not landed: still queued, running, or failed on their last attempt. Read each one’s status — `pending` and `running` are still working, `failed` errored and may be retried. Only an empty list means every language is there. Check it after a publish or a retranslate before telling anyone the article is live everywhere.',
|
|
454
|
+
inputSchema: {
|
|
455
|
+
help_center_id: z.string().describe('The help center ID'),
|
|
456
|
+
},
|
|
457
|
+
}, async ({ help_center_id }) => {
|
|
458
|
+
const data = (await client.GET('/hc/{id}/translation-jobs', {
|
|
85
459
|
params: { path: { id: help_center_id } },
|
|
86
|
-
body: { categories: mappedCategories },
|
|
87
460
|
})).data;
|
|
88
461
|
return jsonContent(data);
|
|
89
462
|
});
|
|
90
|
-
server.registerTool('
|
|
91
|
-
description: '
|
|
463
|
+
server.registerTool('update_help_center_languages', {
|
|
464
|
+
description: 'Change which languages the help center serves, and whether publishing a source article translates it automatically. enabled_languages REPLACES the list — read it first and send the whole list back; dropping a language stops serving it to readers. The primary language cannot be changed.',
|
|
465
|
+
inputSchema: {
|
|
466
|
+
help_center_id: z.string().describe('The help center ID'),
|
|
467
|
+
enabled_languages: z
|
|
468
|
+
.array(z.string())
|
|
469
|
+
.optional()
|
|
470
|
+
.describe('The complete list of language codes the site is served in.'),
|
|
471
|
+
auto_translate: z
|
|
472
|
+
.enum(['on_publish', 'off'])
|
|
473
|
+
.optional()
|
|
474
|
+
.describe("'on_publish' translates an article into every other enabled language when its source language is published; 'off' leaves translation to retranslate_help_center_article."),
|
|
475
|
+
},
|
|
476
|
+
}, async ({ help_center_id, ...body }) => {
|
|
477
|
+
const data = (await client.PUT('/hc/{id}/languages', {
|
|
478
|
+
params: { path: { id: help_center_id } },
|
|
479
|
+
body,
|
|
480
|
+
})).data;
|
|
481
|
+
return jsonContent(data);
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
/** Terms the translator must render exactly as defined, never paraphrased. */
|
|
485
|
+
function registerHelpCenterGlossaryTools(server, client) {
|
|
486
|
+
server.registerTool('list_help_center_glossary_terms', {
|
|
487
|
+
description: 'List the translation glossary: terms the translator keeps exactly as defined — product names, feature names, anything that must survive translation unchanged.',
|
|
92
488
|
inputSchema: {
|
|
93
489
|
help_center_id: z.string().describe('The help center ID'),
|
|
94
490
|
},
|
|
95
491
|
}, async ({ help_center_id }) => {
|
|
96
|
-
const data = (await client.GET('/hc/{id}/
|
|
492
|
+
const data = (await client.GET('/hc/{id}/glossary', { params: { path: { id: help_center_id } } })).data;
|
|
493
|
+
return jsonContent(data);
|
|
494
|
+
});
|
|
495
|
+
server.registerTool('create_help_center_glossary_term', {
|
|
496
|
+
description: 'Add a term the translator must keep as defined. It applies to translations made from now on; articles already translated keep their wording until they are retranslated.',
|
|
497
|
+
inputSchema: {
|
|
498
|
+
help_center_id: z.string().describe('The help center ID'),
|
|
499
|
+
term: z.string().describe('The term as it appears in the source language.'),
|
|
500
|
+
definition: z
|
|
501
|
+
.string()
|
|
502
|
+
.describe('What it means, or how it must be rendered in other languages.'),
|
|
503
|
+
},
|
|
504
|
+
}, async ({ help_center_id, ...body }) => {
|
|
505
|
+
const data = (await client.POST('/hc/{id}/glossary', {
|
|
97
506
|
params: { path: { id: help_center_id } },
|
|
507
|
+
body,
|
|
98
508
|
})).data;
|
|
99
509
|
return jsonContent(data);
|
|
100
510
|
});
|
|
101
|
-
server.registerTool('
|
|
102
|
-
description: '
|
|
511
|
+
server.registerTool('import_help_center_glossary_terms', {
|
|
512
|
+
description: 'Copy the organization-wide translation glossary into this help center in one call. Terms already here are left alone; the answer says how many were added.',
|
|
103
513
|
inputSchema: {
|
|
104
514
|
help_center_id: z.string().describe('The help center ID'),
|
|
105
|
-
media_id: z.string().describe('The media file ID to delete'),
|
|
106
515
|
},
|
|
107
|
-
}, async ({ help_center_id
|
|
108
|
-
await client.
|
|
109
|
-
params: { path: { id: help_center_id
|
|
110
|
-
});
|
|
111
|
-
return
|
|
516
|
+
}, async ({ help_center_id }) => {
|
|
517
|
+
const data = (await client.POST('/hc/{id}/glossary/import-from-translation', {
|
|
518
|
+
params: { path: { id: help_center_id } },
|
|
519
|
+
})).data;
|
|
520
|
+
return jsonContent(data);
|
|
521
|
+
});
|
|
522
|
+
server.registerTool('update_help_center_glossary_term', {
|
|
523
|
+
description: 'Change a glossary term or its definition.',
|
|
524
|
+
inputSchema: {
|
|
525
|
+
help_center_id: z.string().describe('The help center ID'),
|
|
526
|
+
term_id: z.string().describe('The glossary term ID'),
|
|
527
|
+
term: z.string().optional().describe('The new term.'),
|
|
528
|
+
definition: z.string().optional().describe('The new definition.'),
|
|
529
|
+
},
|
|
530
|
+
}, async ({ help_center_id, term_id, ...body }) => {
|
|
531
|
+
const data = (await client.PUT('/hc/{id}/glossary/{termId}', {
|
|
532
|
+
params: { path: { id: help_center_id, termId: term_id } },
|
|
533
|
+
body,
|
|
534
|
+
})).data;
|
|
535
|
+
return jsonContent(data);
|
|
536
|
+
});
|
|
537
|
+
server.registerTool('delete_help_center_glossary_term', {
|
|
538
|
+
description: 'Remove a glossary term. Later translations are free to render it however they like.',
|
|
539
|
+
inputSchema: {
|
|
540
|
+
help_center_id: z.string().describe('The help center ID'),
|
|
541
|
+
term_id: z.string().describe('The glossary term ID'),
|
|
542
|
+
},
|
|
543
|
+
}, async ({ help_center_id, term_id }) => {
|
|
544
|
+
const data = (await client.DELETE('/hc/{id}/glossary/{termId}', {
|
|
545
|
+
params: { path: { id: help_center_id, termId: term_id } },
|
|
546
|
+
})).data;
|
|
547
|
+
return jsonContent(data);
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* Where things sit and in what order. Each language has its own tree, so a
|
|
552
|
+
* move in one language leaves the others where they are.
|
|
553
|
+
*/
|
|
554
|
+
function registerHelpCenterStructureTools(server, client) {
|
|
555
|
+
server.registerTool('get_help_center_tree', {
|
|
556
|
+
description: 'The whole help center for one language: nested topics with their articles, in the order readers see them. Each article says whether it has a version, a published version and an unsaved draft. Read this before moving or reordering anything.',
|
|
557
|
+
inputSchema: {
|
|
558
|
+
help_center_id: z.string().describe('The help center ID'),
|
|
559
|
+
language_code: z.string().describe('Which language tree to read.'),
|
|
560
|
+
},
|
|
561
|
+
}, async ({ help_center_id, language_code }) => {
|
|
562
|
+
const data = (await client.GET('/hc/{helpCenterId}/structure/tree', {
|
|
563
|
+
params: { path: { helpCenterId: help_center_id }, query: { language_code } },
|
|
564
|
+
})).data;
|
|
565
|
+
return jsonContent(data);
|
|
566
|
+
});
|
|
567
|
+
server.registerTool('move_help_center_article', {
|
|
568
|
+
description: 'Put an article in a topic, at a given place in its list. Affects only the named language; the other languages keep their own order.',
|
|
569
|
+
inputSchema: {
|
|
570
|
+
help_center_id: z.string().describe('The help center ID'),
|
|
571
|
+
article_entity_id: z.string().describe('The article entity ID'),
|
|
572
|
+
category_entity_id: z.string().describe('The topic to put it in'),
|
|
573
|
+
language_code: z.string().describe("Which language's tree to change."),
|
|
574
|
+
position: z.number().int().min(0).describe('Where in the topic it goes; 0 is first.'),
|
|
575
|
+
},
|
|
576
|
+
}, async ({ help_center_id, ...body }) => {
|
|
577
|
+
const data = (await client.POST('/hc/{helpCenterId}/structure/move-article', {
|
|
578
|
+
params: { path: { helpCenterId: help_center_id } },
|
|
579
|
+
body,
|
|
580
|
+
})).data;
|
|
581
|
+
return jsonContent(data);
|
|
582
|
+
});
|
|
583
|
+
server.registerTool('move_help_center_topic', {
|
|
584
|
+
description: 'Put a topic inside another topic, or at the top level, at a given place in the list. Affects only the named language. Moving a topic into itself or one of its own subtopics is rejected.',
|
|
585
|
+
inputSchema: {
|
|
586
|
+
help_center_id: z.string().describe('The help center ID'),
|
|
587
|
+
category_entity_id: z.string().describe('The topic entity ID'),
|
|
588
|
+
parent_category_entity_id: z
|
|
589
|
+
.string()
|
|
590
|
+
.nullable()
|
|
591
|
+
.describe('The topic to put it inside; null for the top level.'),
|
|
592
|
+
language_code: z.string().describe("Which language's tree to change."),
|
|
593
|
+
position: z.number().int().min(0).describe('Where among its siblings it goes; 0 is first.'),
|
|
594
|
+
},
|
|
595
|
+
}, async ({ help_center_id, ...body }) => {
|
|
596
|
+
const data = (await client.POST('/hc/{helpCenterId}/structure/move-topic', {
|
|
597
|
+
params: { path: { helpCenterId: help_center_id } },
|
|
598
|
+
body,
|
|
599
|
+
})).data;
|
|
600
|
+
return jsonContent(data);
|
|
601
|
+
});
|
|
602
|
+
server.registerTool('reorder_help_center_tree', {
|
|
603
|
+
description: 'Set the order of everything directly inside one topic — subtopics and articles together. ordered_ids is the complete new order; read get_help_center_tree first, because an id you leave out is not moved but the ones you list are placed around it.',
|
|
604
|
+
inputSchema: {
|
|
605
|
+
help_center_id: z.string().describe('The help center ID'),
|
|
606
|
+
parent_category_entity_id: z
|
|
607
|
+
.string()
|
|
608
|
+
.nullable()
|
|
609
|
+
.describe('Whose children to reorder; null for the top level.'),
|
|
610
|
+
language_code: z.string().describe("Which language's tree to change."),
|
|
611
|
+
ordered_ids: z
|
|
612
|
+
.array(z.string())
|
|
613
|
+
.min(1)
|
|
614
|
+
.describe('Entity ids of the children, in the order they should appear.'),
|
|
615
|
+
},
|
|
616
|
+
}, async ({ help_center_id, ...body }) => {
|
|
617
|
+
const data = (await client.POST('/hc/{helpCenterId}/structure/reorder', {
|
|
618
|
+
params: { path: { helpCenterId: help_center_id } },
|
|
619
|
+
body,
|
|
620
|
+
})).data;
|
|
621
|
+
return jsonContent(data);
|
|
112
622
|
});
|
|
113
623
|
}
|
|
114
624
|
//# sourceMappingURL=help-center.js.map
|