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

Function createVersionedToolSelector

apps/sim/blocks/utils.ts:416–432  ·  view source on GitHub ↗
(args: {
  baseToolSelector: (params: TParams) => string
  suffix: `_${string}`
  fallbackToolId: string
})

Source from the content-addressed store, hash-verified

414 * }
415 */
416export function createVersionedToolSelector<TParams extends Record<string, any>>(args: {
417 baseToolSelector: (params: TParams) => string
418 suffix: `_${string}`
419 fallbackToolId: string
420}): (params: TParams) => string {
421 const { baseToolSelector, suffix, fallbackToolId } = args
422
423 return (params: TParams) => {
424 try {
425 const baseToolId = baseToolSelector(params)
426 if (!baseToolId || typeof baseToolId !== 'string') return fallbackToolId
427 return baseToolId.endsWith(suffix) ? baseToolId : `${baseToolId}${suffix}`
428 } catch {
429 return fallbackToolId
430 }
431 }
432}
433
434interface ParseOptionalNumberInputOptions {
435 integer?: boolean

Callers 15

extend.tsFile · 0.90
reducto.tsFile · 0.90
textract.tsFile · 0.90
notion.tsFile · 0.90
github.tsFile · 0.90
mistral_parse.tsFile · 0.90
microsoft_excel.tsFile · 0.90
file.tsFile · 0.90
pulse.tsFile · 0.90
kalshi.tsFile · 0.90
google_calendar.tsFile · 0.90
google_sheets.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected