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

Function resolveSelectorValue

apps/sim/lib/workflows/comparison/resolve-values.ts:91–120  ·  view source on GitHub ↗
(
  value: string,
  selectorKey: SelectorKey,
  selectorContext: SelectorContext
)

Source from the content-addressed store, hash-verified

89}
90
91async function resolveSelectorValue(
92 value: string,
93 selectorKey: SelectorKey,
94 selectorContext: SelectorContext
95): Promise<string | null> {
96 try {
97 const definition = getSelectorDefinition(selectorKey)
98
99 if (definition.fetchById) {
100 const result = await definition.fetchById({
101 key: selectorKey,
102 context: selectorContext,
103 detailId: value,
104 })
105 if (result?.label) {
106 return result.label
107 }
108 }
109
110 const options = await loadAllSelectorOptions(definition, {
111 key: selectorKey,
112 context: selectorContext,
113 })
114 const match = options.find((opt) => opt.id === value)
115 return match?.label ?? null
116 } catch (error) {
117 logger.warn('Failed to resolve selector value', { value, selectorKey, error })
118 return null
119 }
120}
121
122function extractMcpToolName(toolId: string): string {
123 const withoutPrefix = toolId.startsWith('mcp-') ? toolId.slice(4) : toolId

Callers 1

resolveValueForDisplayFunction · 0.85

Calls 3

getSelectorDefinitionFunction · 0.90
loadAllSelectorOptionsFunction · 0.90
warnMethod · 0.65

Tested by

no test coverage detected