@ai-sdk/mcp 2.0.83 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/mcp",
3
- "version": "2.0.83",
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.33",
35
- "@ai-sdk/provider-utils": "5.0.67",
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
  },
@@ -217,13 +217,20 @@ function mcpToModelOutput({
217
217
  input: unknown;
218
218
  output: unknown;
219
219
  }): ToolResultOutput {
220
- const result = output as CallToolResult;
220
+ if (typeof output === 'string') {
221
+ return { type: 'text', value: output };
222
+ }
221
223
 
222
- if (!('content' in result) || !Array.isArray(result.content)) {
223
- return { type: 'json', value: result as JSONValue };
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 = result.content.map(
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 };