Skip to content

Commit 7c0f433

Browse files
fix(resolver): tool configs must take precedence (#2876)
1 parent ee75721 commit 7c0f433

File tree

1 file changed

+6
-2
lines changed
  • apps/sim/executor/variables/resolvers

1 file changed

+6
-2
lines changed

apps/sim/executor/variables/resolvers/block.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
type Resolver,
1111
} from '@/executor/variables/resolvers/reference'
1212
import type { SerializedBlock, SerializedWorkflow } from '@/serializer/types'
13+
import { getTool } from '@/tools/utils'
1314

1415
function isPathInOutputSchema(
1516
outputs: Record<string, any> | undefined,
@@ -168,8 +169,11 @@ export class BlockResolver implements Resolver {
168169
}
169170
}
170171

171-
const schemaFields = getSchemaFieldNames(block?.outputs)
172-
if (schemaFields.length > 0 && !isPathInOutputSchema(block?.outputs, pathParts)) {
172+
const toolId = block?.config?.tool
173+
const toolConfig = toolId ? getTool(toolId) : undefined
174+
const outputSchema = toolConfig?.outputs ?? block?.outputs
175+
const schemaFields = getSchemaFieldNames(outputSchema)
176+
if (schemaFields.length > 0 && !isPathInOutputSchema(outputSchema, pathParts)) {
173177
throw new Error(
174178
`"${pathParts.join('.')}" doesn't exist on block "${blockName}". ` +
175179
`Available fields: ${schemaFields.join(', ')}`

0 commit comments

Comments
 (0)