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.

Rollback changes related to executeMetadata

haxziebe9612894574
diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts
index 52c040d43..892cef5c7 100644
--- a/packages/core/src/index.ts
+++ b/packages/core/src/index.ts
@@ -11,6 +11,7 @@ export { BaseTelemetryTransport } from './telemetry/TelemetryTransport';
export { jsonSchemaToModel } from './utils/jsonSchema';
export { Tool, ToolListParams, ToolListParamsSchema } from './types/tool.types';
export { Toolset } from './types/toolset.types';
+export { ExecuteMetadata } from './types/customTool.types';
// Type exports
export type {
ExecuteToolModifiers,
diff --git a/packages/core/src/toolset/BaseToolset.ts b/packages/core/src/toolset/BaseToolset.ts
index 5f250ad58..21a4e307a 100644
--- a/packages/core/src/toolset/BaseToolset.ts
+++ b/packages/core/src/toolset/BaseToolset.ts
@@ -1,6 +1,7 @@
import type { Tool, ToolListParams } from '../types/tool.types';
import type { Composio } from '../composio';
import { AgenticToolOptions, ExecuteToolModifiers, ToolOptions } from '../types/modifiers.types';
+import { ExecuteMetadata } from '../types/customTool.types';
// Type for backward compatibility and type constraints
export abstract class BaseNonAgenticToolset<TToolCollection, TTool> {
diff --git a/packages/core/src/toolset/OpenAIToolset.ts b/packages/core/src/toolset/OpenAIToolset.ts
index 328cc23d3..6e74136b7 100644
--- a/packages/core/src/toolset/OpenAIToolset.ts
+++ b/packages/core/src/toolset/OpenAIToolset.ts
@@ -82,10 +82,8 @@ export class OpenAIToolset extends BaseNonAgenticToolset<OpenAiToolCollection, O
if (!appSlug) {
throw new Error('App slug not found');
}
- const connectedAccountId = this.getComposio().getConnectedAccountId(appSlug);
const payload: ToolExecuteParams = {
- userId: userId ?? this.getComposio().userId,
- connectedAccountId: connectedAccountId,
+ userId: userId,
arguments: JSON.parse(tool.function.arguments),
};
const results = await this.getComposio().tools.execute(toolSchema.slug, payload, modifiers);
diff --git a/packages/toolsets/cloudflare/src/index.ts b/packages/toolsets/cloudflare/src/index.ts
index f91c077c6..2bf66880f 100644
--- a/packages/toolsets/cloudflare/src/index.ts
+++ b/packages/toolsets/cloudflare/src/index.ts
@@ -16,6 +16,7 @@ import {
ExecuteToolModifiers,
ToolOptions,
BaseNonAgenticToolset,
+ ExecuteMetadata,
} from '@composio/core';
type AiToolCollection = Record<string, AiTextGenerationToolInput>;
@@ -103,7 +104,7 @@ export class CloudflareToolset extends BaseNonAgenticToolset<
* @returns The results of the tool call.
*/
async executeToolCall(
- userId: string,
+ executeMetadata: ExecuteMetadata,
tool: { name: string; arguments: unknown },
modifiers?: ExecuteToolModifiers
): Promise<string> {
@@ -111,7 +112,10 @@ export class CloudflareToolset extends BaseNonAgenticToolset<
throw new Error('Client not set');
}
- const toolSchema = await this.getComposio().tools.getComposioToolBySlug(userId, tool.name);
+ const toolSchema = await this.getComposio().tools.getComposioToolBySlug(
+ executeMetadata.userId,
+ tool.name
+ );
const appName = toolSchema?.toolkit?.name.toLowerCase();
if (!appName) {
throw new Error('App name not found');
@@ -121,8 +125,8 @@ export class CloudflareToolset extends BaseNonAgenticToolset<
toolSchema.slug,
{
arguments: args,
- userId,
- connectedAccountId: this.getComposio()?.getConnectedAccountId(appName),
+ userId: executeMetadata.userId,
+ connectedAccountId: executeMetadata.connectedAccountId,
},
modifiers
);
diff --git a/packages/toolsets/langchain/src/index.ts b/packages/toolsets/langchain/src/index.ts
index 34868f7b0..2625f9acf 100644
--- a/packages/toolsets/langchain/src/index.ts
+++ b/packages/toolsets/langchain/src/index.ts
@@ -15,6 +15,7 @@ import {
Tool,
ToolListParams,
AgenticToolOptions,
+ ExecuteMetadata,
} from '@composio/core';
import { DynamicStructuredTool } from '@langchain/core/tools';
@@ -38,14 +39,13 @@ export class LangchainToolset extends BaseAgenticToolset<
}
const func = async (...kwargs: unknown[]): Promise<unknown> => {
- const connectedAccountId = this.getComposio()?.getConnectedAccountId(appName);
return JSON.stringify(
await this.getComposio()?.tools.execute(
toolName,
{
arguments: kwargs[0] as Record<string, unknown>,
- userId,
- connectedAccountId: connectedAccountId,
+ userId: userId,
+ // connectedAccountId: connectedAccountId,
},
modifiers
)
diff --git a/packages/toolsets/vercel/src/index.ts b/packages/toolsets/vercel/src/index.ts
index 169d86d1c..c53128aae 100644
--- a/packages/toolsets/vercel/src/index.ts
+++ b/packages/toolsets/vercel/src/index.ts
@@ -77,7 +77,7 @@ export class VercelToolset extends BaseAgenticToolset<VercelToolCollection, Verc
}
const toolSchema = await this.getComposio().tools.getComposioToolBySlug(userId, tool.name);
- const appName = toolSchema?.name.toLowerCase();
+ // const appName = toolSchema?.name.toLowerCase();
const args = typeof tool.arguments === 'string' ? JSON.parse(tool.arguments) : tool.arguments;
const results = await this.getComposio().tools.execute(
@@ -85,7 +85,7 @@ export class VercelToolset extends BaseAgenticToolset<VercelToolCollection, Verc
{
arguments: args,
userId: userId,
- connectedAccountId: this.getComposio().getConnectedAccountId(appName),
+ // connectedAccountId: this.getComposio().getConnectedAccountId(appName),
},
modifiers
);