Jobs

From wyre-technology/msp-claude-plugins · View interactive version

Jobs is an AI agent skill from the GitHub repository wyre-technology/msp-claude-plugins. Datto RMM job execution: quick jobs vs. scheduled vs. policy jobs, the job status lifecycle, component scripts and their variables, and stdout/stderr/exit-code result handling.

How to use this skill

Skill file

Datto RMM Job Management

Overview

Jobs in Datto RMM execute component scripts on devices. Quick jobs run immediately; scheduled jobs run at specified times. Each job can accept variables, produces output (stdout/stderr), and has a status lifecycle. This skill covers job execution, monitoring, and results retrieval.

Anti-triggers

agent procedures and exposes kaseya_vsa_run_procedure; use

kaseya-vsa-api-patterns.

per run; account and site variables are a separate persistent store

in datto-rmm-variables.

MCP Tools

| Tool | Tier | Purpose |

|------|------|---------|

| datto_run_quickjob | admin | Run a component on one device (deviceUid, componentUid, jobName, variables); returns a job UID |

| datto_get_job | read | Job status: queued, running, completed |

| datto_get_job_components | read | The components and variables the job ran |

| datto_get_job_results | admin | Per-device result: status, exit code, error message |

| datto_get_job_stdout / datto_get_job_stderr | admin | What the script printed on that device |

Tiers are Conduit's classification. REST examples later in this skill show what the tools call underneath.

Key Concepts

Job Types

| Type | Description | Use Case |

|------|-------------|----------|

| Quick Job | Runs immediately | Ad-hoc tasks, troubleshooting |

| Scheduled Job | Runs at specified time | Maintenance, recurring tasks |

| Policy Job | Runs based on policy | Automated responses |

Job Lifecycle

Created → Queued → Running → Completed/Failed
                      │
                      └─→ Timeout

Component Scripts

Components are the scripts/programs that jobs execute:

Field Reference

A Job carries identifiers, target device/site, component, status,

start/complete timestamps, exitCode/stdout/stderr results, and input

variables. A Component declares its own typed ComponentVariable[]

(name, type, required, default). See

references/fields.md for the complete interfaces.

Common Workflows

Run Job and Wait for Completion

async function runJobAndWait(client, deviceUid, componentUid, variables = {}, options = {}) {
  const { timeoutMs = 300000, pollIntervalMs = 5000 } = options;

  // Create the job
  const createResponse = await client.request(
    `/api/v2/device/${deviceUid}/quickjob`,
    {
      method: 'POST',
      body: JSON.stringify({ componentUid, variables })
    }
  );

  const jobUid = createResponse.jobUid;
  const startTime = Date.now();

  // Poll for completion
  while (true) {
    const job = await client.request(`/api/v2/job/${jobUid}`);

    if (job.status === 'completed' || job.status === 'failed' || job.status === 'timeout') {
      return {
        success: job.status === 'completed' && job.exitCode === 0,
        job
      };
    }

    // Check timeout
    if (Date.now() - startTime > timeoutMs) {
      return {
        success: false,
        job,
        error: 'Job polling timeout exceeded'
      };
    }

    await sleep(pollIntervalMs);
  }
}

Related helpers - component lookup by name, batch execution across

multiple devices, multi-job monitoring, result summarization, and a

"safe run" wrapper that pre-validates device status and required

variables - are in references/examples.md.

API Patterns

See references/api.md for full request/response examples.

Gotchas

Exit Code Reference

| Exit Code | Typical Meaning |

|-----------|-----------------|

| 0 | Success |

| 1 | General error |

| 2 | Misuse of command |

| 126 | Permission denied |

| 127 | Command not found |

| 130 | Script terminated (Ctrl+C) |

| 137 | Killed (SIGKILL) |

| 143 | Terminated (SIGTERM) |

See references/errors.md for the full job API error table.

Related Skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.