@contentful/mcp-server 1.4.0 → 1.6.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/build/tools/context/instructions.js +3 -0
- package/build/tools/context/instructions.js.map +1 -1
- package/build/tools/jobs/register.js +5 -0
- package/build/tools/jobs/register.js.map +1 -0
- package/build/tools/jobs/space-to-space-migration/exportSpace.js +148 -0
- package/build/tools/jobs/space-to-space-migration/exportSpace.js.map +1 -0
- package/build/tools/jobs/space-to-space-migration/importSpace.js +127 -0
- package/build/tools/jobs/space-to-space-migration/importSpace.js.map +1 -0
- package/build/tools/jobs/space-to-space-migration/instructions.js +33 -0
- package/build/tools/jobs/space-to-space-migration/instructions.js.map +1 -0
- package/build/tools/jobs/space-to-space-migration/migrationHandler.js +45 -0
- package/build/tools/jobs/space-to-space-migration/migrationHandler.js.map +1 -0
- package/build/tools/jobs/space-to-space-migration/mockClient.js +156 -0
- package/build/tools/jobs/space-to-space-migration/mockClient.js.map +1 -0
- package/build/tools/jobs/space-to-space-migration/paramCollection.js +288 -0
- package/build/tools/jobs/space-to-space-migration/paramCollection.js.map +1 -0
- package/build/tools/jobs/space-to-space-migration/register.js +23 -0
- package/build/tools/jobs/space-to-space-migration/register.js.map +1 -0
- package/build/tools/register.js +4 -0
- package/build/tools/register.js.map +1 -1
- package/build/tools/taxonomies/concept-schemes/createConceptScheme.js +78 -0
- package/build/tools/taxonomies/concept-schemes/createConceptScheme.js.map +1 -0
- package/build/tools/taxonomies/concept-schemes/deleteConceptScheme.js +27 -0
- package/build/tools/taxonomies/concept-schemes/deleteConceptScheme.js.map +1 -0
- package/build/tools/taxonomies/concept-schemes/getConceptScheme.js +26 -0
- package/build/tools/taxonomies/concept-schemes/getConceptScheme.js.map +1 -0
- package/build/tools/taxonomies/concept-schemes/listConceptSchemes.js +66 -0
- package/build/tools/taxonomies/concept-schemes/listConceptSchemes.js.map +1 -0
- package/build/tools/taxonomies/concept-schemes/mockClient.js +147 -0
- package/build/tools/taxonomies/concept-schemes/mockClient.js.map +1 -0
- package/build/tools/taxonomies/concept-schemes/register.js +13 -0
- package/build/tools/taxonomies/concept-schemes/register.js.map +1 -0
- package/build/tools/taxonomies/concept-schemes/updateConceptScheme.js +99 -0
- package/build/tools/taxonomies/concept-schemes/updateConceptScheme.js.map +1 -0
- package/build/tools/taxonomies/register.js +5 -0
- package/build/tools/taxonomies/register.js.map +1 -0
- package/build/types/conceptPayloadTypes.js +17 -0
- package/build/types/conceptPayloadTypes.js.map +1 -0
- package/build/types/querySchema.js +36 -0
- package/build/types/querySchema.js.map +1 -0
- package/package.json +5 -2
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createSuccessResponse, withErrorHandling, } from '../../../utils/response.js';
|
|
3
|
+
import { BaseToolSchema } from '../../../utils/tools.js';
|
|
4
|
+
import { EntryQuerySchema, AssetQuerySchema, } from '../../../types/querySchema.js';
|
|
5
|
+
export const ParamCollectionToolParams = BaseToolSchema.extend({
|
|
6
|
+
confirmation: z
|
|
7
|
+
.boolean()
|
|
8
|
+
.optional()
|
|
9
|
+
.describe('User confirmation that they are ready to proceed with the workflow'),
|
|
10
|
+
export: z
|
|
11
|
+
.object({
|
|
12
|
+
spaceId: z
|
|
13
|
+
.string()
|
|
14
|
+
.optional()
|
|
15
|
+
.describe('ID of the space with source data'),
|
|
16
|
+
environmentId: z
|
|
17
|
+
.string()
|
|
18
|
+
.optional()
|
|
19
|
+
.describe('ID of the environment in the source space'),
|
|
20
|
+
deliveryToken: z
|
|
21
|
+
.string()
|
|
22
|
+
.optional()
|
|
23
|
+
.describe('CDA token to export only published content (excludes tags)'),
|
|
24
|
+
exportDir: z.string().optional().describe('Path to export JSON output'),
|
|
25
|
+
saveFile: z
|
|
26
|
+
.boolean()
|
|
27
|
+
.optional()
|
|
28
|
+
.describe('Save the export as a JSON file'),
|
|
29
|
+
contentFile: z.string().optional().describe('Filename for exported data'),
|
|
30
|
+
includeDrafts: z
|
|
31
|
+
.boolean()
|
|
32
|
+
.optional()
|
|
33
|
+
.describe('Include drafts in exported entries'),
|
|
34
|
+
includeArchived: z
|
|
35
|
+
.boolean()
|
|
36
|
+
.optional()
|
|
37
|
+
.describe('Include archived entries'),
|
|
38
|
+
skipContentModel: z
|
|
39
|
+
.boolean()
|
|
40
|
+
.optional()
|
|
41
|
+
.describe('Skip exporting content models'),
|
|
42
|
+
skipEditorInterfaces: z
|
|
43
|
+
.boolean()
|
|
44
|
+
.optional()
|
|
45
|
+
.describe('Skip exporting editor interfaces'),
|
|
46
|
+
skipContent: z
|
|
47
|
+
.boolean()
|
|
48
|
+
.optional()
|
|
49
|
+
.describe('Skip exporting entries and assets'),
|
|
50
|
+
skipRoles: z
|
|
51
|
+
.boolean()
|
|
52
|
+
.optional()
|
|
53
|
+
.describe('Skip exporting roles and permissions'),
|
|
54
|
+
skipTags: z.boolean().optional().describe('Skip exporting tags'),
|
|
55
|
+
skipWebhooks: z.boolean().optional().describe('Skip exporting webhooks'),
|
|
56
|
+
stripTags: z
|
|
57
|
+
.boolean()
|
|
58
|
+
.optional()
|
|
59
|
+
.describe('Remove tags from entries and assets'),
|
|
60
|
+
contentOnly: z
|
|
61
|
+
.boolean()
|
|
62
|
+
.optional()
|
|
63
|
+
.describe('Export only entries and assets'),
|
|
64
|
+
queryEntries: EntryQuerySchema.optional().describe('Export only entries that match query parameters'),
|
|
65
|
+
queryAssets: AssetQuerySchema.optional().describe('Export only assets that match query parameters'),
|
|
66
|
+
downloadAssets: z
|
|
67
|
+
.boolean()
|
|
68
|
+
.optional()
|
|
69
|
+
.describe('Download asset files to disk'),
|
|
70
|
+
host: z.string().optional().describe('Management API host'),
|
|
71
|
+
hostDelivery: z.string().optional().describe('Delivery API host'),
|
|
72
|
+
proxy: z.string().optional().describe('HTTP/HTTPS proxy config'),
|
|
73
|
+
rawProxy: z
|
|
74
|
+
.boolean()
|
|
75
|
+
.optional()
|
|
76
|
+
.describe('Pass raw proxy config directly to Axios'),
|
|
77
|
+
maxAllowedLimit: z.number().optional().describe('Page size for requests'),
|
|
78
|
+
headers: z
|
|
79
|
+
.record(z.any())
|
|
80
|
+
.optional()
|
|
81
|
+
.describe('Additional headers to include in requests'),
|
|
82
|
+
errorLogFile: z
|
|
83
|
+
.string()
|
|
84
|
+
.optional()
|
|
85
|
+
.describe('Path to error log output file'),
|
|
86
|
+
useVerboseRenderer: z
|
|
87
|
+
.boolean()
|
|
88
|
+
.optional()
|
|
89
|
+
.describe('Line-by-line logging, useful for CI'),
|
|
90
|
+
config: z
|
|
91
|
+
.string()
|
|
92
|
+
.optional()
|
|
93
|
+
.describe('Path to a JSON config file with all options'),
|
|
94
|
+
})
|
|
95
|
+
.optional(),
|
|
96
|
+
import: z
|
|
97
|
+
.object({
|
|
98
|
+
spaceId: z.string().optional().describe('ID of the space to import into'),
|
|
99
|
+
environmentId: z
|
|
100
|
+
.string()
|
|
101
|
+
.optional()
|
|
102
|
+
.describe('Target environment in destination space'),
|
|
103
|
+
contentFile: z
|
|
104
|
+
.string()
|
|
105
|
+
.optional()
|
|
106
|
+
.describe('Path to JSON file containing the content to import'),
|
|
107
|
+
content: z
|
|
108
|
+
.record(z.any())
|
|
109
|
+
.optional()
|
|
110
|
+
.describe('JS object containing import content (must match expected structure)'),
|
|
111
|
+
contentModelOnly: z
|
|
112
|
+
.boolean()
|
|
113
|
+
.optional()
|
|
114
|
+
.describe('Import only content types'),
|
|
115
|
+
skipContentModel: z
|
|
116
|
+
.boolean()
|
|
117
|
+
.optional()
|
|
118
|
+
.describe('Skip importing content types and locales'),
|
|
119
|
+
skipLocales: z.boolean().optional().describe('Skip importing locales'),
|
|
120
|
+
skipContentUpdates: z
|
|
121
|
+
.boolean()
|
|
122
|
+
.optional()
|
|
123
|
+
.describe('Do not update existing content'),
|
|
124
|
+
skipContentPublishing: z
|
|
125
|
+
.boolean()
|
|
126
|
+
.optional()
|
|
127
|
+
.describe('Create but do not publish content'),
|
|
128
|
+
uploadAssets: z
|
|
129
|
+
.boolean()
|
|
130
|
+
.optional()
|
|
131
|
+
.describe('Upload asset files (requires assetsDirectory)'),
|
|
132
|
+
skipAssetUpdates: z
|
|
133
|
+
.boolean()
|
|
134
|
+
.optional()
|
|
135
|
+
.describe('Do not update existing assets'),
|
|
136
|
+
assetsDirectory: z
|
|
137
|
+
.string()
|
|
138
|
+
.optional()
|
|
139
|
+
.describe('Path to directory containing exported asset files'),
|
|
140
|
+
timeout: z
|
|
141
|
+
.number()
|
|
142
|
+
.optional()
|
|
143
|
+
.describe('Time between retries during asset processing (ms)'),
|
|
144
|
+
retryLimit: z
|
|
145
|
+
.number()
|
|
146
|
+
.optional()
|
|
147
|
+
.describe('Max retries for asset processing'),
|
|
148
|
+
host: z.string().optional().describe('Management API host'),
|
|
149
|
+
proxy: z
|
|
150
|
+
.string()
|
|
151
|
+
.optional()
|
|
152
|
+
.describe('HTTP/HTTPS proxy string (host:port or user:pass@host:port)'),
|
|
153
|
+
rawProxy: z
|
|
154
|
+
.boolean()
|
|
155
|
+
.optional()
|
|
156
|
+
.describe('Pass proxy config directly to Axios'),
|
|
157
|
+
rateLimit: z
|
|
158
|
+
.number()
|
|
159
|
+
.optional()
|
|
160
|
+
.describe('Max requests per second to the API'),
|
|
161
|
+
headers: z
|
|
162
|
+
.record(z.any())
|
|
163
|
+
.optional()
|
|
164
|
+
.describe('Additional headers to attach to requests'),
|
|
165
|
+
errorLogFile: z.string().optional().describe('Path to error log file'),
|
|
166
|
+
useVerboseRenderer: z
|
|
167
|
+
.boolean()
|
|
168
|
+
.optional()
|
|
169
|
+
.describe('Line-by-line progress output (good for CI)'),
|
|
170
|
+
config: z
|
|
171
|
+
.string()
|
|
172
|
+
.optional()
|
|
173
|
+
.describe('Path to config JSON file (merged with CLI args)'),
|
|
174
|
+
})
|
|
175
|
+
.optional(),
|
|
176
|
+
});
|
|
177
|
+
const paramCollectionConfig = {
|
|
178
|
+
export: {
|
|
179
|
+
requiredParams: `
|
|
180
|
+
spaceId // [string] [required] - ID of the space with source data
|
|
181
|
+
`,
|
|
182
|
+
optionalParams: `
|
|
183
|
+
environmentId // [string] [default: 'master'] - ID of the environment in the source space
|
|
184
|
+
deliveryToken // [string] - CDA token to export only published content (excludes tags)
|
|
185
|
+
|
|
186
|
+
exportDir // [string] [default: process.cwd()] - Path to export JSON output
|
|
187
|
+
saveFile // [boolean] [default: true] - Save the export as a JSON file
|
|
188
|
+
contentFile // [string] - Filename for exported data
|
|
189
|
+
|
|
190
|
+
includeDrafts // [boolean] [default: false] - Include drafts in exported entries
|
|
191
|
+
includeArchived // [boolean] [default: false] - Include archived entries
|
|
192
|
+
skipContentModel // [boolean] [default: false] - Skip exporting content models
|
|
193
|
+
skipEditorInterfaces // [boolean] [default: false] - Skip exporting editor interfaces
|
|
194
|
+
skipContent // [boolean] [default: false] - Skip exporting entries and assets
|
|
195
|
+
skipRoles // [boolean] [default: false] - Skip exporting roles and permissions
|
|
196
|
+
skipTags // [boolean] [default: false] - Skip exporting tags
|
|
197
|
+
skipWebhooks // [boolean] [default: false] - Skip exporting webhooks
|
|
198
|
+
stripTags // [boolean] [default: false] - Remove tags from entries and assets
|
|
199
|
+
contentOnly // [boolean] [default: false] - Export only entries and assets
|
|
200
|
+
|
|
201
|
+
queryEntries // [array] - Export only entries that match query parameters
|
|
202
|
+
queryAssets // [array] - Export only assets that match query parameters
|
|
203
|
+
downloadAssets // [boolean] - Download asset files to disk
|
|
204
|
+
|
|
205
|
+
host // [string] [default: 'api.contentful.com'] - Management API host
|
|
206
|
+
hostDelivery // [string] [default: 'cdn.contentful.com'] - Delivery API host
|
|
207
|
+
proxy // [string] - HTTP/HTTPS proxy config
|
|
208
|
+
rawProxy // [boolean] - Pass raw proxy config directly to Axios
|
|
209
|
+
maxAllowedLimit // [number] [default: 1000] - Page size for requests
|
|
210
|
+
headers // [object] - Additional headers to include in requests
|
|
211
|
+
|
|
212
|
+
errorLogFile // [string] - Path to error log output file
|
|
213
|
+
useVerboseRenderer // [boolean] [default: false] - Line-by-line logging, useful for CI
|
|
214
|
+
config // [string] - Path to a JSON config file with all options
|
|
215
|
+
`,
|
|
216
|
+
},
|
|
217
|
+
import: {
|
|
218
|
+
requiredParams: `
|
|
219
|
+
spaceId // [string] [required] - ID of the space to import into
|
|
220
|
+
managementToken // [string] [required] - Contentful Management API token
|
|
221
|
+
`,
|
|
222
|
+
optionalParams: `
|
|
223
|
+
environmentId // [string] [default: 'master'] - Target environment in destination space
|
|
224
|
+
contentFile // [string] - Path to JSON file containing the content to import
|
|
225
|
+
content // [object] - JS object containing import content (must match expected structure)
|
|
226
|
+
|
|
227
|
+
contentModelOnly // [boolean] [default: false] - Import only content types
|
|
228
|
+
skipContentModel // [boolean] [default: false] - Skip importing content types and locales
|
|
229
|
+
skipLocales // [boolean] [default: false] - Skip importing locales
|
|
230
|
+
skipContentUpdates // [boolean] [default: false] - Do not update existing content
|
|
231
|
+
skipContentPublishing // [boolean] [default: false] - Create but do not publish content
|
|
232
|
+
|
|
233
|
+
uploadAssets // [boolean] [default: false] - Upload asset files (requires assetsDirectory)
|
|
234
|
+
skipAssetUpdates // [boolean] [default: false] - Do not update existing assets
|
|
235
|
+
assetsDirectory // [string] - Path to directory containing exported asset files
|
|
236
|
+
timeout // [number] [default: 3000] - Time between retries during asset processing (ms)
|
|
237
|
+
retryLimit // [number] [default: 10] - Max retries for asset processing
|
|
238
|
+
|
|
239
|
+
host // [string] [default: 'api.contentful.com'] - Management API host
|
|
240
|
+
proxy // [string] - HTTP/HTTPS proxy string (host:port or user:pass@host:port)
|
|
241
|
+
rawProxy // [boolean] - Pass proxy config directly to Axios
|
|
242
|
+
rateLimit // [number] [default: 7] - Max requests per second to the API
|
|
243
|
+
headers // [object] - Additional headers to attach to requests
|
|
244
|
+
|
|
245
|
+
errorLogFile // [string] - Path to error log file
|
|
246
|
+
useVerboseRenderer // [boolean] [default: false] - Line-by-line progress output (good for CI)
|
|
247
|
+
config // [string] - Path to config JSON file (merged with CLI args)
|
|
248
|
+
`,
|
|
249
|
+
},
|
|
250
|
+
};
|
|
251
|
+
async function tool(args) {
|
|
252
|
+
// Extract export and import parameters, filtering out undefined values
|
|
253
|
+
const exportParams = args.export
|
|
254
|
+
? Object.fromEntries(Object.entries(args.export).filter(([, value]) => value !== undefined))
|
|
255
|
+
: {};
|
|
256
|
+
const importParams = args.import
|
|
257
|
+
? Object.fromEntries(Object.entries(args.import).filter(([, value]) => value !== undefined))
|
|
258
|
+
: {};
|
|
259
|
+
const params = {
|
|
260
|
+
export: Object.keys(exportParams).length > 0 ? exportParams : undefined,
|
|
261
|
+
import: Object.keys(importParams).length > 0 ? importParams : undefined,
|
|
262
|
+
};
|
|
263
|
+
// If user has confirmed, return ready-to-proceed response
|
|
264
|
+
if (args.confirmation === true) {
|
|
265
|
+
return createSuccessResponse('User ready to proceed with workflow', {
|
|
266
|
+
message: 'User has confirmed they are ready to proceed with the space-to-space migration workflow.',
|
|
267
|
+
workflowParams: params,
|
|
268
|
+
nextStep: 'Proceed with the migration workflow using the collected parameters.',
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
// Otherwise, return parameter collection response
|
|
272
|
+
return createSuccessResponse('Param collection tool', {
|
|
273
|
+
instructions: `
|
|
274
|
+
Help the user collect the correct parameters for the space to space migration workflow.
|
|
275
|
+
Call this tool repeatedly until the user feels they are ready to start the workflow.
|
|
276
|
+
|
|
277
|
+
Help them understand the required and optional parameters for the export and import tools.
|
|
278
|
+
Help them understand the instructions for the export and import tools.
|
|
279
|
+
Help them understand the available params for the export and import tools, ensure you list at all the optional params not just the required ones.
|
|
280
|
+
|
|
281
|
+
Continue to build the parameters passed into this tool until the user passes a confirmation that they are ready to start the workflow.
|
|
282
|
+
`,
|
|
283
|
+
availableParams: paramCollectionConfig,
|
|
284
|
+
currentParams: params,
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
export const createParamCollectionTool = withErrorHandling(tool, 'Error creating param collection tool');
|
|
288
|
+
//# sourceMappingURL=paramCollection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paramCollection.js","sourceRoot":"","sources":["../../../../src/tools/jobs/space-to-space-migration/paramCollection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EACL,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,+BAA+B,CAAC;AAEvC,MAAM,CAAC,MAAM,yBAAyB,GAAG,cAAc,CAAC,MAAM,CAAC;IAC7D,YAAY,EAAE,CAAC;SACZ,OAAO,EAAE;SACT,QAAQ,EAAE;SACV,QAAQ,CACP,oEAAoE,CACrE;IAEH,MAAM,EAAE,CAAC;SACN,MAAM,CAAC;QACN,OAAO,EAAE,CAAC;aACP,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,kCAAkC,CAAC;QAC/C,aAAa,EAAE,CAAC;aACb,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,2CAA2C,CAAC;QACxD,aAAa,EAAE,CAAC;aACb,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,4DAA4D,CAAC;QAEzE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,4BAA4B,CAAC;QACvE,QAAQ,EAAE,CAAC;aACR,OAAO,EAAE;aACT,QAAQ,EAAE;aACV,QAAQ,CAAC,gCAAgC,CAAC;QAC7C,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,4BAA4B,CAAC;QAEzE,aAAa,EAAE,CAAC;aACb,OAAO,EAAE;aACT,QAAQ,EAAE;aACV,QAAQ,CAAC,oCAAoC,CAAC;QACjD,eAA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AK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CACvE;QACH,CAAC,CAAC,EAAE,CAAC;IAEP,MAAM,MAAM,GAAG;QACb,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS;QACvE,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS;KACxE,CAAC;IAEF,0DAA0D;IAC1D,IAAI,IAAI,CAAC,YAAY,KAAK,IAAI,EAAE,CAAC;QAC/B,OAAO,qBAAqB,CAAC,qCAAqC,EAAE;YAClE,OAAO,EACL,0FAA0F;YAC5F,cAAc,EAAE,MAAM;YACtB,QAAQ,EACN,qEAAqE;SACxE,CAAC,CAAC;IACL,CAAC;IAED,kDAAkD;IAClD,OAAO,qBAAqB,CAAC,uBAAuB,EAAE;QACpD,YAAY,EAAE;;;;;;;;;KASb;QACD,eAAe,EAAE,qBAAqB;QACtC,aAAa,EAAE,MAAM;KACtB,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,MAAM,yBAAyB,GAAG,iBAAiB,CACxD,IAAI,EACJ,sCAAsC,CACvC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createExportSpaceTool, ExportSpaceToolParams } from './exportSpace.js';
|
|
2
|
+
import { ParamCollectionToolParams, createParamCollectionTool, } from './paramCollection.js';
|
|
3
|
+
import { ImportSpaceToolParams, createImportSpaceTool } from './importSpace.js';
|
|
4
|
+
import { SpaceToSpaceMigrationHandlerToolParams, makeSpaceToSpaceMigrationHandlerTool, } from './migrationHandler.js';
|
|
5
|
+
export function registerSpaceToSpaceMigrationTools(server) {
|
|
6
|
+
// Param collection tool
|
|
7
|
+
const paramCollectionTool = server.tool('space_to_space_param_collection', 'Collect parameters for the space to space migration workflow. This tool should ALWAYS start with confirmation false, until the user confirms they are ready to proceed with the workflow. Do not assume they use wants to proceed with the workflow until they explicitly say so.', ParamCollectionToolParams.shape, createParamCollectionTool);
|
|
8
|
+
// Export space tool
|
|
9
|
+
const exportSpaceTool = server.tool('export_space', 'Export a space to a file', ExportSpaceToolParams.shape, createExportSpaceTool);
|
|
10
|
+
// Import space tool
|
|
11
|
+
const importSpaceTool = server.tool('import_space', 'Import a space from a file. Step 4 of the space to space migration workflow.', ImportSpaceToolParams.shape, createImportSpaceTool);
|
|
12
|
+
// Create the unified migration handler tool
|
|
13
|
+
server.tool('space_to_space_migration_handler', 'Enable or disable the space to space migration workflow tools. Set enableWorkflow=true to start, false to conclude the workflow.', SpaceToSpaceMigrationHandlerToolParams.shape, makeSpaceToSpaceMigrationHandlerTool([
|
|
14
|
+
paramCollectionTool,
|
|
15
|
+
exportSpaceTool,
|
|
16
|
+
importSpaceTool,
|
|
17
|
+
]));
|
|
18
|
+
// Disable all workflow tools by default (only the handler remains enabled)
|
|
19
|
+
paramCollectionTool.disable();
|
|
20
|
+
importSpaceTool.disable();
|
|
21
|
+
exportSpaceTool.disable();
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=register.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../../src/tools/jobs/space-to-space-migration/register.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EACL,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EACL,sCAAsC,EACtC,oCAAoC,GACrC,MAAM,uBAAuB,CAAC;AAE/B,MAAM,UAAU,kCAAkC,CAAC,MAAiB;IAClE,wBAAwB;IACxB,MAAM,mBAAmB,GAAG,MAAM,CAAC,IAAI,CACrC,iCAAiC,EACjC,mRAAmR,EACnR,yBAAyB,CAAC,KAAK,EAC/B,yBAAyB,CAC1B,CAAC;IAEF,oBAAoB;IACpB,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,CACjC,cAAc,EACd,0BAA0B,EAC1B,qBAAqB,CAAC,KAAK,EAC3B,qBAAqB,CACtB,CAAC;IAEF,oBAAoB;IACpB,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,CACjC,cAAc,EACd,8EAA8E,EAC9E,qBAAqB,CAAC,KAAK,EAC3B,qBAAqB,CACtB,CAAC;IAEF,4CAA4C;IAC5C,MAAM,CAAC,IAAI,CACT,kCAAkC,EAClC,kIAAkI,EAClI,sCAAsC,CAAC,KAAK,EAC5C,oCAAoC,CAAC;QACnC,mBAAmB;QACnB,eAAe;QACf,eAAe;KAChB,CAAC,CACH,CAAC;IAEF,2EAA2E;IAC3E,mBAAmB,CAAC,OAAO,EAAE,CAAC;IAC9B,eAAe,CAAC,OAAO,EAAE,CAAC;IAC1B,eAAe,CAAC,OAAO,EAAE,CAAC;AAC5B,CAAC"}
|
package/build/tools/register.js
CHANGED
|
@@ -7,7 +7,9 @@ import { registerSpaceTools } from './spaces/register.js';
|
|
|
7
7
|
import { registerTagsTools } from './tags/register.js';
|
|
8
8
|
import { registerAiActionsTools } from './ai-actions/register.js';
|
|
9
9
|
import { registerLocaleTools } from './locales/register.js';
|
|
10
|
+
import { registerJobs } from './jobs/register.js';
|
|
10
11
|
import { registerOrgTools } from './orgs/register.js';
|
|
12
|
+
import { registerTaxonomyTools } from './taxonomies/register.js';
|
|
11
13
|
export function registerAllTools(server) {
|
|
12
14
|
registerContextTools(server);
|
|
13
15
|
registerEntriesTools(server);
|
|
@@ -18,6 +20,8 @@ export function registerAllTools(server) {
|
|
|
18
20
|
registerTagsTools(server);
|
|
19
21
|
registerAiActionsTools(server);
|
|
20
22
|
registerLocaleTools(server);
|
|
23
|
+
registerJobs(server);
|
|
21
24
|
registerOrgTools(server);
|
|
25
|
+
registerTaxonomyTools(server);
|
|
22
26
|
}
|
|
23
27
|
//# sourceMappingURL=register.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../src/tools/register.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../src/tools/register.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,MAAM,UAAU,gBAAgB,CAAC,MAAiB;IAChD,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAC7B,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAC7B,yBAAyB,CAAC,MAAM,CAAC,CAAC;IAClC,wBAAwB,CAAC,MAAM,CAAC,CAAC;IACjC,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC3B,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC3B,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC1B,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAC/B,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC5B,YAAY,CAAC,MAAM,CAAC,CAAC;IACrB,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACzB,qBAAqB,CAAC,MAAM,CAAC,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createSuccessResponse, withErrorHandling, } from '../../../utils/response.js';
|
|
3
|
+
import { createToolClient } from '../../../utils/tools.js';
|
|
4
|
+
import { TaxonomyConceptLinkSchema, } from '../../../types/conceptPayloadTypes.js';
|
|
5
|
+
export const CreateConceptSchemeToolParams = z.object({
|
|
6
|
+
organizationId: z.string().describe('The ID of the Contentful organization'),
|
|
7
|
+
conceptSchemeId: z
|
|
8
|
+
.string()
|
|
9
|
+
.optional()
|
|
10
|
+
.describe('Optional user-defined ID for the concept scheme. If not provided, Contentful will generate one automatically.'),
|
|
11
|
+
prefLabel: z
|
|
12
|
+
.record(z.string())
|
|
13
|
+
.describe('The preferred label for the concept scheme (localized)'),
|
|
14
|
+
uri: z
|
|
15
|
+
.string()
|
|
16
|
+
.nullable()
|
|
17
|
+
.optional()
|
|
18
|
+
.describe('The URI for the concept scheme'),
|
|
19
|
+
definition: z
|
|
20
|
+
.record(z.string().nullable())
|
|
21
|
+
.optional()
|
|
22
|
+
.describe('Definition of the concept scheme (localized)'),
|
|
23
|
+
editorialNote: z
|
|
24
|
+
.record(z.string().nullable())
|
|
25
|
+
.optional()
|
|
26
|
+
.describe('Editorial note for the concept scheme (localized)'),
|
|
27
|
+
historyNote: z
|
|
28
|
+
.record(z.string().nullable())
|
|
29
|
+
.optional()
|
|
30
|
+
.describe('History note for the concept scheme (localized)'),
|
|
31
|
+
example: z
|
|
32
|
+
.record(z.string().nullable())
|
|
33
|
+
.optional()
|
|
34
|
+
.describe('Example for the concept scheme (localized)'),
|
|
35
|
+
note: z
|
|
36
|
+
.record(z.string().nullable())
|
|
37
|
+
.optional()
|
|
38
|
+
.describe('General note for the concept scheme (localized)'),
|
|
39
|
+
scopeNote: z
|
|
40
|
+
.record(z.string().nullable())
|
|
41
|
+
.optional()
|
|
42
|
+
.describe('Scope note for the concept scheme (localized)'),
|
|
43
|
+
topConcepts: z
|
|
44
|
+
.array(TaxonomyConceptLinkSchema)
|
|
45
|
+
.optional()
|
|
46
|
+
.describe('Links to top-level concepts in this scheme'),
|
|
47
|
+
});
|
|
48
|
+
async function tool(args) {
|
|
49
|
+
const contentfulClient = createToolClient({
|
|
50
|
+
spaceId: 'dummy', // Not needed for concept scheme creation but required by BaseToolSchema
|
|
51
|
+
environmentId: 'dummy', // Not needed for concept scheme creation but required by BaseToolSchema
|
|
52
|
+
});
|
|
53
|
+
// Build the concept scheme payload by filtering out undefined values
|
|
54
|
+
const conceptSchemePayload = {
|
|
55
|
+
prefLabel: args.prefLabel,
|
|
56
|
+
...Object.fromEntries(Object.entries({
|
|
57
|
+
uri: args.uri,
|
|
58
|
+
definition: args.definition,
|
|
59
|
+
editorialNote: args.editorialNote,
|
|
60
|
+
historyNote: args.historyNote,
|
|
61
|
+
example: args.example,
|
|
62
|
+
note: args.note,
|
|
63
|
+
scopeNote: args.scopeNote,
|
|
64
|
+
topConcepts: args.topConcepts,
|
|
65
|
+
}).filter(([, value]) => value !== undefined)),
|
|
66
|
+
};
|
|
67
|
+
const newConceptScheme = args.conceptSchemeId
|
|
68
|
+
? await contentfulClient.conceptScheme.createWithId({
|
|
69
|
+
organizationId: args.organizationId,
|
|
70
|
+
conceptSchemeId: args.conceptSchemeId,
|
|
71
|
+
}, conceptSchemePayload)
|
|
72
|
+
: await contentfulClient.conceptScheme.create({ organizationId: args.organizationId }, conceptSchemePayload);
|
|
73
|
+
return createSuccessResponse('Concept scheme created successfully', {
|
|
74
|
+
newConceptScheme,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
export const createConceptSchemeTool = withErrorHandling(tool, 'Error creating concept scheme');
|
|
78
|
+
//# sourceMappingURL=createConceptScheme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createConceptScheme.js","sourceRoot":"","sources":["../../../../src/tools/taxonomies/concept-schemes/createConceptScheme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAEL,yBAAyB,GAC1B,MAAM,uCAAuC,CAAC;AAE/C,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC,MAAM,CAAC;IACpD,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uCAAuC,CAAC;IAC5E,eAAe,EAAE,CAAC;SACf,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,+GAA+G,CAChH;IACH,SAAS,EAAE,CAAC;SACT,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;SAClB,QAA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
|
+
import { createToolClient } from '../../../utils/tools.js';
|
|
4
|
+
export const DeleteConceptSchemeToolParams = z.object({
|
|
5
|
+
organizationId: z.string().describe('The ID of the Contentful organization'),
|
|
6
|
+
conceptSchemeId: z
|
|
7
|
+
.string()
|
|
8
|
+
.describe('The ID of the concept scheme to delete'),
|
|
9
|
+
version: z.number().describe('The version of the concept scheme to delete'),
|
|
10
|
+
});
|
|
11
|
+
async function tool(args) {
|
|
12
|
+
const contentfulClient = createToolClient({
|
|
13
|
+
spaceId: 'dummy', // Not needed for concept scheme deletion but required by BaseToolSchema
|
|
14
|
+
environmentId: 'dummy', // Not needed for concept scheme deletion but required by BaseToolSchema
|
|
15
|
+
});
|
|
16
|
+
// Delete the concept scheme
|
|
17
|
+
await contentfulClient.conceptScheme.delete({
|
|
18
|
+
organizationId: args.organizationId,
|
|
19
|
+
conceptSchemeId: args.conceptSchemeId,
|
|
20
|
+
version: args.version,
|
|
21
|
+
});
|
|
22
|
+
return createSuccessResponse('Concept scheme deleted successfully', {
|
|
23
|
+
conceptSchemeId: args.conceptSchemeId,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
export const deleteConceptSchemeTool = withErrorHandling(tool, 'Error deleting concept scheme');
|
|
27
|
+
//# sourceMappingURL=deleteConceptScheme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deleteConceptScheme.js","sourceRoot":"","sources":["../../../../src/tools/taxonomies/concept-schemes/deleteConceptScheme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC,MAAM,CAAC;IACpD,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uCAAuC,CAAC;IAC5E,eAAe,EAAE,CAAC;SACf,MAAM,EAAE;SACR,QAAQ,CAAC,wCAAwC,CAAC;IACrD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6CAA6C,CAAC;CAC5E,CAAC,CAAC;AAIH,KAAK,UAAU,IAAI,CAAC,IAAY;IAC9B,MAAM,gBAAgB,GAAG,gBAAgB,CAAC;QACxC,OAAO,EAAE,OAAO,EAAE,wEAAwE;QAC1F,aAAa,EAAE,OAAO,EAAE,wEAAwE;KACjG,CAAC,CAAC;IAEH,4BAA4B;IAC5B,MAAM,gBAAgB,CAAC,aAAa,CAAC,MAAM,CAAC;QAC1C,cAAc,EAAE,IAAI,CAAC,cAAc;QACnC,eAAe,EAAE,IAAI,CAAC,eAAe;QACrC,OAAO,EAAE,IAAI,CAAC,OAAO;KACtB,CAAC,CAAC;IAEH,OAAO,qBAAqB,CAAC,qCAAqC,EAAE;QAClE,eAAe,EAAE,IAAI,CAAC,eAAe;KACtC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,MAAM,uBAAuB,GAAG,iBAAiB,CACtD,IAAI,EACJ,+BAA+B,CAChC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createSuccessResponse, withErrorHandling, } from '../../../utils/response.js';
|
|
3
|
+
import { createToolClient } from '../../../utils/tools.js';
|
|
4
|
+
export const GetConceptSchemeToolParams = z.object({
|
|
5
|
+
organizationId: z.string().describe('The ID of the Contentful organization'),
|
|
6
|
+
conceptSchemeId: z
|
|
7
|
+
.string()
|
|
8
|
+
.describe('The ID of the concept scheme to retrieve'),
|
|
9
|
+
});
|
|
10
|
+
async function tool(args) {
|
|
11
|
+
const contentfulClient = createToolClient({
|
|
12
|
+
spaceId: 'dummy', // Not needed for concept scheme operations but required by BaseToolSchema
|
|
13
|
+
environmentId: 'dummy', // Not needed for concept scheme operations but required by BaseToolSchema
|
|
14
|
+
});
|
|
15
|
+
const params = {
|
|
16
|
+
organizationId: args.organizationId,
|
|
17
|
+
conceptSchemeId: args.conceptSchemeId,
|
|
18
|
+
};
|
|
19
|
+
// Get the concept scheme
|
|
20
|
+
const conceptScheme = await contentfulClient.conceptScheme.get(params);
|
|
21
|
+
return createSuccessResponse('Concept scheme retrieved successfully', {
|
|
22
|
+
conceptScheme,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
export const getConceptSchemeTool = withErrorHandling(tool, 'Error retrieving concept scheme');
|
|
26
|
+
//# sourceMappingURL=getConceptScheme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getConceptScheme.js","sourceRoot":"","sources":["../../../../src/tools/taxonomies/concept-schemes/getConceptScheme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uCAAuC,CAAC;IAC5E,eAAe,EAAE,CAAC;SACf,MAAM,EAAE;SACR,QAAQ,CAAC,0CAA0C,CAAC;CACxD,CAAC,CAAC;AAIH,KAAK,UAAU,IAAI,CAAC,IAAY;IAC9B,MAAM,gBAAgB,GAAG,gBAAgB,CAAC;QACxC,OAAO,EAAE,OAAO,EAAE,0EAA0E;QAC5F,aAAa,EAAE,OAAO,EAAE,0EAA0E;KACnG,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG;QACb,cAAc,EAAE,IAAI,CAAC,cAAc;QACnC,eAAe,EAAE,IAAI,CAAC,eAAe;KACtC,CAAC;IAEF,yBAAyB;IACzB,MAAM,aAAa,GAAG,MAAM,gBAAgB,CAAC,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAEvE,OAAO,qBAAqB,CAAC,uCAAuC,EAAE;QACpE,aAAa;KACd,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,iBAAiB,CACnD,IAAI,EACJ,iCAAiC,CAClC,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createSuccessResponse, withErrorHandling, } from '../../../utils/response.js';
|
|
3
|
+
import { createToolClient } from '../../../utils/tools.js';
|
|
4
|
+
import { summarizeData } from '../../../utils/summarizer.js';
|
|
5
|
+
export const ListConceptSchemesToolParams = z.object({
|
|
6
|
+
organizationId: z.string().describe('The ID of the Contentful organization'),
|
|
7
|
+
limit: z
|
|
8
|
+
.number()
|
|
9
|
+
.optional()
|
|
10
|
+
.describe('Maximum number of concept schemes to return'),
|
|
11
|
+
skip: z
|
|
12
|
+
.number()
|
|
13
|
+
.optional()
|
|
14
|
+
.describe('Skip this many concept schemes for pagination'),
|
|
15
|
+
select: z
|
|
16
|
+
.string()
|
|
17
|
+
.optional()
|
|
18
|
+
.describe('Comma-separated list of fields to return'),
|
|
19
|
+
include: z
|
|
20
|
+
.number()
|
|
21
|
+
.optional()
|
|
22
|
+
.describe('Include this many levels of linked entries'),
|
|
23
|
+
order: z.string().optional().describe('Order concept schemes by this field'),
|
|
24
|
+
});
|
|
25
|
+
async function tool(args) {
|
|
26
|
+
const contentfulClient = createToolClient({
|
|
27
|
+
spaceId: 'dummy', // Not needed for concept scheme operations but required by BaseToolSchema
|
|
28
|
+
environmentId: 'dummy', // Not needed for concept scheme operations but required by BaseToolSchema
|
|
29
|
+
});
|
|
30
|
+
const conceptSchemes = await contentfulClient.conceptScheme.getMany({
|
|
31
|
+
organizationId: args.organizationId,
|
|
32
|
+
query: {
|
|
33
|
+
limit: args.limit || 10,
|
|
34
|
+
skip: args.skip || 0,
|
|
35
|
+
...(args.select && { select: args.select }),
|
|
36
|
+
...(args.include && { include: args.include }),
|
|
37
|
+
...(args.order && { order: args.order }),
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
const summarizedConceptSchemes = conceptSchemes.items.map((conceptScheme) => ({
|
|
41
|
+
id: conceptScheme.sys.id,
|
|
42
|
+
prefLabel: conceptScheme.prefLabel || {},
|
|
43
|
+
uri: conceptScheme.uri || null,
|
|
44
|
+
definition: conceptScheme.definition || null,
|
|
45
|
+
topConcepts: conceptScheme.topConcepts || [],
|
|
46
|
+
createdAt: conceptScheme.sys.createdAt,
|
|
47
|
+
updatedAt: conceptScheme.sys.updatedAt,
|
|
48
|
+
version: conceptScheme.sys.version,
|
|
49
|
+
}));
|
|
50
|
+
const summarized = summarizeData({
|
|
51
|
+
...conceptSchemes,
|
|
52
|
+
items: summarizedConceptSchemes,
|
|
53
|
+
}, {
|
|
54
|
+
maxItems: 10,
|
|
55
|
+
remainingMessage: 'To see more concept schemes, please ask me to retrieve the next page using the skip parameter.',
|
|
56
|
+
});
|
|
57
|
+
return createSuccessResponse('Concept schemes retrieved successfully', {
|
|
58
|
+
conceptSchemes: summarized,
|
|
59
|
+
total: conceptSchemes.total ||
|
|
60
|
+
conceptSchemes.items.length,
|
|
61
|
+
limit: conceptSchemes.limit || args.limit || 10,
|
|
62
|
+
skip: conceptSchemes.skip || args.skip || 0,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
export const listConceptSchemesTool = withErrorHandling(tool, 'Error listing concept schemes');
|
|
66
|
+
//# sourceMappingURL=listConceptSchemes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listConceptSchemes.js","sourceRoot":"","sources":["../../../../src/tools/taxonomies/concept-schemes/listConceptSchemes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE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