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

Function notifyMcpToolServers

apps/sim/lib/mcp/workflow-mcp-sync.ts:368–392  ·  view source on GitHub ↗
(tools: Array<{ serverId: string }>)

Source from the content-addressed store, hash-verified

366 * Resolves workspace IDs from the server table so callers don't need to pass them.
367 */
368export function notifyMcpToolServers(tools: Array<{ serverId: string }>): void {
369 if (!mcpPubSub) return
370
371 const uniqueServerIds = [...new Set(tools.map((t) => t.serverId))]
372
373 void (async () => {
374 try {
375 const servers = await db
376 .select({ id: workflowMcpServer.id, workspaceId: workflowMcpServer.workspaceId })
377 .from(workflowMcpServer)
378 .where(
379 and(inArray(workflowMcpServer.id, uniqueServerIds), isNull(workflowMcpServer.deletedAt))
380 )
381
382 for (const server of servers) {
383 mcpPubSub.publishWorkflowToolsChanged({
384 serverId: server.id,
385 workspaceId: server.workspaceId,
386 })
387 }
388 } catch (error) {
389 logger.error('Error notifying affected servers:', error)
390 }
391 })()
392}

Callers 4

syncMcpToolsForWorkflowFunction · 0.85

Calls 2

errorMethod · 0.80

Tested by

no test coverage detected