Skip to content

Commit 4012478

Browse files
feat: custom action fix (#1150)
1 parent 51c0af7 commit 4012478

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

js/src/frameworks/langchain.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,11 @@ describe("Apps class tests", () => {
6060
},
6161
});
6262

63-
langchainToolSet.getTools({
63+
const tools = await langchainToolSet.getTools({
6464
actions: ["starRepositoryCustomAction"],
6565
});
6666

67+
await expect(tools.length).toBe(1);
6768
const actionOuput = await langchainToolSet.executeAction({
6869
action: "starRepositoryCustomAction",
6970
params: {

js/src/sdk/base.toolset.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,19 +138,14 @@ export class ComposioToolSet {
138138
filterByAvailableApps: parsedFilters.filterByAvailableApps,
139139
});
140140

141-
const toolsWithCustomActions = (
142-
await this.userActionRegistry.getAllActions()
143-
).filter((action) => {
144-
const { name: actionName, toolName } = action.metadata || {};
141+
const customActions = await this.userActionRegistry.getAllActions();
142+
const toolsWithCustomActions = customActions.filter((action) => {
143+
const { name: actionName } = action || {};
145144
return (
146145
(!filters.actions ||
147146
filters.actions.some(
148147
(name) => name.toLowerCase() === actionName?.toLowerCase()
149148
)) &&
150-
(!filters.apps ||
151-
filters.apps.some(
152-
(name) => name.toLowerCase() === toolName?.toLowerCase()
153-
)) &&
154149
(!filters.tags ||
155150
filters.tags.some((tag) => tag.toLowerCase() === "custom"))
156151
);

0 commit comments

Comments
 (0)