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

Function prepareExecutionContext

apps/sim/lib/copilot/tools/handlers/context.ts:5–26  ·  view source on GitHub ↗
(
  userId: string,
  workflowId: string,
  chatId?: string,
  options?: {
    workspaceId?: string
    decryptedEnvVars?: Record<string, string>
  }
)

Source from the content-addressed store, hash-verified

3import { getWorkflowById } from '@/lib/workflows/utils'
4
5export async function prepareExecutionContext(
6 userId: string,
7 workflowId: string,
8 chatId?: string,
9 options?: {
10 workspaceId?: string
11 decryptedEnvVars?: Record<string, string>
12 }
13): Promise<ExecutionContext> {
14 const workspaceId =
15 options?.workspaceId ?? (await getWorkflowById(workflowId))?.workspaceId ?? undefined
16 const decryptedEnvVars =
17 options?.decryptedEnvVars ?? (await getEffectiveDecryptedEnv(userId, workspaceId))
18
19 return {
20 userId,
21 workflowId,
22 workspaceId,
23 chatId,
24 decryptedEnvVars,
25 }
26}

Callers 2

buildExecutionContextFunction · 0.90

Calls 2

getWorkflowByIdFunction · 0.90
getEffectiveDecryptedEnvFunction · 0.90

Tested by

no test coverage detected