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

Function getToolIdForOperation

apps/sim/tools/params.ts:186–207  ·  view source on GitHub ↗
(blockType: string, operation?: string)

Source from the content-addressed store, hash-verified

184 * Gets the correct tool ID for a block operation.
185 */
186export function getToolIdForOperation(blockType: string, operation?: string): string | undefined {
187 const block = getBlockConfigurations()[blockType]
188 if (!block?.tools?.access) return undefined
189
190 if (block.tools.access.length === 1) {
191 return block.tools.access[0]
192 }
193
194 if (operation && block.tools.config?.tool) {
195 try {
196 return block.tools.config.tool({ operation })
197 } catch (error) {
198 logger.error('Error selecting tool for operation:', error)
199 }
200 }
201
202 if (operation && block.tools.access.includes(operation)) {
203 return operation
204 }
205
206 return block.tools.access[0]
207}
208
209function resolveSubBlockForParam(
210 paramId: string,

Callers 2

getToolInputParamConfigsFunction · 0.90
tool-input.tsxFile · 0.90

Calls 2

getBlockConfigurationsFunction · 0.85
errorMethod · 0.80

Tested by

no test coverage detected