@mastra/schema-compat 1.1.2 → 1.1.3-alpha.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @mastra/schema-compat
2
2
 
3
+ ## 1.1.3-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix `ZodNull` throwing "does not support zod type: ZodNull" for Anthropic and OpenAI reasoning models. MCP tools with nullable properties in their JSON Schema produce `z.null()` which was unhandled by these provider compat layers. ([#13496](https://github.com/mastra-ai/mastra/pull/13496))
8
+
3
9
  ## 1.1.2
4
10
 
5
11
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -4996,6 +4996,36 @@ var SchemaCompatLayer3 = class {
4996
4996
  return jsonSchema2;
4997
4997
  }
4998
4998
  };
4999
+ function isOptional2(z11) {
5000
+ return (v) => v instanceof z11["ZodOptional"];
5001
+ }
5002
+ function isObj2(z11) {
5003
+ return (v) => v instanceof z11["ZodObject"];
5004
+ }
5005
+ function isNull(z11) {
5006
+ return (v) => v instanceof z11["ZodNull"];
5007
+ }
5008
+ function isArr2(z11) {
5009
+ return (v) => v instanceof z11["ZodArray"];
5010
+ }
5011
+ function isUnion2(z11) {
5012
+ return (v) => v instanceof z11["ZodUnion"];
5013
+ }
5014
+ function isString2(z11) {
5015
+ return (v) => v instanceof z11["ZodString"];
5016
+ }
5017
+ function isNumber2(z11) {
5018
+ return (v) => v instanceof z11["ZodNumber"];
5019
+ }
5020
+ function isDate(z11) {
5021
+ return (v) => v instanceof z11["ZodDate"];
5022
+ }
5023
+ function isDefault(z11) {
5024
+ return (v) => v instanceof z11["ZodDefault"];
5025
+ }
5026
+ function isNullable(z11) {
5027
+ return (v) => v instanceof z11["ZodNullable"];
5028
+ }
4999
5029
 
5000
5030
  // src/provider-compats/anthropic.ts
5001
5031
  var AnthropicSchemaCompatLayer = class extends SchemaCompatLayer3 {
@@ -5025,6 +5055,8 @@ var AnthropicSchemaCompatLayer = class extends SchemaCompatLayer3 {
5025
5055
  } else {
5026
5056
  return value;
5027
5057
  }
5058
+ } else if (isNull(zod.z)(value)) {
5059
+ return zod.z.any().refine((v) => v === null, { message: "must be null" }).describe(value.description || "must be null");
5028
5060
  }
5029
5061
  return this.defaultUnsupportedZodTypeHandler(value);
5030
5062
  }
@@ -5053,38 +5085,6 @@ var AnthropicSchemaCompatLayer = class extends SchemaCompatLayer3 {
5053
5085
  }
5054
5086
  }
5055
5087
  };
5056
- function isOptional2(z10) {
5057
- return (v) => v instanceof z10["ZodOptional"];
5058
- }
5059
- function isObj2(z10) {
5060
- return (v) => v instanceof z10["ZodObject"];
5061
- }
5062
- function isNull(z10) {
5063
- return (v) => v instanceof z10["ZodNull"];
5064
- }
5065
- function isArr2(z10) {
5066
- return (v) => v instanceof z10["ZodArray"];
5067
- }
5068
- function isUnion2(z10) {
5069
- return (v) => v instanceof z10["ZodUnion"];
5070
- }
5071
- function isString2(z10) {
5072
- return (v) => v instanceof z10["ZodString"];
5073
- }
5074
- function isNumber2(z10) {
5075
- return (v) => v instanceof z10["ZodNumber"];
5076
- }
5077
- function isDate(z10) {
5078
- return (v) => v instanceof z10["ZodDate"];
5079
- }
5080
- function isDefault(z10) {
5081
- return (v) => v instanceof z10["ZodDefault"];
5082
- }
5083
- function isNullable(z10) {
5084
- return (v) => v instanceof z10["ZodNullable"];
5085
- }
5086
-
5087
- // src/provider-compats/deepseek.ts
5088
5088
  var DeepSeekSchemaCompatLayer = class extends SchemaCompatLayer3 {
5089
5089
  constructor(model) {
5090
5090
  super(model);
@@ -5455,6 +5455,8 @@ var OpenAIReasoningSchemaCompatLayer = class extends SchemaCompatLayer3 {
5455
5455
  return this.defaultZodStringHandler(value);
5456
5456
  } else if (isDate(zod.z)(value)) {
5457
5457
  return this.defaultZodDateHandler(value);
5458
+ } else if (isNull(zod.z)(value)) {
5459
+ return zod.z.any().refine((v) => v === null, { message: "must be null" }).describe(value.description || "must be null");
5458
5460
  } else if (value.constructor.name === "ZodAny") {
5459
5461
  return zod.z.string().describe(
5460
5462
  (value.description ?? "") + `