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

Function executeCompleteJob

apps/sim/lib/copilot/tools/handlers/jobs.ts:355–395  ·  view source on GitHub ↗
(
  params: Record<string, unknown>,
  context: ExecutionContext
)

Source from the content-addressed store, hash-verified

353}
354
355export async function executeCompleteJob(
356 params: Record<string, unknown>,
357 context: ExecutionContext
358): Promise<ToolCallResult> {
359 const { jobId } = params as { jobId?: string }
360
361 if (!jobId) {
362 return { success: false, error: 'jobId is required' }
363 }
364
365 try {
366 if (!context.workspaceId) {
367 return { success: false, error: 'Missing workspace context' }
368 }
369
370 const result = await performCompleteJob({
371 jobId,
372 workspaceId: context.workspaceId,
373 userId: context.userId,
374 })
375 if (!result.success) {
376 return { success: false, error: result.error || 'Failed to complete job' }
377 }
378 if (result.alreadyCompleted) {
379 return {
380 success: true,
381 output: { jobId, message: 'Job is already completed' },
382 }
383 }
384
385 return {
386 success: true,
387 output: { jobId, message: 'Job marked as completed. No further executions will occur.' },
388 }
389 } catch (err) {
390 logger.error('Failed to complete job', {
391 error: toError(err).message,
392 })
393 return { success: false, error: 'Failed to complete job' }
394 }
395}
396
397export async function executeUpdateJobHistory(
398 params: Record<string, unknown>,

Callers

nothing calls this directly

Calls 3

performCompleteJobFunction · 0.90
toErrorFunction · 0.90
errorMethod · 0.80

Tested by

no test coverage detected