@ai-sdk/provider-utils 4.0.24 → 4.0.26

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 (65) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/index.d.mts +12 -1
  3. package/dist/index.d.ts +12 -1
  4. package/dist/index.js +1 -1
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +4 -2
  7. package/dist/index.mjs.map +1 -1
  8. package/package.json +2 -2
  9. package/src/add-additional-properties-to-json-schema.ts +1 -1
  10. package/src/convert-image-model-file-to-data-uri.ts +1 -1
  11. package/src/create-tool-name-mapping.ts +1 -1
  12. package/src/get-from-api.ts +2 -2
  13. package/src/inject-json-instruction.ts +1 -1
  14. package/src/parse-json-event-stream.ts +3 -3
  15. package/src/parse-json.ts +2 -2
  16. package/src/parse-provider-options.ts +1 -1
  17. package/src/post-to-api.ts +2 -2
  18. package/src/provider-tool-factory.ts +2 -2
  19. package/src/resolve.ts +1 -1
  20. package/src/response-handler.ts +2 -2
  21. package/src/schema.ts +6 -3
  22. package/src/to-json-schema/zod3-to-json-schema/options.ts +3 -3
  23. package/src/to-json-schema/zod3-to-json-schema/parse-def.ts +3 -3
  24. package/src/to-json-schema/zod3-to-json-schema/parse-types.ts +22 -22
  25. package/src/to-json-schema/zod3-to-json-schema/parsers/array.ts +3 -3
  26. package/src/to-json-schema/zod3-to-json-schema/parsers/bigint.ts +1 -1
  27. package/src/to-json-schema/zod3-to-json-schema/parsers/branded.ts +2 -2
  28. package/src/to-json-schema/zod3-to-json-schema/parsers/catch.ts +2 -2
  29. package/src/to-json-schema/zod3-to-json-schema/parsers/date.ts +3 -3
  30. package/src/to-json-schema/zod3-to-json-schema/parsers/default.ts +3 -3
  31. package/src/to-json-schema/zod3-to-json-schema/parsers/effects.ts +3 -3
  32. package/src/to-json-schema/zod3-to-json-schema/parsers/enum.ts +1 -1
  33. package/src/to-json-schema/zod3-to-json-schema/parsers/intersection.ts +4 -4
  34. package/src/to-json-schema/zod3-to-json-schema/parsers/literal.ts +1 -1
  35. package/src/to-json-schema/zod3-to-json-schema/parsers/map.ts +4 -4
  36. package/src/to-json-schema/zod3-to-json-schema/parsers/native-enum.ts +1 -1
  37. package/src/to-json-schema/zod3-to-json-schema/parsers/never.ts +1 -1
  38. package/src/to-json-schema/zod3-to-json-schema/parsers/nullable.ts +4 -4
  39. package/src/to-json-schema/zod3-to-json-schema/parsers/number.ts +1 -1
  40. package/src/to-json-schema/zod3-to-json-schema/parsers/object.ts +3 -3
  41. package/src/to-json-schema/zod3-to-json-schema/parsers/optional.ts +3 -3
  42. package/src/to-json-schema/zod3-to-json-schema/parsers/pipeline.ts +4 -4
  43. package/src/to-json-schema/zod3-to-json-schema/parsers/promise.ts +3 -3
  44. package/src/to-json-schema/zod3-to-json-schema/parsers/readonly.ts +2 -2
  45. package/src/to-json-schema/zod3-to-json-schema/parsers/record.ts +7 -7
  46. package/src/to-json-schema/zod3-to-json-schema/parsers/set.ts +3 -3
  47. package/src/to-json-schema/zod3-to-json-schema/parsers/string.ts +2 -2
  48. package/src/to-json-schema/zod3-to-json-schema/parsers/tuple.ts +3 -3
  49. package/src/to-json-schema/zod3-to-json-schema/parsers/undefined.ts +1 -1
  50. package/src/to-json-schema/zod3-to-json-schema/parsers/union.ts +3 -3
  51. package/src/to-json-schema/zod3-to-json-schema/parsers/unknown.ts +1 -1
  52. package/src/to-json-schema/zod3-to-json-schema/refs.ts +3 -3
  53. package/src/to-json-schema/zod3-to-json-schema/select-parser.ts +2 -2
  54. package/src/to-json-schema/zod3-to-json-schema/zod3-to-json-schema.ts +3 -3
  55. package/src/types/assistant-model-message.ts +3 -3
  56. package/src/types/content-part.ts +3 -3
  57. package/src/types/execute-tool.ts +1 -1
  58. package/src/types/index.ts +2 -1
  59. package/src/types/model-message.ts +4 -4
  60. package/src/types/provider-options.ts +1 -1
  61. package/src/types/system-model-message.ts +1 -1
  62. package/src/types/tool-model-message.ts +3 -3
  63. package/src/types/tool.ts +17 -5
  64. package/src/types/user-model-message.ts +2 -2
  65. package/src/validate-types.ts +5 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @ai-sdk/provider-utils
2
2
 
3
+ ## 4.0.26
4
+
5
+ ### Patch Changes
6
+
7
+ - 7beadf0: feat(mcp): propagate the server name through dynamic tool parts
8
+
9
+ ## 4.0.25
10
+
11
+ ### Patch Changes
12
+
13
+ - a727da4: chore: ensure consistent import handling and avoid import duplicates or cycles
14
+ - Updated dependencies [a727da4]
15
+ - @ai-sdk/provider@3.0.10
16
+
3
17
  ## 4.0.24
