Files
simstudioai--sim/apps/sim/tools/uptimerobot/create_monitor.ts
T
wehub-resource-sync d25d482dc2
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:20:55 +08:00

206 lines
5.7 KiB
TypeScript

import type { ToolConfig } from '@/tools/types'
import {
buildMonitorBody,
MONITOR_OUTPUT_PROPERTIES,
mapMonitor,
UPTIMEROBOT_API_BASE,
type UptimeRobotCreateMonitorParams,
type UptimeRobotMonitorResponse,
uptimeRobotError,
uptimeRobotHeaders,
} from '@/tools/uptimerobot/types'
export const uptimeRobotCreateMonitorTool: ToolConfig<
UptimeRobotCreateMonitorParams,
UptimeRobotMonitorResponse
> = {
id: 'uptimerobot_create_monitor',
name: 'UptimeRobot Create Monitor',
description: 'Create a new monitor in UptimeRobot',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'UptimeRobot API key',
},
friendlyName: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Friendly name of the monitor',
},
type: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Monitor type: HTTP, KEYWORD, PING, PORT, HEARTBEAT, DNS, API, or UDP',
},
url: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'URL or host to monitor (not required for Heartbeat monitors)',
},
interval: {
type: 'number',
required: true,
visibility: 'user-or-llm',
description: 'Check interval in seconds (minimum 30)',
},
checkTimeout: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Check timeout in seconds, 0-60 (HTTP, Keyword and Port monitors only)',
},
port: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Port to check, 1-65535 (required for Port and UDP monitors)',
},
keywordType: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Keyword match type for Keyword monitors: ALERT_EXISTS or ALERT_NOT_EXISTS',
},
keywordValue: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Keyword to look for (Keyword monitors only)',
},
keywordCaseType: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Keyword case sensitivity: 0 (case-sensitive) or 1 (case-insensitive)',
},
httpMethodType: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'HTTP method: HEAD, GET, POST, PUT, PATCH, DELETE, or OPTIONS (defaults to HEAD)',
},
authType: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'HTTP authentication: NONE, HTTP_BASIC, DIGEST, or BEARER',
},
httpUsername: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Username for HTTP authentication',
},
httpPassword: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Password for HTTP authentication',
},
gracePeriod: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Grace period in seconds, 0-86400 (Heartbeat monitors only)',
},
successHttpResponseCodes: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated success HTTP response codes (e.g. "2xx,3xx")',
},
checkSSLErrors: {
type: 'boolean',
required: false,
visibility: 'user-or-llm',
description: 'Whether to check for SSL and domain expiration errors',
},
followRedirections: {
type: 'boolean',
required: false,
visibility: 'user-or-llm',
description: 'Whether to follow redirects',
},
sslExpirationReminder: {
type: 'boolean',
required: false,
visibility: 'user-or-llm',
description: 'Whether to send SSL certificate expiration reminders',
},
domainExpirationReminder: {
type: 'boolean',
required: false,
visibility: 'user-or-llm',
description: 'Whether to send domain expiration reminders',
},
responseTimeThreshold: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Response time threshold in milliseconds, 0-60000',
},
tagNames: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated tag names to assign to the monitor',
},
assignedAlertContacts: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'JSON array of alert-contact assignments, e.g. [{"alertContactId":123,"threshold":0,"recurrence":0}]',
},
customHttpHeaders: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'JSON object of custom HTTP headers to send with the request',
},
groupId: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Monitor group ID to assign the monitor to (0 for no group)',
},
},
request: {
url: () => `${UPTIMEROBOT_API_BASE}/monitors`,
method: 'POST',
headers: (params) => ({
...uptimeRobotHeaders(params.apiKey),
'Content-Type': 'application/json',
}),
body: (params) => buildMonitorBody(params),
},
transformResponse: async (response: Response) => {
if (!response.ok) {
throw new Error(await uptimeRobotError(response))
}
const data = await response.json()
return {
success: true,
output: { monitor: mapMonitor(data) },
}
},
outputs: {
monitor: {
type: 'object',
description: 'The created monitor',
properties: MONITOR_OUTPUT_PROPERTIES,
},
},
}