@apify/actors-mcp-server 0.9.19-beta.0 → 0.9.19-beta.2

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.
@@ -2,13 +2,17 @@ import type { ValidateFunction } from 'ajv';
2
2
  import Ajv from 'ajv';
3
3
  export declare const ajv: Ajv;
4
4
  /**
5
- * Removes the $schema property and fixes the required array from a JSON schema.
6
- * The z.toJSONSchema() function in Zod 4.x has two issues:
7
- * 1. Includes a $schema reference that can cause issues when compiling with AJV
8
- * 2. Incorrectly marks fields with default values as required
5
+ * Removes the `$schema` property and drops fields with real `default` values from `required`.
9
6
  *
10
- * This function fixes both issues to ensure proper schema validation.
11
- * Exported so MCP tool listings can apply the same fix via `fixZodInputSchemaRequired` (see `getToolPublicFieldOnly`).
7
+ * Per Apify's input-schema spec, "Default + Required doesn't make sense" — a field with a
8
+ * default is effectively optional because the platform fills it in. Zod 4.x `toJSONSchema()`
9
+ * has the same issue: it lists `.default()` fields as required and emits `$schema` that
10
+ * breaks AJV compilation.
11
+ *
12
+ * Uses a value-check (`field.default !== undefined`) instead of key-presence (`'default' in field`)
13
+ * because `filterSchemaProperties()` assigns phantom `default: undefined` on every property (#675).
14
+ *
15
+ * @see https://github.com/apify/apify-mcp-server/issues/637
12
16
  */
13
17
  export declare function fixZodSchemaRequired(schema: Record<string, unknown>): Record<string, unknown>;
14
18
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ajv.d.ts","sourceRoot":"","sources":["../../src/utils/ajv.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,eAAO,MAAM,GAAG,KAA2E,CAAC;AAE5F;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAiB7F;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,gBAAgB,CAE/E"}
1
+ {"version":3,"file":"ajv.d.ts","sourceRoot":"","sources":["../../src/utils/ajv.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,eAAO,MAAM,GAAG,KAA2E,CAAC;AAE5F;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAiB7F;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,gBAAgB,CAE/E"}
package/dist/utils/ajv.js CHANGED
@@ -1,24 +1,29 @@
1
1
  import Ajv from 'ajv';
2
2
  export const ajv = new Ajv({ coerceTypes: 'array', strict: false, removeAdditional: true });
3
3
  /**
4
- * Removes the $schema property and fixes the required array from a JSON schema.
5
- * The z.toJSONSchema() function in Zod 4.x has two issues:
6
- * 1. Includes a $schema reference that can cause issues when compiling with AJV
7
- * 2. Incorrectly marks fields with default values as required
4
+ * Removes the `$schema` property and drops fields with real `default` values from `required`.
8
5
  *
9
- * This function fixes both issues to ensure proper schema validation.
10
- * Exported so MCP tool listings can apply the same fix via `fixZodInputSchemaRequired` (see `getToolPublicFieldOnly`).
6
+ * Per Apify's input-schema spec, "Default + Required doesn't make sense" — a field with a
7
+ * default is effectively optional because the platform fills it in. Zod 4.x `toJSONSchema()`
8
+ * has the same issue: it lists `.default()` fields as required and emits `$schema` that
9
+ * breaks AJV compilation.
10
+ *
11
+ * Uses a value-check (`field.default !== undefined`) instead of key-presence (`'default' in field`)
12
+ * because `filterSchemaProperties()` assigns phantom `default: undefined` on every property (#675).
13
+ *
14
+ * @see https://github.com/apify/apify-mcp-server/issues/637
11
15
  */
12
16
  export function fixZodSchemaRequired(schema) {
13
17
  const cleaned = { ...schema };
14
18
  delete cleaned.$schema;
15
- // Fix the required array: remove fields that have default values
16
19
  if (Array.isArray(cleaned.required) && typeof cleaned.properties === 'object' && cleaned.properties !== null) {
17
20
  const properties = cleaned.properties;
18
21
  cleaned.required = cleaned.required.filter((fieldName) => {
19
22
  const fieldSchema = properties[fieldName];
20
- // Only include in required if the field doesn't have a default value
21
- return !(typeof fieldSchema === 'object' && fieldSchema !== null && 'default' in fieldSchema);
23
+ if (typeof fieldSchema !== 'object' || fieldSchema === null)
24
+ return true;
25
+ // Value-check (NOT `'default' in fieldSchema`) — see docstring for why.
26
+ return fieldSchema.default === undefined;
22
27
  });
23
28
  }
24
29
  return cleaned;
@@ -1 +1 @@
1
- {"version":3,"file":"ajv.js","sourceRoot":"","sources":["../../src/utils/ajv.ts"],"names":[],"mappings":"AACA,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,MAAM,CAAC,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC,CAAC;AAE5F;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAA+B;IAChE,MAAM,OAAO,GAAG,EAAE,GAAG,MAAM,EAAE,CAAC;IAC9B,OAAO,OAAO,CAAC,OAAO,CAAC;IAEvB,iEAAiE;IACjE,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,OAAO,OAAO,CAAC,UAAU,KAAK,QAAQ,IAAI,OAAO,CAAC,UAAU,KAAK,IAAI,EAAE,CAAC;QAC3G,MAAM,UAAU,GAAG,OAAO,CAAC,UAAqC,CAAC;QACjE,OAAO,CAAC,QAAQ,GAAI,OAAO,C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WAAW,KAAK,QAAQ,IAAI,WAAW,KAAK,IAAI;gBAAE,OAAO,IAAI,CAAC;YACzE,wEAAwE;YACxE,OAAQ,WAAqC,CAAC,OAAO,KAAK,SAAS,CAAC;QACxE,CAAC,CACJ,CAAC;IACN,CAAC;IAED,OAAO,OAAO,CAAC;AACnB,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,aAAa,CAAC,MAA+B;IACzD,OAAO,GAAG,CAAC,OAAO,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC;AACrD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apify/actors-mcp-server",
3
- "version": "0.9.19-beta.0",
3
+ "version": "0.9.19-beta.2",
4
4
  "type": "module",
5
5
  "description": "Apify MCP Server",
6
6
  "mcpName": "com.apify/apify-mcp-server",