@opentiny/next-sdk 0.2.2 → 0.2.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.
@@ -19136,7 +19136,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
19136
19136
  }
19137
19137
  return taskValidationResult.data;
19138
19138
  }
19139
- const validationResult = safeParse(CreateMessageResultSchema, result);
19139
+ const hasTools = params.tools || params.toolChoice;
19140
+ const resultSchema = hasTools ? CreateMessageResultWithToolsSchema : CreateMessageResultSchema;
19141
+ const validationResult = safeParse(resultSchema, result);
19140
19142
  if (!validationResult.success) {
19141
19143
  const errorMessage = validationResult.error instanceof Error ? validationResult.error.message : String(validationResult.error);
19142
19144
  throw new McpError(ErrorCode.InvalidParams, `Invalid sampling result: ${errorMessage}`);
@@ -19132,7 +19132,9 @@ class Client extends Protocol {
19132
19132
  }
19133
19133
  return taskValidationResult.data;
19134
19134
  }
19135
- const validationResult = safeParse(CreateMessageResultSchema, result);
19135
+ const hasTools = params.tools || params.toolChoice;
19136
+ const resultSchema = hasTools ? CreateMessageResultWithToolsSchema : CreateMessageResultSchema;
19137
+ const validationResult = safeParse(resultSchema, result);
19136
19138
  if (!validationResult.success) {
19137
19139
  const errorMessage = validationResult.error instanceof Error ? validationResult.error.message : String(validationResult.error);
19138
19140
  throw new McpError(ErrorCode.InvalidParams, `Invalid sampling result: ${errorMessage}`);