Skip to content

Commit 5987a6d

Browse files
authored
fix(custom-tools): remove unsafe title fallback in getCustomTool (#2929)
* fix(custom-tools): remove unsafe title fallback in getCustomTool * fix(custom-tools): restore title fallback in getCustomTool lookup Custom tools are referenced by title (custom_${title}), not database ID. The title fallback is required for client-side tool resolution to work.
1 parent e2ccefb commit 5987a6d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

apps/sim/hooks/queries/custom-tools.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,16 @@ export function getCustomTools(workspaceId?: string): CustomToolDefinition[] {
110110
}
111111

112112
/**
113-
* Get a specific custom tool from the query cache by ID (for non-React code)
113+
* Get a specific custom tool from the query cache by ID or title (for non-React code)
114+
* Custom tools are referenced by title in the system (custom_${title}), so title lookup is required.
114115
* If workspaceId is not provided, extracts it from the current URL
115116
*/
116117
export function getCustomTool(
117-
toolId: string,
118+
identifier: string,
118119
workspaceId?: string
119120
): CustomToolDefinition | undefined {
120121
const tools = getCustomTools(workspaceId)
121-
return tools.find((tool) => tool.id === toolId) || tools.find((tool) => tool.title === toolId)
122+
return tools.find((tool) => tool.id === identifier || tool.title === identifier)
122123
}
123124

124125
/**

0 commit comments

Comments
 (0)