ai 6.0.276 → 6.0.277
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
package/dist/index.js
CHANGED
|
@@ -1334,7 +1334,7 @@ function detectMediaType({
|
|
|
1334
1334
|
var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
|
1335
1335
|
|
|
1336
1336
|
// src/version.ts
|
|
1337
|
-
var VERSION = true ? "6.0.
|
|
1337
|
+
var VERSION = true ? "6.0.277" : "0.0.0-test";
|
|
1338
1338
|
|
|
1339
1339
|
// src/util/download/download.ts
|
|
1340
1340
|
var download = async ({
|
package/dist/index.mjs
CHANGED
|
@@ -1224,7 +1224,7 @@ import {
|
|
|
1224
1224
|
} from "@ai-sdk/provider-utils";
|
|
1225
1225
|
|
|
1226
1226
|
// src/version.ts
|
|
1227
|
-
var VERSION = true ? "6.0.
|
|
1227
|
+
var VERSION = true ? "6.0.277" : "0.0.0-test";
|
|
1228
1228
|
|
|
1229
1229
|
// src/util/download/download.ts
|
|
1230
1230
|
var download = async ({
|
package/dist/internal/index.js
CHANGED
|
@@ -164,7 +164,7 @@ function detectMediaType({
|
|
|
164
164
|
var import_provider_utils2 = require("@ai-sdk/provider-utils");
|
|
165
165
|
|
|
166
166
|
// src/version.ts
|
|
167
|
-
var VERSION = true ? "6.0.
|
|
167
|
+
var VERSION = true ? "6.0.277" : "0.0.0-test";
|
|
168
168
|
|
|
169
169
|
// src/util/download/download.ts
|
|
170
170
|
var download = async ({
|
package/dist/internal/index.mjs
CHANGED
|
@@ -118,6 +118,7 @@ Here are the capabilities of popular models:
|
|
|
118
118
|
| [xAI Grok](/providers/ai-sdk-providers/xai) | `grok-3` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
|
|
119
119
|
| [xAI Grok](/providers/ai-sdk-providers/xai) | `grok-3-mini` | <Cross size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
|
|
120
120
|
| [Vercel](/providers/ai-sdk-providers/vercel) | `v0-1.0-md` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
|
|
121
|
+
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-6-astra` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
|
|
121
122
|
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-5.6` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
|
|
122
123
|
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-5.6-luna` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
|
|
123
124
|
| [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-5.6-sol` | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> | <Check size={18} /> |
|
|
@@ -240,6 +240,69 @@ const tools = await mcpClient.tools();
|
|
|
240
240
|
|
|
241
241
|
This approach is simpler to implement and automatically stays in sync with server changes. However, you won't have TypeScript type safety during development, and all tools from the server will be loaded
|
|
242
242
|
|
|
243
|
+
### Tool Annotations and Approval
|
|
244
|
+
|
|
245
|
+
MCP servers can describe tool behavior with annotations such as
|
|
246
|
+
`readOnlyHint`, `destructiveHint`, `idempotentHint`, and `openWorldHint`. The
|
|
247
|
+
MCP client exposes these annotations on each tool's `metadata.annotations` and
|
|
248
|
+
on the resulting tool call's `toolMetadata.annotations`.
|
|
249
|
+
|
|
250
|
+
Annotations are untrusted, server-provided hints. The MCP client does not turn
|
|
251
|
+
them into an approval policy automatically. Applications should combine them
|
|
252
|
+
with deterministic controls such as tool allowlists, scoped credentials, and
|
|
253
|
+
their own [`needsApproval`](/docs/ai-sdk-core/tools-and-tool-calling#tool-execution-approval)
|
|
254
|
+
policy.
|
|
255
|
+
|
|
256
|
+
The following conservative policy allows tools to run automatically only when
|
|
257
|
+
the server explicitly marks them as read-only. Tools with `readOnlyHint: false`
|
|
258
|
+
or no `readOnlyHint` require user approval:
|
|
259
|
+
|
|
260
|
+
```typescript
|
|
261
|
+
import { type McpProviderMetadata } from '@ai-sdk/mcp';
|
|
262
|
+
|
|
263
|
+
const mcpTools = await mcpClient.tools();
|
|
264
|
+
const tools = Object.fromEntries(
|
|
265
|
+
Object.entries(mcpTools).map(([name, mcpTool]) => {
|
|
266
|
+
const annotations = (mcpTool.metadata as McpProviderMetadata | undefined)
|
|
267
|
+
?.annotations;
|
|
268
|
+
|
|
269
|
+
return [
|
|
270
|
+
name,
|
|
271
|
+
{
|
|
272
|
+
...mcpTool,
|
|
273
|
+
needsApproval: annotations?.readOnlyHint !== true,
|
|
274
|
+
},
|
|
275
|
+
];
|
|
276
|
+
}),
|
|
277
|
+
);
|
|
278
|
+
|
|
279
|
+
const result = streamText({
|
|
280
|
+
model: __MODEL__,
|
|
281
|
+
tools,
|
|
282
|
+
prompt,
|
|
283
|
+
});
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
See the
|
|
287
|
+
[local tool annotations example](https://github.com/vercel/ai/tree/main/examples/mcp/src/tool-annotations)
|
|
288
|
+
for a complete annotated MCP server and application-layer approval
|
|
289
|
+
configuration. Start the server and client in separate terminals:
|
|
290
|
+
|
|
291
|
+
```bash
|
|
292
|
+
cd examples/mcp
|
|
293
|
+
pnpm server:tool-annotations
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
```bash
|
|
297
|
+
cd examples/mcp
|
|
298
|
+
pnpm client:tool-annotations
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
Ask the client to read, delete, or create a note. The read-only tool executes
|
|
302
|
+
immediately. The destructive and unannotated tools prompt for approval; after
|
|
303
|
+
you enter `y` or `n`, the client sends the decision back and prints the model's
|
|
304
|
+
response.
|
|
305
|
+
|
|
243
306
|
### Schema Definition
|
|
244
307
|
|
|
245
308
|
For better type safety and control, you can define the tools and their input schemas explicitly in your client code:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.277",
|
|
4
4
|
"description": "AI SDK by Vercel - build apps like ChatGPT, Claude, Gemini, and more with a single interface for any model using the Vercel AI Gateway or go direct to OpenAI, Anthropic, Google, or any other model provider.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@opentelemetry/api": "^1.9.0",
|
|
48
|
-
"@ai-sdk/gateway": "3.0.
|
|
48
|
+
"@ai-sdk/gateway": "3.0.189",
|
|
49
49
|
"@ai-sdk/provider": "3.0.15",
|
|
50
50
|
"@ai-sdk/provider-utils": "4.0.50"
|
|
51
51
|
},
|