( toolManifest: ToolManifestEntry, cache: Map<string, ImportedToolModule>, )
| 370 | } |
| 371 | |
| 372 | async function tryImportToolModule( |
| 373 | toolManifest: ToolManifestEntry, |
| 374 | cache: Map<string, ImportedToolModule>, |
| 375 | ): Promise<ImportedToolModule | undefined> { |
| 376 | const cached = cache.get(toolManifest.id); |
| 377 | if (cached) { |
| 378 | return cached; |
| 379 | } |
| 380 | |
| 381 | try { |
| 382 | const toolModule = await importToolModule(toolManifest.module); |
| 383 | cache.set(toolManifest.id, toolModule); |
| 384 | return toolModule; |
| 385 | } catch (err) { |
| 386 | log('warn', `Failed to import tool module ${toolManifest.module}: ${err}`); |
| 387 | return undefined; |
| 388 | } |
| 389 | } |
| 390 | |
| 391 | function toCatalogTool( |
| 392 | toolManifest: ToolManifestEntry, |
no test coverage detected