@ai-sdk/mcp 2.0.82 → 2.0.84
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 +20 -0
- package/README.md +2 -146
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -5
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/tool/mcp-client.ts +11 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/mcp",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.84",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@ai-sdk/provider": "4.0.
|
|
35
|
-
"@ai-sdk/provider-utils": "5.0.
|
|
34
|
+
"@ai-sdk/provider": "4.0.34",
|
|
35
|
+
"@ai-sdk/provider-utils": "5.0.68",
|
|
36
36
|
"cross-spawn": "^7.0.6",
|
|
37
37
|
"pkce-challenge": "^5.0.1"
|
|
38
38
|
},
|
package/src/tool/mcp-client.ts
CHANGED
|
@@ -217,13 +217,20 @@ function mcpToModelOutput({
|
|
|
217
217
|
input: unknown;
|
|
218
218
|
output: unknown;
|
|
219
219
|
}): ToolResultOutput {
|
|
220
|
-
|
|
220
|
+
if (typeof output === 'string') {
|
|
221
|
+
return { type: 'text', value: output };
|
|
222
|
+
}
|
|
221
223
|
|
|
222
|
-
if (
|
|
223
|
-
|
|
224
|
+
if (
|
|
225
|
+
output == null ||
|
|
226
|
+
typeof output !== 'object' ||
|
|
227
|
+
!('content' in output) ||
|
|
228
|
+
!Array.isArray(output.content)
|
|
229
|
+
) {
|
|
230
|
+
return { type: 'json', value: (output ?? null) as JSONValue };
|
|
224
231
|
}
|
|
225
232
|
|
|
226
|
-
const convertedContent =
|
|
233
|
+
const convertedContent = output.content.map(
|
|
227
234
|
(part: { type: string; [key: string]: unknown }) => {
|
|
228
235
|
if (part.type === 'text' && 'text' in part) {
|
|
229
236
|
return { type: 'text' as const, text: part.text as string };
|