Update to AI SDK v7 - #358
Conversation
| type: 'http', | ||
| url: serverConfig.url | ||
| url: serverConfig.url, | ||
| fetch: globalThis.fetch.bind(globalThis) |
There was a problem hiding this comment.
Looks like this may be a regression in @ai-sdk/mcp v2, but maybe we can live with it for now.
There was a problem hiding this comment.
Strangely, the default seems to already be the globalThis.fetch, according to the documentation.
There was a problem hiding this comment.
There seems to be a difference depending on whether this runs in node or in the browser. Will try to push a few commits to the branch to double check that.
| /** | ||
| * The stream result type produced by the agent. | ||
| */ | ||
| type AgentStreamResult = Awaited< |
There was a problem hiding this comment.
Isn't there any type defined in ai-sdk that would natively handle the stream result ?
There was a problem hiding this comment.
The native type seems to be StreamTextResult<ToolMap, Context, never> but Context is not exported. So we would need to copy that type here too which may make it drift over time.
| */ | ||
| export function createDiscoverCommandsTool(commands: CommandRegistry): ITool { | ||
| return tool({ | ||
| title: 'Discover Commands', |
There was a problem hiding this comment.
Should we still provide the title with the providerMetadata argument ? Or is this useless ?
There was a problem hiding this comment.
Looks like title is now deprecated and the tools calls were not using it anyway (showing discover_commands instead).
But maybe metadata can work.
| type: 'http', | ||
| url: serverConfig.url | ||
| url: serverConfig.url, | ||
| fetch: globalThis.fetch.bind(globalThis) |
There was a problem hiding this comment.
Strangely, the default seems to already be the globalThis.fetch, according to the documentation.
|
Thanks @jtpio, it looks good to me. |

Reference: https://ai-sdk.dev/docs/migration-guides/migration-guide-7-0