Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 23, 03:00 UTC
Rollback changes related to executeMetadata
haxzie committed
May 14, 2025 at 18:51 UTC
be9612894574b2dc039cff9bd6b53a317150c548
6 files changed
+16
-12
packages/core/src/index.ts
+1
@@ -11,6 +11,7 @@ export { BaseTelemetryTransport } from './telemetry/TelemetryTransport';
11
export { jsonSchemaToModel } from './utils/jsonSchema';
12
export { Tool, ToolListParams, ToolListParamsSchema } from './types/tool.types';
13
export { Toolset } from './types/toolset.types';
14
+export { ExecuteMetadata } from './types/customTool.types';
15
// Type exports
16
export type {
17
ExecuteToolModifiers,
packages/core/src/toolset/BaseToolset.ts
+1
@@ -1,6 +1,7 @@
1
import type { Tool, ToolListParams } from '../types/tool.types';
2
import type { Composio } from '../composio';
3
import { AgenticToolOptions, ExecuteToolModifiers, ToolOptions } from '../types/modifiers.types';
4
+import { ExecuteMetadata } from '../types/customTool.types';
5
6
// Type for backward compatibility and type constraints
7
export abstract class BaseNonAgenticToolset<TToolCollection, TTool> {
packages/core/src/toolset/OpenAIToolset.ts
+1
-3
@@ -82,10 +82,8 @@ export class OpenAIToolset extends BaseNonAgenticToolset<OpenAiToolCollection, O
82
if (!appSlug) {
83
throw new Error('App slug not found');
84
}
85
- const connectedAccountId = this.getComposio().getConnectedAccountId(appSlug);
85
const payload: ToolExecuteParams = {
87
- userId: userId ?? this.getComposio().userId,
88
- connectedAccountId: connectedAccountId,
86
+ userId: userId,
87
arguments: JSON.parse(tool.function.arguments),
88
};
89
const results = await this.getComposio().tools.execute(toolSchema.slug, payload, modifiers);
packages/toolsets/cloudflare/src/index.ts
+8
-4
@@ -16,6 +16,7 @@ import {
16
ExecuteToolModifiers,
17
ToolOptions,
18
BaseNonAgenticToolset,
19
+ ExecuteMetadata,
20
} from '@composio/core';
21
22
type AiToolCollection = Record<string, AiTextGenerationToolInput>;
@@ -103,7 +104,7 @@ export class CloudflareToolset extends BaseNonAgenticToolset<
104
* @returns The results of the tool call.
105
*/
106
async executeToolCall(
106
- userId: string,
107
+ executeMetadata: ExecuteMetadata,
108
tool: { name: string; arguments: unknown },
109
modifiers?: ExecuteToolModifiers
110
): Promise<string> {
@@ -111,7 +112,10 @@ export class CloudflareToolset extends BaseNonAgenticToolset<
112
throw new Error('Client not set');
113
}
114
114
- const toolSchema = await this.getComposio().tools.getComposioToolBySlug(userId, tool.name);
115
+ const toolSchema = await this.getComposio().tools.getComposioToolBySlug(
116
+ executeMetadata.userId,
117
+ tool.name
118
+ );
119
const appName = toolSchema?.toolkit?.name.toLowerCase();
120
if (!appName) {
121
throw new Error('App name not found');
@@ -121,8 +125,8 @@ export class CloudflareToolset extends BaseNonAgenticToolset<
125
toolSchema.slug,
126
{
127
arguments: args,
124
- userId,
125
- connectedAccountId: this.getComposio()?.getConnectedAccountId(appName),
128
+ userId: executeMetadata.userId,
129
+ connectedAccountId: executeMetadata.connectedAccountId,
130
},
131
modifiers
132
);
packages/toolsets/langchain/src/index.ts
+3
-3
@@ -15,6 +15,7 @@ import {
15
Tool,
16
ToolListParams,
17
AgenticToolOptions,
18
+ ExecuteMetadata,
19
} from '@composio/core';
20
import { DynamicStructuredTool } from '@langchain/core/tools';
21
@@ -38,14 +39,13 @@ export class LangchainToolset extends BaseAgenticToolset<
39
}
40
41
const func = async (...kwargs: unknown[]): Promise<unknown> => {
41
- const connectedAccountId = this.getComposio()?.getConnectedAccountId(appName);
42
return JSON.stringify(
43
await this.getComposio()?.tools.execute(
44
toolName,
45
{
46
arguments: kwargs[0] as Record<string, unknown>,
47
- userId,
48
- connectedAccountId: connectedAccountId,
47
+ userId: userId,
48
+ // connectedAccountId: connectedAccountId,
49
},
50
modifiers
51
)
packages/toolsets/vercel/src/index.ts
+2
-2
@@ -77,7 +77,7 @@ export class VercelToolset extends BaseAgenticToolset<VercelToolCollection, Verc
77
}
78
79
const toolSchema = await this.getComposio().tools.getComposioToolBySlug(userId, tool.name);
80
- const appName = toolSchema?.name.toLowerCase();
80
+ // const appName = toolSchema?.name.toLowerCase();
81
const args = typeof tool.arguments === 'string' ? JSON.parse(tool.arguments) : tool.arguments;
82
83
const results = await this.getComposio().tools.execute(
@@ -85,7 +85,7 @@ export class VercelToolset extends BaseAgenticToolset<VercelToolCollection, Verc
85
{
86
arguments: args,
87
userId: userId,
88
- connectedAccountId: this.getComposio().getConnectedAccountId(appName),
88
+ // connectedAccountId: this.getComposio().getConnectedAccountId(appName),
89
},
90
modifiers
91
);