@ai-sdk/provider-utils 4.0.25 → 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/provider-utils",
3
- "version": "4.0.25",
3
+ "version": "4.0.26",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
package/src/types/tool.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { JSONValue } from '@ai-sdk/provider';
1
+ import type { JSONValue, SharedV3ProviderMetadata } from '@ai-sdk/provider';
2
2
  import type { FlexibleSchema } from '../schema';
3
3
  import type { ToolResultOutput } from './content-part';
4
4
  import type { ModelMessage } from './model-message';
@@ -128,6 +128,17 @@ export type Tool<
128
128
  */
129
129
  providerOptions?: ProviderOptions;
130
130
 
131
+ /**
132
+ * Optional metadata about the tool itself (e.g. its source).
133
+ *
134
+ * Unlike `providerOptions`, this metadata is not sent to the language
135
+ * model. Instead, it is propagated onto the resulting tool call's
136
+ * `providerMetadata` so consumers can read it from tool call / result
137
+ * parts and UI message parts. This is useful for sources of dynamic
138
+ * tools (e.g. an MCP server) to identify themselves.
139
+ */
140
+ providerMetadata?: SharedV3ProviderMetadata;
141
+
131
142
  /**
132
143
  * The schema of the input that the tool expects.
133
144
  * The language model will use this to generate the input.
@@ -288,6 +299,7 @@ export function dynamicTool(tool: {
288
299
  description?: string;
289
300
  title?: string;
290
301
  providerOptions?: ProviderOptions;
302
+ providerMetadata?: SharedV3ProviderMetadata;
291
303
  inputSchema: FlexibleSchema<unknown>;
292
304
  execute: ToolExecuteFunction<unknown, unknown>;
293
305