@contentful/mcp-tools 0.4.2 → 0.4.4

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.
Files changed (2) hide show
  1. package/dist/index.js +21 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2190,6 +2190,20 @@ function searchLimit(userLimit) {
2190
2190
  return Math.min(userLimit || 10, 1e3);
2191
2191
  }
2192
2192
 
2193
+ // src/utils/queryParams.ts
2194
+ function normalizeArrayFilters(query) {
2195
+ const normalized = {};
2196
+ let didConvert = false;
2197
+ for (const key of Object.keys(query)) {
2198
+ const value = query[key];
2199
+ if (Array.isArray(value)) {
2200
+ normalized[key] = value.join(",");
2201
+ didConvert = true;
2202
+ }
2203
+ }
2204
+ return didConvert ? { ...query, ...normalized } : query;
2205
+ }
2206
+
2193
2207
  // src/tools/entries/searchEntries.ts
2194
2208
  var SearchEntriesToolParams = BaseToolSchema.extend({
2195
2209
  query: z35.object({
@@ -2236,11 +2250,11 @@ function searchEntriesTool(config) {
2236
2250
  const contentfulClient = createToolClient(config, args);
2237
2251
  const entries = await contentfulClient.entry.getMany({
2238
2252
  ...params,
2239
- query: {
2253
+ query: normalizeArrayFilters({
2240
2254
  ...args.query,
2241
2255
  limit: searchLimit(args.query.limit),
2242
2256
  skip: args.query.skip || 0
2243
- }
2257
+ })
2244
2258
  });
2245
2259
  const summarized = summarizeData(entries, {
2246
2260
  maxItems: searchLimit(args.query.limit),
@@ -2951,12 +2965,14 @@ function createEnvironmentTool(config) {
2951
2965
  const environment = await contentfulClient.environment.createWithId(
2952
2966
  {
2953
2967
  spaceId: args.spaceId,
2954
- environmentId: args.environmentId
2968
+ environmentId: args.environmentId,
2969
+ ...args.sourceEnvironmentId && {
2970
+ sourceEnvironmentId: args.sourceEnvironmentId
2971
+ }
2955
2972
  },
2956
2973
  {
2957
2974
  name: args.name
2958
- },
2959
- args.sourceEnvironmentId ? { "X-Contentful-Source-Environment": args.sourceEnvironmentId } : void 0
2975
+ }
2960
2976
  );
2961
2977
  return createSuccessResponse("Environment created successfully", {
2962
2978
  environment
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/mcp-tools",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",