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

Function syncMcpToolsIfStillActive

apps/sim/lib/workflows/deployment-outbox.ts:531–574  ·  view source on GitHub ↗
(params: {
  workflowId: string
  deploymentVersionId: string
  requestId: string
  state: { blocks?: Record<string, unknown> }
})

Source from the content-addressed store, hash-verified

529}
530
531async function syncMcpToolsIfStillActive(params: {
532 workflowId: string
533 deploymentVersionId: string
534 requestId: string
535 state: { blocks?: Record<string, unknown> }
536}): Promise<void> {
537 const tools = await db.transaction(async (tx) => {
538 await setWorkflowMcpTransactionLockTimeout(tx)
539
540 const [workflowRecord] = await tx
541 .select({ id: workflowTable.id })
542 .from(workflowTable)
543 .where(eq(workflowTable.id, params.workflowId))
544 .for('update')
545 .limit(1)
546
547 if (!workflowRecord) return []
548
549 const [versionRow] = await tx
550 .select({ id: workflowDeploymentVersion.id })
551 .from(workflowDeploymentVersion)
552 .where(
553 and(
554 eq(workflowDeploymentVersion.workflowId, params.workflowId),
555 eq(workflowDeploymentVersion.id, params.deploymentVersionId),
556 eq(workflowDeploymentVersion.isActive, true)
557 )
558 )
559 .limit(1)
560
561 if (!versionRow) return []
562
563 return syncMcpToolsForWorkflow({
564 workflowId: params.workflowId,
565 requestId: params.requestId,
566 state: params.state,
567 context: 'deployment-outbox',
568 tx,
569 notify: false,
570 throwOnError: true,
571 })
572 })
573 notifyMcpToolServers(tools)
574}
575
576async function createSchedulesIfStillActive(params: {
577 workflowId: string

Callers 1

syncActiveSideEffectsFunction · 0.85

Calls 4

syncMcpToolsForWorkflowFunction · 0.90
notifyMcpToolServersFunction · 0.90
eqFunction · 0.50

Tested by

no test coverage detected