( value: string, selectorKey: SelectorKey, selectorContext: SelectorContext )
| 89 | } |
| 90 | |
| 91 | async 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 | |
| 122 | function extractMcpToolName(toolId: string): string { |
| 123 | const withoutPrefix = toolId.startsWith('mcp-') ? toolId.slice(4) : toolId |
no test coverage detected