Files
simstudioai--sim/apps/sim/tools/incidentio/incidents_create.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

185 lines
6.1 KiB
TypeScript

import type {
IncidentioIncidentsCreateParams,
IncidentioIncidentsCreateResponse,
} from '@/tools/incidentio/types'
import type { ToolConfig } from '@/tools/types'
export const incidentsCreateTool: ToolConfig<
IncidentioIncidentsCreateParams,
IncidentioIncidentsCreateResponse
> = {
id: 'incidentio_incidents_create',
name: 'incident.io Incidents Create',
description:
'Create a new incident in incident.io. Requires idempotency_key, severity_id, and visibility. Optionally accepts name, summary, type, and status.',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'incident.io API Key',
},
idempotency_key: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description:
'Unique identifier to prevent duplicate incident creation. Use a UUID or unique string.',
},
name: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Name of the incident (e.g., "Database connection issues")',
},
summary: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Brief summary of the incident (e.g., "Intermittent connection failures to primary database")',
},
severity_id: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'ID of the severity level (e.g., "01FCNDV6P870EA6S7TK1DSYDG0")',
},
incident_type_id: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'ID of the incident type',
},
incident_status_id: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'ID of the initial incident status',
},
visibility: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Visibility of the incident: "public" or "private" (required)',
},
},
request: {
url: 'https://api.incident.io/v2/incidents',
method: 'POST',
headers: (params) => ({
'Content-Type': 'application/json',
Authorization: `Bearer ${params.apiKey}`,
}),
body: (params) => {
const body: Record<string, any> = {
idempotency_key: params.idempotency_key,
severity_id: params.severity_id,
visibility: params.visibility,
}
if (params.name) body.name = params.name
if (params.summary) body.summary = params.summary
if (params.incident_type_id) body.incident_type_id = params.incident_type_id
if (params.incident_status_id) body.incident_status_id = params.incident_status_id
return body
},
},
transformResponse: async (response: Response) => {
const data = await response.json()
const incident = data.incident || data
return {
success: true,
output: {
incident: {
id: incident.id,
name: incident.name,
summary: incident.summary,
description: incident.description,
mode: incident.mode,
call_url: incident.call_url,
severity: incident.severity
? {
id: incident.severity.id,
name: incident.severity.name,
rank: incident.severity.rank,
}
: undefined,
status: incident.incident_status
? {
id: incident.incident_status.id,
name: incident.incident_status.name,
category: incident.incident_status.category,
}
: undefined,
incident_type: incident.incident_type
? {
id: incident.incident_type.id,
name: incident.incident_type.name,
}
: undefined,
created_at: incident.created_at,
updated_at: incident.updated_at,
incident_url: incident.incident_url,
slack_channel_id: incident.slack_channel_id,
slack_channel_name: incident.slack_channel_name,
visibility: incident.visibility,
},
},
}
},
outputs: {
incident: {
type: 'object',
description: 'The created incident object',
properties: {
id: { type: 'string', description: 'Incident ID' },
name: { type: 'string', description: 'Incident name' },
summary: { type: 'string', description: 'Brief summary of the incident' },
description: { type: 'string', description: 'Detailed description of the incident' },
mode: { type: 'string', description: 'Incident mode (e.g., standard, retrospective)' },
call_url: { type: 'string', description: 'URL for the incident call/bridge' },
severity: {
type: 'object',
description: 'Severity of the incident',
properties: {
id: { type: 'string', description: 'Severity ID' },
name: { type: 'string', description: 'Severity name' },
rank: { type: 'number', description: 'Severity rank' },
},
},
status: {
type: 'object',
description: 'Current status of the incident',
properties: {
id: { type: 'string', description: 'Status ID' },
name: { type: 'string', description: 'Status name' },
category: { type: 'string', description: 'Status category' },
},
},
incident_type: {
type: 'object',
description: 'Type of the incident',
properties: {
id: { type: 'string', description: 'Type ID' },
name: { type: 'string', description: 'Type name' },
},
},
created_at: { type: 'string', description: 'Creation timestamp' },
updated_at: { type: 'string', description: 'Last update timestamp' },
incident_url: { type: 'string', description: 'URL to the incident' },
slack_channel_id: { type: 'string', description: 'Associated Slack channel ID' },
slack_channel_name: { type: 'string', description: 'Associated Slack channel name' },
visibility: { type: 'string', description: 'Incident visibility' },
},
},
},
}