MCPcopy Index your code
hub / github.com/simstudioai/sim / getToolOutputs

Function getToolOutputs

apps/sim/lib/workflows/blocks/block-outputs.ts:627–660  ·  view source on GitHub ↗
(
  blockConfig: BlockConfig,
  subBlocks?: Record<string, SubBlockWithValue>,
  options?: { includeHidden?: boolean }
)

Source from the content-addressed store, hash-verified

625 * @returns Outputs schema for the tool, or empty object on error
626 */
627export function getToolOutputs(
628 blockConfig: BlockConfig,
629 subBlocks?: Record<string, SubBlockWithValue>,
630 options?: { includeHidden?: boolean }
631): Record<string, any> {
632 const includeHidden = options?.includeHidden ?? false
633 if (!blockConfig?.tools?.config?.tool) return {}
634
635 try {
636 // Build params object from subBlock values for tool selector
637 // This allows tool selectors to use any field (operation, provider, etc.)
638 const params: Record<string, any> = {}
639 if (subBlocks) {
640 for (const [key, subBlock] of Object.entries(subBlocks)) {
641 params[key] = subBlock.value
642 }
643 }
644
645 const toolId = blockConfig.tools.config.tool(params)
646 if (!toolId) return {}
647
648 const toolConfig = getTool(toolId)
649 if (!toolConfig?.outputs) return {}
650 if (includeHidden) {
651 return toolConfig.outputs
652 }
653 return Object.fromEntries(
654 Object.entries(toolConfig.outputs).filter(([_, def]) => !isHiddenFromDisplay(def))
655 )
656 } catch (error) {
657 logger.warn('Failed to get tool outputs', { error })
658 return {}
659 }
660}
661
662/**
663 * Generates output paths from a schema definition.

Callers 1

getEffectiveBlockOutputsFunction · 0.85

Calls 3

getToolFunction · 0.90
isHiddenFromDisplayFunction · 0.90
warnMethod · 0.65

Tested by

no test coverage detected