api-patterns
3CX's native PBX MCP server: the per-PBX endpoint shape (every PBX is its own FQDN and its own OAuth authorization server — there is no shared mcp.3cx.com),…
ConnectWise Automate script management: script types (PowerShell, batch, VBScript, Shell), script folders, script execution on computers, parameter handling and validation, execution status polling, and result/history retrieval.
$ npx -y skills add wyre-technology/msp-claude-plugins --skill scripts --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/scriptsContext preview
The summary Claude sees to decide when to auto-load this skill.
ConnectWise Automate script management: script types (PowerShell, batch, VBScript, Shell), script folders, script execution on computers, parameter handling and validation, execution status polling, and result/history retrieval.
name: "ConnectWise Automate Scripts" description: > ConnectWise Automate script management: script types (PowerShell, batch, VBScript, Shell), script folders, script execution on computers, parameter handling and validation, execution status polling, and result/history retrieval. when_to_use: >- When listing, executing, passing parameters, and retrieving results. Use when: automate script, automate powershell, automate execute, run script, script execution, script parameters, script results, script history, labtech script, or automate automation.
Scripts in ConnectWise Automate are automation routines that run on managed endpoints. They can be PowerShell, batch files, VBScript, or Automate's native scripting language. This skill covers script listing, execution, parameters, and result retrieval.
dispatching a stored Automate script to a customer's managed endpoint, never executing anything on the local machine.
triggers it is a monitor definition; use `connectwise-automate-monitors`.
status and building the target list is `connectwise-automate-computers`.
runs share this vocabulary; use `datto-rmm-jobs`.
| Type | Extension | Use Case | |------|-----------|----------| | **Automate Script** | Internal | Built-in functions, agent commands | | **PowerShell** | .ps1 | Windows automation, complex logic | | **Batch** | .bat/.cmd | Simple Windows tasks | | **VBScript** | .vbs | Legacy Windows automation | | **Shell** | .sh | Linux/macOS automation |
| Mode | Description | Use Case | |------|-------------|----------| | **Immediate** | Run now on target | Ad-hoc tasks | | **Scheduled** | Run at specific time | Maintenance | | **On Event** | Triggered by alert/monitor | Automated remediation | | **Login/Logout** | Run at user session events | User setup |
| Status | Description | |--------|-------------| | `Running` | Currently executing | | `Completed` | Finished successfully | | `Failed` | Execution error | | `Pending` | Queued for execution | | `Timeout` | Exceeded time limit | | `Cancelled` | Manually stopped |
See [references/fields.md](references/fields.md) for the complete `Script`, `ScriptParameter`, and `ScriptExecution` field reference (TypeScript interfaces).
See [references/api.md](references/api.md) for the complete endpoint catalog: listing/searching scripts, executing on one or many computers, polling execution status, and retrieving execution history — with full request/response JSON examples.
async function findScriptByName(client, name) {
const scripts = await client.request(
`/Scripts?condition=Name contains '${name}'&pageSize=50`
);
if (scripts.length === 0) {
return { found: false, suggestions: [] };
}
if (scripts.length === 1) {
return { found: true, script: scripts[0] };
}
return {
found: false,
ambiguous: true,
suggestions: scripts.map(s => ({
name: s.Name,
id: s.ScriptID,
folder: s.FolderPath,
description: s.Description
}))
};
}async function runScriptAndWait(client, computerId, scriptId, params = {}, options = {}) {
const { timeoutMs = 300000, pollIntervalMs = 5000 } = options;
// Start the script
const execution = await client.request(
`/Computers/${computerId}/Scripts/${scriptId}/Execute`,
{
method: 'POST',
body: JSON.stringify({ Parameters: params })
}
);
const startTime = Date.now();
// Poll for completion
while (true) {
const status = await client.request(
`/Scripts/Executions/${execution.ExecutionID}`
);
if (['Completed', 'Failed', 'Timeout', 'Cancelled'].includes(status.Status)) {
return {
success: status.Status === 'Completed' && status.ExitCode === 0,
execution: status
};
}
// Check timeout
if (Date.now() - startTime > timeoutMs) {
return {
success: false,
execution: status,
error: 'Polling timeout exceeded'
};
}
await sleep(pollIntervalMs);
}
}async function validateScriptParams(client, scriptId, providedParams) {
const script = await client.request(`/Scripts/${scriptId}`);
const errors = [];
const warnings = [];
for (const param of script.Parameters || []) {
const value = providedParams[param.Name];
// Check required parameters
if (param.Required && !value && !param.DefaultValue) {
errors.push(`Missing required parameter: ${param.Name}`);
continue;
}
// Type validation
if (value) {
switch (param.Type) {
case 'Number':
if (isNaN(Number(value))) {
errors.push(`Parameter ${param.Name} must be a number`);
}
break;
case 'Boolean':
if (!['true', 'false', '1', '0'].includes(value.toLowerCase())) {
errors.push(`Parameter ${param.Name} must be true/false`);
}
break;
case 'Dropdown':
if (param.Options && !param.Options.includes(value)) {
errors.push(`Parameter ${param.Name} must be one of: ${param.Options.join(', ')}`);
}
break;
}
}
}
// Check for unknown parameters
const knownParams = new Set((script.Parameters || []).map(p => p.Name));
for (const provided of Object.keys(providedParams)) {
if (!knownParams.has(provided)) {
warnings.push(`Unknown parametOne command to supercharge Claude Code for MSP workflows. Then restart Claude Code. That's it. Documentation: mcp.wyre.ai
Repo: wyre-technology/msp-claude-plugins
3CX's native PBX MCP server: the per-PBX endpoint shape (every PBX is its own FQDN and its own OAuth authorization server — there is no shared mcp.3cx.com),…
3CX's live-operations surface: read-only visibility into active calls, recordings, voicemail, department and queue membership, and forwarding/presence…
3CX's read-only directory surface: resolving a caller by email or by exact extension, searching the PBX's own phonebooks, searching contacts synced from an…
3CX's system-and-configuration surface: server time, PBX event log and application log search, service status, database schema and the read-only SELECT-only…
Abnormal Security abuse mailbox cases: user-reported email submissions, case statuses and judgments, the case lifecycle, bulk and remediation actions, and…
Abnormal Security message analysis: message retrieval, email header inspection, attachments, sender reputation, delivery context, and SPF/DKIM/DMARC…