4
18
 
5
19
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { LanguageModelV3FunctionTool, LanguageModelV3ProviderTool, ImageModelV3File, AISDKError, JSONSchema7, JSONParseError, TypeValidationError, JSONValue, APICallError, LanguageModelV3Prompt, SharedV3ProviderOptions, TypeValidationContext } from '@ai-sdk/provider';
1
+ import { LanguageModelV3FunctionTool, LanguageModelV3ProviderTool, ImageModelV3File, AISDKError, JSONSchema7, JSONParseError, TypeValidationError, JSONValue, APICallError, LanguageModelV3Prompt, SharedV3ProviderOptions, SharedV3ProviderMetadata, TypeValidationContext } from '@ai-sdk/provider';
2
2
  import { StandardSchemaV1, StandardJSONSchemaV1 } from '@standard-schema/spec';
3
3
  export * from '@standard-schema/spec';
4
4
  import * as z3 from 'zod/v3';
@@ -1069,6 +1069,16 @@ type Tool<INPUT extends JSONValue | unknown | never = any, OUTPUT extends JSONVa
1069
1069
  * functionality that can be fully encapsulated in the provider.
1070
1070
  */
1071
1071
  providerOptions?: ProviderOptions;
1072
+ /**
1073
+ * Optional metadata about the tool itself (e.g. its source).
1074
+ *
1075
+ * Unlike `providerOptions`, this metadata is not sent to the language
1076
+ * model. Instead, it is propagated onto the resulting tool call's
1077
+ * `providerMetadata` so consumers can read it from tool call / result
1078
+ * parts and UI message parts. This is useful for sources of dynamic
1079
+ * tools (e.g. an MCP server) to identify themselves.
1080
+ */
1081
+ providerMetadata?: SharedV3ProviderMetadata;
1072
1082
  /**
1073
1083
  * The schema of the input that the tool expects.
1074
1084
  * The language model will use this to generate the input.
@@ -1196,6 +1206,7 @@ declare function dynamicTool(tool: {
1196
1206
  description?: string;
1197
1207
  title?: string;
1198
1208
  providerOptions?: ProviderOptions;
1209
+ providerMetadata?: SharedV3ProviderMetadata;
1199
1210
  inputSchema: FlexibleSchema<unknown>;
1200
1211
  execute: ToolExecuteFunction<unknown, unknown>;
1201
1212
  /**
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { LanguageModelV3FunctionTool, LanguageModelV3ProviderTool, ImageModelV3File, AISDKError, JSONSchema7, JSONParseError, TypeValidationError, JSONValue, APICallError, LanguageModelV3Prompt, SharedV3ProviderOptions, TypeValidationContext } from '@ai-sdk/provider';
1
+ import { LanguageModelV3FunctionTool, LanguageModelV3ProviderTool, ImageModelV3File, AISDKError, JSONSchema7, JSONParseError, TypeValidationError, JSONValue, APICallError, LanguageModelV3Prompt, SharedV3ProviderOptions, SharedV3ProviderMetadata, TypeValidationContext } from '@ai-sdk/provider';
2
2
  import { StandardSchemaV1, StandardJSONSchemaV1 } from '@standard-schema/spec';
3
3
  export * from '@standard-schema/spec';
4
4
  import * as z3 from 'zod/v3';
@@ -1069,6 +1069,16 @@ type Tool<INPUT extends JSONValue | unknown | never = any, OUTPUT extends JSONVa
1069
1069
  * functionality that can be fully encapsulated in the provider.
1070
1070
  */
1071
1071
  providerOptions?: ProviderOptions;
1072
+ /**
1073
+ * Optional metadata about the tool itself (e.g. its source).
1074
+ *
1075
+ * Unlike `providerOptions`, this metadata is not sent to the language
1076
+ * model. Instead, it is propagated onto the resulting tool call's
1077
+ * `providerMetadata` so consumers can read it from tool call / result
1078
+ * parts and UI message parts. This is useful for sources of dynamic
1079
+ * tools (e.g. an MCP server) to identify themselves.
1080
+ */
1081
+ providerMetadata?: SharedV3ProviderMetadata;
1072
1082
  /**
1073
1083
  * The schema of the input that the tool expects.
1074
1084
  * The language model will use this to generate the input.
@@ -1196,6 +1206,7 @@ declare function dynamicTool(tool: {
1196
1206
  description?: string;
1197
1207
  title?: string;
1198
1208
  providerOptions?: ProviderOptions;
1209
+ providerMetadata?: SharedV3ProviderMetadata;
1199
1210
  inputSchema: FlexibleSchema<unknown>;
1200
1211
  execute: ToolExecuteFunction<unknown, unknown>;
1201
1212
  /**
package/dist/index.js CHANGED
@@ -678,7 +678,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
678
678
  }
679
679
 
680
680
  // src/version.ts
681
- var VERSION = true ? "4.0.24" : "0.0.0-test";
681
+ var VERSION = true ? "4.0.26" : "0.0.0-test";
682
682
 
683
683
  // src/get-from-api.ts
684
684
  var getOriginalFetch = () => globalThis.fetch;