Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Adds strict mode in Vercel AI SDK + Minor bug fixes (#1842)

Musthaq Ahamadeb7691e53e24
diff --git a/.changeset/proud-snails-search.md b/.changeset/proud-snails-search.md
new file mode 100644
index 000000000..b06ffdc4b
--- /dev/null
+++ b/.changeset/proud-snails-search.md
@@ -0,0 +1,13 @@
+---
+'@composio/core': patch
+'@composio/anthropic': patch
+'@composio/cloudflare': patch
+'@composio/google': patch
+'@composio/langchain': patch
+'@composio/mastra': patch
+'@composio/openai': patch
+'@composio/openai-agents': patch
+'@composio/vercel': patch
+---
+
+Add strict mode to vercel provider
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 29523a495..8f7c7661d 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -116,7 +116,7 @@ importers:
composio-core:
specifier: ^0.5.39
hono:
specifier: ^4.7.11
version: 4.8.0
@@ -868,16 +868,32 @@ packages:
peerDependencies:
zod: ^3.0.0
+ '@ai-sdk/[email protected]':
+ resolution: {integrity: sha512-vnB6Jk2Qb245fajaWjG3q6N0QQy/uej7kZ0QR9xxq09x++3Tx/UPOcgAKMhFFA2fnuGpkFSRKoiDCyp/E3RARQ==}
+ engines: {node: '>=18'}
+ peerDependencies:
+ zod: ^3.25.76 || ^4
+
'@ai-sdk/[email protected]':
resolution: {integrity: sha512-fqhG+4sCVv8x7nFzYnFo19ryhAa3w096Kmc3hWxMQfW/TubPOmt3A6tYZhl4mUfQWWQMsuSkLrtjlWuXBVSGQA==}
engines: {node: '>=18'}
peerDependencies:
zod: ^3.23.8
+ '@ai-sdk/[email protected]':
+ resolution: {integrity: sha512-/iP1sKc6UdJgGH98OCly7sWJKv+J9G47PnTjIj40IJMUQKwDrUMyf7zOOfRtPwSuNifYhSoJQ4s1WltI65gJ/g==}
+ engines: {node: '>=18'}
+ peerDependencies:
+ zod: ^3.25.76 || ^4
+
'@ai-sdk/[email protected]':
resolution: {integrity: sha512-qZMxYJ0qqX/RfnuIaab+zp8UAeJn/ygXXAffR5I4N0n1IrvA6qBsjc8hXLmBiMV2zoXlifkacF7sEFnYnjBcqg==}
engines: {node: '>=18'}
+ '@ai-sdk/[email protected]':
+ resolution: {integrity: sha512-6o7Y2SeO9vFKB8lArHXehNuusnpddKPk7xqL7T2/b+OvXMRIXUO1rR4wcv1hAFUAT9avGZshty3Wlua/XA7TvA==}
+ engines: {node: '>=18'}
+
'@ai-sdk/[email protected]':
resolution: {integrity: sha512-jK1IZZ22evPZoQW3vlkZ7wvjYGYF+tRBKXtrcolduIkQ/m/sOAVcVeVDUDvh1T91xCnWCdUGCPZg2avZ90mv3g==}
engines: {node: '>=18'}
@@ -4167,6 +4183,10 @@ packages:
resolution: {integrity: sha512-6RxOBZ/cYgd8usLwsEl+EC09Au/9BcmCKYF2/xbml6DNczf7nv0MQb+7BA2F+li6//I+28VNlQR37XfQtcAJuA==}
engines: {node: '>=18.0.0'}
+ resolution: {integrity: sha512-nVpZkTMM9rF6AQ9gPJpFsNAMt48wIzB5TQgiTLdHiuO8XEDhUgZEhqKlZWXbIzo9VmJ/HvysHqEaVeD5v9TPvA==}
+ engines: {node: '>=20.0.0'}
+
resolution: {integrity: sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA==}
engines: {node: '>=18.0.0'}
@@ -5863,6 +5883,7 @@ packages:
resolution: {integrity: sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==}
engines: {node: '>= 8'}
+ deprecated: The work that was done in this beta branch won't be included in future versions
resolution: {integrity: sha512-MmnduQUuHCoFckZoWnXsTg7JaiLBJrKFj9UI2MbRPGaJeVpsLcVBu6P/IGZovziM/YBsellCmsprgNA+w0CzVg==}
@@ -6569,6 +6590,12 @@ snapshots:
'@ai-sdk/provider-utils': 2.2.8([email protected])
zod: 3.25.67
+ dependencies:
+ '@ai-sdk/provider': 2.0.0
+ '@ai-sdk/provider-utils': 3.0.1([email protected])
+ zod: 3.25.67
+
dependencies:
'@ai-sdk/provider': 1.1.3
@@ -6576,10 +6603,22 @@ snapshots:
secure-json-parse: 2.7.0
zod: 3.25.67
+ dependencies:
+ '@ai-sdk/provider': 2.0.0
+ '@standard-schema/spec': 1.0.0
+ eventsource-parser: 3.0.3
+ zod: 3.25.67
+ zod-to-json-schema: 3.24.5([email protected])
+
'@ai-sdk/[email protected]':
dependencies:
json-schema: 0.4.0
+ '@ai-sdk/[email protected]':
+ dependencies:
+ json-schema: 0.4.0
+
dependencies:
'@ai-sdk/provider-utils': 2.2.8([email protected])
@@ -10162,9 +10201,9 @@ snapshots:
has-own-prop: 2.0.0
repeat-string: 1.6.1
dependencies:
- '@ai-sdk/openai': 1.3.22([email protected])
+ '@ai-sdk/openai': 2.0.10([email protected])
'@cloudflare/workers-types': 4.20250619.0
'@composio/mcp': 1.0.3-0
'@hey-api/client-axios': 0.2.12([email protected])
@@ -10566,6 +10605,8 @@ snapshots:
+
dependencies:
eventsource-parser: 3.0.2
diff --git a/ts/examples/vercel/src/index.ts b/ts/examples/vercel/src/index.ts
index 688e7d435..6eaa0f37d 100644
--- a/ts/examples/vercel/src/index.ts
+++ b/ts/examples/vercel/src/index.ts
@@ -1,9 +1,9 @@
import { Composio } from '@composio/core';
-import { generateText } from 'ai';
+import { generateText, CoreMessage } from 'ai';
import { openai } from '@ai-sdk/openai';
import { VercelProvider } from '@composio/vercel';
import dotenv from 'dotenv';
-import { Message, MessageRoles } from './types';
+import { MessageRoles } from './types';
dotenv.config();
/**
@@ -21,7 +21,7 @@ const composio = new Composio({
async function run() {
const tools = await composio.tools.get('test-user-id', 'HACKERNEWS_GET_FRONTPAGE');
- const messages: Message[] = [
+ const messages: CoreMessage[] = [
{
role: MessageRoles.USER,
content: 'Summarize the front page of HackerNews',
diff --git a/ts/examples/vercel/src/types.ts b/ts/examples/vercel/src/types.ts
index 43df04cfd..612ba3be1 100644
--- a/ts/examples/vercel/src/types.ts
+++ b/ts/examples/vercel/src/types.ts
@@ -5,4 +5,3 @@ export const MessageRoles = {
} as const;
export type MessageRole = (typeof MessageRoles)[keyof typeof MessageRoles];
-export type Message = { role: MessageRole; content: string | unknown };
diff --git a/ts/packages/core/src/types/authConfigs.types.ts b/ts/packages/core/src/types/authConfigs.types.ts
index f9e010f44..e6d1ee3d2 100644
--- a/ts/packages/core/src/types/authConfigs.types.ts
+++ b/ts/packages/core/src/types/authConfigs.types.ts
@@ -133,7 +133,7 @@ export const AuthCustomConfigUpdateParamsSchema = z.object({
});
export const AuthDefaultConfigUpdateParamsSchema = z.object({
- scopes: z.string(),
+ scopes: z.string().optional(),
type: z.literal('default'),
/**
* @deprecated - use tool access config to determine the tools that the user can perform on the auth config.
diff --git a/ts/packages/core/src/utils/jsonSchema.ts b/ts/packages/core/src/utils/jsonSchema.ts
index 566e8fc1c..09c8952eb 100644
--- a/ts/packages/core/src/utils/jsonSchema.ts
+++ b/ts/packages/core/src/utils/jsonSchema.ts
@@ -26,7 +26,7 @@ export const removeNonRequiredProperties = <
)
);
}
- schema.additionalProperties = false;
+ schema.additionalProperties = schema.additionalProperties ?? false;
return schema as T;
};
diff --git a/ts/packages/providers/vercel/src/index.ts b/ts/packages/providers/vercel/src/index.ts
index 9275744b0..d3852f1af 100644
--- a/ts/packages/providers/vercel/src/index.ts
+++ b/ts/packages/providers/vercel/src/index.ts
@@ -16,15 +16,15 @@ import {
ExecuteToolFn,
McpUrlResponse,
McpServerGetResponse,
+ removeNonRequiredProperties,
} from '@composio/core';
import type { Tool as VercelTool } from 'ai';
import { jsonSchema, tool } from 'ai';
-import { z } from 'zod';
export type VercelToolCollection = Record<string, VercelTool>;
export class VercelProvider extends BaseAgenticProvider<VercelToolCollection, VercelTool> {
readonly name = 'vercel';
-
+ private strict: boolean | null;
/**
* Creates a new instance of the VercelProvider.
*
@@ -46,8 +46,9 @@ export class VercelProvider extends BaseAgenticProvider<VercelToolCollection, Ve
* const vercelTools = provider.wrapTools(composioTools, composio.tools.execute);
* ```
*/
- constructor() {
+ constructor({ strict = false }: { strict?: boolean } = {}) {
super();
+ this.strict = strict;
}
/**
@@ -100,9 +101,22 @@ export class VercelProvider extends BaseAgenticProvider<VercelToolCollection, Ve
* ```
*/
wrapTool(composioTool: Tool, executeTool: ExecuteToolFn): VercelTool {
+ const inputParams = composioTool.inputParameters;
+
+ const parameters =
+ this.strict && inputParams?.type === 'object'
+ ? removeNonRequiredProperties(
+ inputParams as {
+ type: 'object';
+ properties: Record<string, unknown>;
+ required?: string[];
+ }
+ )
+ : (inputParams ?? {});
+
return tool({
description: composioTool.description,
- parameters: jsonSchema((composioTool.inputParameters as Record<string, unknown>) ?? {}),
+ parameters: jsonSchema(parameters),
execute: async params => {
const input = typeof params === 'string' ? JSON.parse(params) : params;
return await executeTool(composioTool.slug, input);