MCPcopy
hub / github.com/simstudioai/sim / getExposedIntegrationTools

Function getExposedIntegrationTools

apps/sim/lib/copilot/integration-tools.ts:32–63  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

30 * version drift between what the VFS shows and what is loadable.
31 */
32export function getExposedIntegrationTools(): ExposedIntegrationTool[] {
33 if (cached) return cached
34
35 // Map the tool ids each visible block exposes (both the raw id and its
36 // version-stripped base name) to that block's service directory.
37 const toolToService = new Map<string, string>()
38 for (const block of getAllBlocks()) {
39 if (block.hideFromToolbar) continue
40 if (!block.tools?.access) continue
41 const service = stripVersionSuffix(block.type)
42 for (const toolId of block.tools.access) {
43 toolToService.set(toolId, service)
44 toolToService.set(stripVersionSuffix(toolId), service)
45 }
46 }
47
48 const exposed: ExposedIntegrationTool[] = []
49 const seen = new Set<string>()
50 for (const [toolId, config] of Object.entries(getLatestVersionTools(toolRegistry))) {
51 const baseName = stripVersionSuffix(toolId)
52 const service = toolToService.get(toolId) ?? toolToService.get(baseName)
53 if (!service) continue
54 if (seen.has(baseName)) continue
55 seen.add(baseName)
56 const prefix = `${service}_`
57 const operation = baseName.startsWith(prefix) ? baseName.slice(prefix.length) : baseName
58 exposed.push({ toolId, config, service, operation })
59 }
60
61 cached = exposed
62 return exposed
63}
64
65/** Test-only: clears the memoized set so registry changes are picked up. */
66export function resetExposedIntegrationToolsCache(): void {

Callers 3

getStaticComponentFilesFunction · 0.90

Calls 7

getAllBlocksFunction · 0.90
stripVersionSuffixFunction · 0.90
getLatestVersionToolsFunction · 0.90
setMethod · 0.65
getMethod · 0.65
addMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected