Skip to content

Commit f90c9c7

Browse files
committed
undo
1 parent 2e624c2 commit f90c9c7

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

apps/sim/tools/params.ts

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -248,17 +248,26 @@ export function getToolParametersConfig(
248248
if (blockConfig) {
249249
// For multi-operation tools, find the subblock that matches both the parameter ID
250250
// and the current tool operation
251-
const operationCandidates = getOperationCandidates(toolId, blockType)
252-
const paramIdToMatch = paramId
253251
let subBlock = blockConfig.subBlocks?.find((sb: SubBlockConfig) => {
254-
if (sb.id !== paramIdToMatch) return false
252+
if (sb.id !== paramId) return false
255253

256254
// If there's a condition, check if it matches the current tool
257255
if (sb.condition && sb.condition.field === 'operation') {
258-
const conditionValues = Array.isArray(sb.condition.value)
259-
? sb.condition.value
260-
: [sb.condition.value]
261-
return conditionValues.some((value) => operationCandidates.includes(String(value)))
256+
// First try exact match with full tool ID
257+
if (sb.condition.value === toolId) return true
258+
259+
// Then try extracting operation from tool ID
260+
// For tools like 'google_calendar_quick_add', extract 'quick_add'
261+
const parts = toolId.split('_')
262+
if (parts.length >= 3) {
263+
// Join everything after the provider prefix (e.g., 'google_calendar_')
264+
const operation = parts.slice(2).join('_')
265+
if (sb.condition.value === operation) return true
266+
}
267+
268+
// Fallback to last part only
269+
const operation = parts[parts.length - 1]
270+
return sb.condition.value === operation
262271
}
263272

264273
// If no condition, it's a global parameter (like apiKey)
@@ -267,7 +276,7 @@ export function getToolParametersConfig(
267276

268277
// Fallback: if no operation-specific match, find any matching parameter
269278
if (!subBlock) {
270-
subBlock = blockConfig.subBlocks?.find((sb: SubBlockConfig) => sb.id === paramIdToMatch)
279+
subBlock = blockConfig.subBlocks?.find((sb: SubBlockConfig) => sb.id === paramId)
271280
}
272281

273282
// Special case: Check if this boolean parameter is part of a checkbox-list

0 commit comments

Comments
 (0)