chore: import upstream snapshot with attribution
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

This commit is contained in:
wehub-resource-sync
2026-07-13 13:20:55 +08:00
commit d25d482dc2
13754 changed files with 4996608 additions and 0 deletions
+76
View File
@@ -0,0 +1,76 @@
import type { CancelDowntimeParams, CancelDowntimeResponse } from '@/tools/datadog/types'
import type { ToolConfig } from '@/tools/types'
export const cancelDowntimeTool: ToolConfig<CancelDowntimeParams, CancelDowntimeResponse> = {
id: 'datadog_cancel_downtime',
name: 'Datadog Cancel Downtime',
description: 'Cancel a scheduled downtime.',
version: '1.0.0',
params: {
downtimeId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'The ID of the downtime to cancel (e.g., "abc123def456")',
},
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Datadog API key',
},
applicationKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Datadog Application key',
},
site: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Datadog site/region (default: datadoghq.com)',
},
},
request: {
url: (params) => {
const site = params.site || 'datadoghq.com'
return `https://api.${site}/api/v2/downtime/${params.downtimeId}`
},
method: 'DELETE',
headers: (params) => ({
'Content-Type': 'application/json',
'DD-API-KEY': params.apiKey,
'DD-APPLICATION-KEY': params.applicationKey,
}),
},
transformResponse: async (response: Response) => {
if (!response.ok && response.status !== 204) {
const errorData = await response.json().catch(() => ({}))
return {
success: false,
output: {
success: false,
},
error: errorData.errors?.[0]?.detail || `HTTP ${response.status}: ${response.statusText}`,
}
}
return {
success: true,
output: {
success: true,
},
}
},
outputs: {
success: {
type: 'boolean',
description: 'Whether the downtime was successfully canceled',
},
},
}
+179
View File
@@ -0,0 +1,179 @@
import type { CreateDowntimeParams, CreateDowntimeResponse } from '@/tools/datadog/types'
import type { ToolConfig } from '@/tools/types'
export const createDowntimeTool: ToolConfig<CreateDowntimeParams, CreateDowntimeResponse> = {
id: 'datadog_create_downtime',
name: 'Datadog Create Downtime',
description: 'Schedule a downtime to suppress monitor notifications during maintenance windows.',
version: '1.0.0',
params: {
scope: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description:
'Scope to apply downtime to (e.g., "host:myhost", "env:production", or "*" for all)',
},
message: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Message to display during downtime',
},
start: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description:
'Unix timestamp for downtime start in seconds (e.g., 1705320000, defaults to now)',
},
end: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Unix timestamp for downtime end in seconds (e.g., 1705323600)',
},
timezone: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Timezone for the downtime (e.g., "America/New_York", "UTC", "Europe/London")',
},
monitorId: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Specific monitor ID to mute (e.g., "12345678")',
},
monitorTags: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated monitor tags to match (e.g., "team:backend,priority:high")',
},
muteFirstRecoveryNotification: {
type: 'boolean',
required: false,
visibility: 'user-only',
description: 'Mute the first recovery notification',
},
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Datadog API key',
},
applicationKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Datadog Application key',
},
site: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Datadog site/region (default: datadoghq.com)',
},
},
request: {
url: (params) => {
const site = params.site || 'datadoghq.com'
return `https://api.${site}/api/v2/downtime`
},
method: 'POST',
headers: (params) => ({
'Content-Type': 'application/json',
'DD-API-KEY': params.apiKey,
'DD-APPLICATION-KEY': params.applicationKey,
}),
body: (params) => {
const schedule: Record<string, any> = {}
if (params.start) schedule.start = new Date(params.start * 1000).toISOString()
if (params.end) schedule.end = new Date(params.end * 1000).toISOString()
if (params.timezone) schedule.timezone = params.timezone
const body: Record<string, any> = {
data: {
type: 'downtime',
attributes: {
scope: params.scope,
schedule: Object.keys(schedule).length > 0 ? schedule : undefined,
},
},
}
if (params.message) body.data.attributes.message = params.message
if (params.muteFirstRecoveryNotification !== undefined) {
body.data.attributes.mute_first_recovery_notification = params.muteFirstRecoveryNotification
}
if (params.monitorId) {
body.data.attributes.monitor_identifier = {
monitor_id: Number.parseInt(params.monitorId, 10),
}
} else if (params.monitorTags) {
body.data.attributes.monitor_identifier = {
monitor_tags: params.monitorTags
.split(',')
.map((t: string) => t.trim())
.filter((t: string) => t.length > 0),
}
}
return body
},
},
transformResponse: async (response: Response) => {
if (!response.ok) {
const errorData = await response.json().catch(() => ({}))
return {
success: false,
output: {
downtime: {} as any,
},
error: errorData.errors?.[0]?.detail || `HTTP ${response.status}: ${response.statusText}`,
}
}
const data = await response.json()
const attrs = data.data?.attributes || {}
return {
success: true,
output: {
downtime: {
id: data.data?.id,
scope: attrs.scope ? [attrs.scope] : [],
message: attrs.message,
start: attrs.schedule?.start
? new Date(attrs.schedule.start).getTime() / 1000
: undefined,
end: attrs.schedule?.end ? new Date(attrs.schedule.end).getTime() / 1000 : undefined,
timezone: attrs.schedule?.timezone,
disabled: attrs.disabled,
active: attrs.status === 'active',
created: attrs.created ? new Date(attrs.created).getTime() / 1000 : undefined,
modified: attrs.modified ? new Date(attrs.modified).getTime() / 1000 : undefined,
},
},
}
},
outputs: {
downtime: {
type: 'object',
description: 'The created downtime details',
properties: {
id: { type: 'number', description: 'Downtime ID' },
scope: { type: 'array', description: 'Downtime scope' },
message: { type: 'string', description: 'Downtime message' },
start: { type: 'number', description: 'Start time (Unix timestamp)' },
end: { type: 'number', description: 'End time (Unix timestamp)' },
active: { type: 'boolean', description: 'Whether downtime is currently active' },
},
},
},
}
+165
View File
@@ -0,0 +1,165 @@
import type { CreateEventParams, CreateEventResponse } from '@/tools/datadog/types'
import type { ToolConfig } from '@/tools/types'
export const createEventTool: ToolConfig<CreateEventParams, CreateEventResponse> = {
id: 'datadog_create_event',
name: 'Datadog Create Event',
description:
'Post an event to the Datadog event stream. Use for deployment notifications, alerts, or any significant occurrences.',
version: '1.0.0',
params: {
title: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Event title',
},
text: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Event body/description. Supports markdown.',
},
alertType: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Alert type: error, warning, info, success, user_update, recommendation, or snapshot',
},
priority: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Event priority: normal or low',
},
host: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Host name to associate with this event (e.g., "web-server-01", "prod-api-1")',
},
tags: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Comma-separated list of tags (e.g., "env:production,service:api", "team:backend,priority:high")',
},
aggregationKey: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Key to aggregate events together',
},
sourceTypeName: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Source type name for the event',
},
dateHappened: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description:
'Unix timestamp in seconds when the event occurred (e.g., 1705320000, defaults to now)',
},
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Datadog API key',
},
site: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Datadog site/region (default: datadoghq.com)',
},
},
request: {
url: (params) => {
const site = params.site || 'datadoghq.com'
return `https://api.${site}/api/v1/events`
},
method: 'POST',
headers: (params) => ({
'Content-Type': 'application/json',
'DD-API-KEY': params.apiKey,
}),
body: (params) => {
const body: Record<string, any> = {
title: params.title,
text: params.text,
}
if (params.alertType) body.alert_type = params.alertType
if (params.priority) body.priority = params.priority
if (params.host) body.host = params.host
if (params.aggregationKey) body.aggregation_key = params.aggregationKey
if (params.sourceTypeName) body.source_type_name = params.sourceTypeName
if (params.dateHappened) body.date_happened = params.dateHappened
if (params.tags) {
body.tags = params.tags
.split(',')
.map((t: string) => t.trim())
.filter((t: string) => t.length > 0)
}
return body
},
},
transformResponse: async (response: Response) => {
if (!response.ok) {
const errorData = await response.json().catch(() => ({}))
return {
success: false,
output: {
event: {} as any,
},
error: errorData.errors?.[0] || `HTTP ${response.status}: ${response.statusText}`,
}
}
const data = await response.json()
return {
success: true,
output: {
event: {
id: data.event?.id,
title: data.event?.title,
text: data.event?.text,
date_happened: data.event?.date_happened,
priority: data.event?.priority,
alert_type: data.event?.alert_type,
host: data.event?.host,
tags: data.event?.tags,
url: data.event?.url,
},
},
}
},
outputs: {
event: {
type: 'object',
description: 'The created event details',
properties: {
id: { type: 'number', description: 'Event ID' },
title: { type: 'string', description: 'Event title' },
text: { type: 'string', description: 'Event text' },
date_happened: { type: 'number', description: 'Unix timestamp when event occurred' },
priority: { type: 'string', description: 'Event priority' },
alert_type: { type: 'string', description: 'Alert type' },
host: { type: 'string', description: 'Associated host' },
tags: { type: 'array', description: 'Event tags' },
url: { type: 'string', description: 'URL to view the event in Datadog' },
},
},
},
}
+170
View File
@@ -0,0 +1,170 @@
import type { CreateMonitorParams, CreateMonitorResponse } from '@/tools/datadog/types'
import type { ToolConfig } from '@/tools/types'
export const createMonitorTool: ToolConfig<CreateMonitorParams, CreateMonitorResponse> = {
id: 'datadog_create_monitor',
name: 'Datadog Create Monitor',
description:
'Create a new monitor/alert in Datadog. Monitors can track metrics, service checks, events, and more.',
version: '1.0.0',
params: {
name: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Monitor name',
},
type: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description:
'Monitor type: metric alert, service check, event alert, process alert, log alert, query alert, composite, synthetics alert, slo alert',
},
query: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description:
'Monitor query (e.g., "avg(last_5m):avg:system.cpu.idle{*} < 20", "logs(\"status:error\").index(\"main\").rollup(\"count\").last(\"5m\") > 100")',
},
message: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Message to include with notifications. Can include @-mentions and markdown.',
},
tags: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of tags',
},
priority: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Monitor priority (1-5, where 1 is highest)',
},
options: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'JSON string of monitor options (thresholds, notify_no_data, renotify_interval, etc.)',
},
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Datadog API key',
},
applicationKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Datadog Application key',
},
site: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Datadog site/region (default: datadoghq.com)',
},
},
request: {
url: (params) => {
const site = params.site || 'datadoghq.com'
return `https://api.${site}/api/v1/monitor`
},
method: 'POST',
headers: (params) => ({
'Content-Type': 'application/json',
'DD-API-KEY': params.apiKey,
'DD-APPLICATION-KEY': params.applicationKey,
}),
body: (params) => {
const body: Record<string, any> = {
name: params.name,
type: params.type,
query: params.query,
}
if (params.message) body.message = params.message
if (params.priority) body.priority = params.priority
if (params.tags) {
body.tags = params.tags
.split(',')
.map((t: string) => t.trim())
.filter((t: string) => t.length > 0)
}
if (params.options) {
try {
body.options =
typeof params.options === 'string' ? JSON.parse(params.options) : params.options
} catch {
// If options parsing fails, skip it
}
}
return body
},
},
transformResponse: async (response: Response) => {
if (!response.ok) {
const errorData = await response.json().catch(() => ({}))
return {
success: false,
output: {
monitor: {} as any,
},
error: errorData.errors?.[0] || `HTTP ${response.status}: ${response.statusText}`,
}
}
const data = await response.json()
return {
success: true,
output: {
monitor: {
id: data.id,
name: data.name,
type: data.type,
query: data.query,
message: data.message,
tags: data.tags,
priority: data.priority,
options: data.options,
overall_state: data.overall_state,
created: data.created,
modified: data.modified,
creator: data.creator,
},
},
}
},
outputs: {
monitor: {
type: 'object',
description: 'The created monitor details',
properties: {
id: { type: 'number', description: 'Monitor ID' },
name: { type: 'string', description: 'Monitor name' },
type: { type: 'string', description: 'Monitor type' },
query: { type: 'string', description: 'Monitor query' },
message: { type: 'string', description: 'Notification message' },
tags: { type: 'array', description: 'Monitor tags' },
priority: { type: 'number', description: 'Monitor priority' },
overall_state: { type: 'string', description: 'Current monitor state' },
created: { type: 'string', description: 'Creation timestamp' },
modified: { type: 'string', description: 'Last modification timestamp' },
},
},
},
}
+121
View File
@@ -0,0 +1,121 @@
import type { GetMonitorParams, GetMonitorResponse } from '@/tools/datadog/types'
import type { ToolConfig } from '@/tools/types'
export const getMonitorTool: ToolConfig<GetMonitorParams, GetMonitorResponse> = {
id: 'datadog_get_monitor',
name: 'Datadog Get Monitor',
description: 'Retrieve details of a specific monitor by ID.',
version: '1.0.0',
params: {
monitorId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'The ID of the monitor to retrieve (e.g., "12345678")',
},
groupStates: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Comma-separated group states to include (e.g., "alert,warn", "alert,warn,no data,ok")',
},
withDowntimes: {
type: 'boolean',
required: false,
visibility: 'user-only',
description: 'Include downtime data with the monitor',
},
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Datadog API key',
},
applicationKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Datadog Application key',
},
site: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Datadog site/region (default: datadoghq.com)',
},
},
request: {
url: (params) => {
const site = params.site || 'datadoghq.com'
const queryParams = new URLSearchParams()
if (params.groupStates) queryParams.set('group_states', params.groupStates)
if (params.withDowntimes) queryParams.set('with_downtimes', 'true')
const queryString = queryParams.toString()
return `https://api.${site}/api/v1/monitor/${params.monitorId}${queryString ? `?${queryString}` : ''}`
},
method: 'GET',
headers: (params) => ({
'Content-Type': 'application/json',
'DD-API-KEY': params.apiKey,
'DD-APPLICATION-KEY': params.applicationKey,
}),
},
transformResponse: async (response: Response) => {
if (!response.ok) {
const errorData = await response.json().catch(() => ({}))
return {
success: false,
output: {
monitor: {} as any,
},
error: errorData.errors?.[0] || `HTTP ${response.status}: ${response.statusText}`,
}
}
const data = await response.json()
return {
success: true,
output: {
monitor: {
id: data.id,
name: data.name,
type: data.type,
query: data.query,
message: data.message,
tags: data.tags,
priority: data.priority,
options: data.options,
overall_state: data.overall_state,
created: data.created,
modified: data.modified,
creator: data.creator,
},
},
}
},
outputs: {
monitor: {
type: 'object',
description: 'The monitor details',
properties: {
id: { type: 'number', description: 'Monitor ID' },
name: { type: 'string', description: 'Monitor name' },
type: { type: 'string', description: 'Monitor type' },
query: { type: 'string', description: 'Monitor query' },
message: { type: 'string', description: 'Notification message' },
tags: { type: 'array', description: 'Monitor tags' },
priority: { type: 'number', description: 'Monitor priority' },
overall_state: { type: 'string', description: 'Current monitor state' },
created: { type: 'string', description: 'Creation timestamp' },
modified: { type: 'string', description: 'Last modification timestamp' },
},
},
},
}
+25
View File
@@ -0,0 +1,25 @@
import { cancelDowntimeTool } from '@/tools/datadog/cancel_downtime'
import { createDowntimeTool } from '@/tools/datadog/create_downtime'
import { createEventTool } from '@/tools/datadog/create_event'
import { createMonitorTool } from '@/tools/datadog/create_monitor'
import { getMonitorTool } from '@/tools/datadog/get_monitor'
import { listDowntimesTool } from '@/tools/datadog/list_downtimes'
import { listMonitorsTool } from '@/tools/datadog/list_monitors'
import { muteMonitorTool } from '@/tools/datadog/mute_monitor'
import { queryLogsTool } from '@/tools/datadog/query_logs'
import { queryTimeseriesTool } from '@/tools/datadog/query_timeseries'
import { sendLogsTool } from '@/tools/datadog/send_logs'
import { submitMetricsTool } from '@/tools/datadog/submit_metrics'
export const datadogSubmitMetricsTool = submitMetricsTool
export const datadogQueryTimeseriesTool = queryTimeseriesTool
export const datadogCreateEventTool = createEventTool
export const datadogCreateMonitorTool = createMonitorTool
export const datadogGetMonitorTool = getMonitorTool
export const datadogListMonitorsTool = listMonitorsTool
export const datadogMuteMonitorTool = muteMonitorTool
export const datadogQueryLogsTool = queryLogsTool
export const datadogSendLogsTool = sendLogsTool
export const datadogCreateDowntimeTool = createDowntimeTool
export const datadogListDowntimesTool = listDowntimesTool
export const datadogCancelDowntimeTool = cancelDowntimeTool
+116
View File
@@ -0,0 +1,116 @@
import type { ListDowntimesParams, ListDowntimesResponse } from '@/tools/datadog/types'
import type { ToolConfig } from '@/tools/types'
export const listDowntimesTool: ToolConfig<ListDowntimesParams, ListDowntimesResponse> = {
id: 'datadog_list_downtimes',
name: 'Datadog List Downtimes',
description: 'List all scheduled downtimes in Datadog.',
version: '1.0.0',
params: {
currentOnly: {
type: 'boolean',
required: false,
visibility: 'user-or-llm',
description: 'Only return currently active downtimes',
},
monitorId: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Filter by monitor ID (e.g., "12345678")',
},
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Datadog API key',
},
applicationKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Datadog Application key',
},
site: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Datadog site/region (default: datadoghq.com)',
},
},
request: {
url: (params) => {
const site = params.site || 'datadoghq.com'
const queryParams = new URLSearchParams()
if (params.currentOnly) queryParams.set('current_only', 'true')
if (params.monitorId) queryParams.set('monitor_id', params.monitorId)
const queryString = queryParams.toString()
return `https://api.${site}/api/v2/downtime${queryString ? `?${queryString}` : ''}`
},
method: 'GET',
headers: (params) => ({
'Content-Type': 'application/json',
'DD-API-KEY': params.apiKey,
'DD-APPLICATION-KEY': params.applicationKey,
}),
},
transformResponse: async (response: Response) => {
if (!response.ok) {
const errorData = await response.json().catch(() => ({}))
return {
success: false,
output: {
downtimes: [],
},
error: errorData.errors?.[0]?.detail || `HTTP ${response.status}: ${response.statusText}`,
}
}
const data = await response.json()
const downtimes = (data.data || []).map((d: any) => {
const attrs = d.attributes || {}
return {
id: d.id,
scope: attrs.scope ? [attrs.scope] : [],
message: attrs.message,
start: attrs.schedule?.start ? new Date(attrs.schedule.start).getTime() / 1000 : undefined,
end: attrs.schedule?.end ? new Date(attrs.schedule.end).getTime() / 1000 : undefined,
timezone: attrs.schedule?.timezone,
disabled: attrs.disabled,
active: attrs.status === 'active',
created: attrs.created ? new Date(attrs.created).getTime() / 1000 : undefined,
modified: attrs.modified ? new Date(attrs.modified).getTime() / 1000 : undefined,
}
})
return {
success: true,
output: {
downtimes,
},
}
},
outputs: {
downtimes: {
type: 'array',
description: 'List of downtimes',
items: {
type: 'object',
properties: {
id: { type: 'number', description: 'Downtime ID' },
scope: { type: 'array', description: 'Downtime scope' },
message: { type: 'string', description: 'Downtime message' },
start: { type: 'number', description: 'Start time (Unix timestamp)' },
end: { type: 'number', description: 'End time (Unix timestamp)' },
active: { type: 'boolean', description: 'Whether downtime is currently active' },
},
},
},
},
}
+185
View File
@@ -0,0 +1,185 @@
import { createLogger } from '@sim/logger'
import type { ListMonitorsParams, ListMonitorsResponse } from '@/tools/datadog/types'
import type { ToolConfig } from '@/tools/types'
const logger = createLogger('DatadogListMonitors')
export const listMonitorsTool: ToolConfig<ListMonitorsParams, ListMonitorsResponse> = {
id: 'datadog_list_monitors',
name: 'Datadog List Monitors',
description: 'List all monitors in Datadog with optional filtering by name, tags, or state.',
version: '1.0.0',
params: {
groupStates: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Comma-separated group states to filter by (e.g., "alert,warn", "alert,warn,no data,ok")',
},
name: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Filter monitors by name with partial match (e.g., "CPU", "Production")',
},
tags: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of tags to filter by (e.g., "env:prod,team:backend")',
},
monitorTags: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Comma-separated list of monitor tags to filter by (e.g., "service:api,priority:high")',
},
withDowntimes: {
type: 'boolean',
required: false,
visibility: 'user-only',
description: 'Include downtime data with monitors',
},
page: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Page number for pagination (0-indexed, e.g., 0, 1, 2)',
},
pageSize: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Number of monitors per page (e.g., 50, max: 1000)',
},
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Datadog API key',
},
applicationKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Datadog Application key',
},
site: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Datadog site/region (default: datadoghq.com)',
},
},
request: {
url: (params) => {
const site = params.site || 'datadoghq.com'
const queryParams = new URLSearchParams()
if (params.groupStates) queryParams.set('group_states', params.groupStates)
if (params.name) queryParams.set('name', params.name)
if (params.tags) queryParams.set('tags', params.tags)
if (params.monitorTags) queryParams.set('monitor_tags', params.monitorTags)
if (params.withDowntimes) queryParams.set('with_downtimes', 'true')
if (params.page !== undefined) queryParams.set('page', String(params.page))
if (params.pageSize) queryParams.set('page_size', String(params.pageSize))
const queryString = queryParams.toString()
const url = `https://api.${site}/api/v1/monitor${queryString ? `?${queryString}` : ''}`
logger.info(
'[Datadog List Monitors] URL:',
url,
'Site param:',
params.site,
'API Key present:',
!!params.apiKey,
'App Key present:',
!!params.applicationKey
)
return url
},
method: 'GET',
headers: (params) => ({
'Content-Type': 'application/json',
'DD-API-KEY': params.apiKey,
'DD-APPLICATION-KEY': params.applicationKey,
}),
},
transformResponse: async (response: Response) => {
if (!response.ok) {
const errorData = await response.json().catch(() => ({}))
return {
success: false,
output: {
monitors: [],
},
error: errorData.errors?.[0] || `HTTP ${response.status}: ${response.statusText}`,
}
}
const text = await response.text()
let data: any
try {
data = JSON.parse(text)
} catch (e) {
return {
success: false,
output: { monitors: [] },
error: `Failed to parse response: ${text.substring(0, 200)}`,
}
}
if (!Array.isArray(data)) {
return {
success: false,
output: { monitors: [] },
error: `Expected array but got: ${typeof data} - ${JSON.stringify(data).substring(0, 200)}`,
}
}
const monitors = data.map((m: any) => ({
id: m.id,
name: m.name,
type: m.type,
query: m.query,
message: m.message,
tags: m.tags,
priority: m.priority,
options: m.options,
overall_state: m.overall_state,
created: m.created,
modified: m.modified,
creator: m.creator,
}))
return {
success: true,
output: {
monitors,
},
}
},
outputs: {
monitors: {
type: 'array',
description: 'List of monitors',
items: {
type: 'object',
properties: {
id: { type: 'number', description: 'Monitor ID' },
name: { type: 'string', description: 'Monitor name' },
type: { type: 'string', description: 'Monitor type' },
query: { type: 'string', description: 'Monitor query' },
overall_state: { type: 'string', description: 'Current state' },
tags: { type: 'array', description: 'Tags' },
},
},
},
},
}
+96
View File
@@ -0,0 +1,96 @@
import type { MuteMonitorParams, MuteMonitorResponse } from '@/tools/datadog/types'
import type { ToolConfig } from '@/tools/types'
export const muteMonitorTool: ToolConfig<MuteMonitorParams, MuteMonitorResponse> = {
id: 'datadog_mute_monitor',
name: 'Datadog Mute Monitor',
description: 'Mute a monitor to temporarily suppress notifications.',
version: '1.0.0',
params: {
monitorId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'The ID of the monitor to mute (e.g., "12345678")',
},
scope: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Scope to mute (e.g., "host:myhost", "env:prod"). If not specified, mutes all scopes.',
},
end: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description:
'Unix timestamp in seconds when the mute should end (e.g., 1705323600). If not specified, mutes indefinitely.',
},
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Datadog API key',
},
applicationKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Datadog Application key',
},
site: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Datadog site/region (default: datadoghq.com)',
},
},
request: {
url: (params) => {
const site = params.site || 'datadoghq.com'
return `https://api.${site}/api/v1/monitor/${params.monitorId}/mute`
},
method: 'POST',
headers: (params) => ({
'Content-Type': 'application/json',
'DD-API-KEY': params.apiKey,
'DD-APPLICATION-KEY': params.applicationKey,
}),
body: (params) => {
const body: Record<string, any> = {}
if (params.scope) body.scope = params.scope
if (params.end) body.end = params.end
return body
},
},
transformResponse: async (response: Response) => {
if (!response.ok) {
const errorData = await response.json().catch(() => ({}))
return {
success: false,
output: {
success: false,
},
error: errorData.errors?.[0] || `HTTP ${response.status}: ${response.statusText}`,
}
}
return {
success: true,
output: {
success: true,
},
}
},
outputs: {
success: {
type: 'boolean',
description: 'Whether the monitor was successfully muted',
},
},
}
+172
View File
@@ -0,0 +1,172 @@
import type { QueryLogsParams, QueryLogsResponse } from '@/tools/datadog/types'
import type { ToolConfig } from '@/tools/types'
export const queryLogsTool: ToolConfig<QueryLogsParams, QueryLogsResponse> = {
id: 'datadog_query_logs',
name: 'Datadog Query Logs',
description:
'Search and retrieve logs from Datadog. Use for troubleshooting, analysis, or monitoring.',
version: '1.0.0',
params: {
query: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description:
'Log search query using Datadog query syntax (e.g., "service:web-app status:error", "host:prod-* @http.status_code:500")',
},
from: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description:
'Start time in ISO-8601 format or relative time (e.g., "now-1h", "now-15m", "2024-01-15T10:00:00Z")',
},
to: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description:
'End time in ISO-8601 format or relative time (e.g., "now", "now-5m", "2024-01-15T12:00:00Z")',
},
limit: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Maximum number of logs to return (e.g., 50, 100, max: 1000)',
},
sort: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Sort order: "timestamp" for oldest first, "-timestamp" for newest first',
},
indexes: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Comma-separated list of log indexes to search',
},
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Datadog API key',
},
applicationKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Datadog Application key',
},
site: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Datadog site/region (default: datadoghq.com)',
},
},
request: {
url: (params) => {
const site = params.site || 'datadoghq.com'
return `https://api.${site}/api/v2/logs/events/search`
},
method: 'POST',
headers: (params) => ({
'Content-Type': 'application/json',
'DD-API-KEY': params.apiKey,
'DD-APPLICATION-KEY': params.applicationKey,
}),
body: (params) => {
const body: Record<string, any> = {
filter: {
query: params.query,
from: params.from,
to: params.to,
},
page: {
limit: params.limit || 50,
},
}
if (params.sort) {
body.sort = params.sort
}
if (params.indexes) {
body.filter.indexes = params.indexes
.split(',')
.map((i: string) => i.trim())
.filter((i: string) => i.length > 0)
}
return body
},
},
transformResponse: async (response: Response) => {
if (!response.ok) {
const errorData = await response.json().catch(() => ({}))
return {
success: false,
output: {
logs: [],
},
error: errorData.errors?.[0]?.detail || `HTTP ${response.status}: ${response.statusText}`,
}
}
const data = await response.json()
const logs = (data.data || []).map((log: any) => ({
id: log.id,
content: {
timestamp: log.attributes?.timestamp,
host: log.attributes?.host,
service: log.attributes?.service,
message: log.attributes?.message,
status: log.attributes?.status,
attributes: log.attributes?.attributes,
tags: log.attributes?.tags,
},
}))
return {
success: true,
output: {
logs,
nextLogId: data.meta?.page?.after,
},
}
},
outputs: {
logs: {
type: 'array',
description: 'List of log entries',
items: {
type: 'object',
properties: {
id: { type: 'string', description: 'Log ID' },
content: {
type: 'object',
description: 'Log content',
properties: {
timestamp: { type: 'string', description: 'Log timestamp' },
host: { type: 'string', description: 'Host name' },
service: { type: 'string', description: 'Service name' },
message: { type: 'string', description: 'Log message' },
status: { type: 'string', description: 'Log status/level' },
},
},
},
},
},
nextLogId: {
type: 'string',
description: 'Cursor for pagination',
optional: true,
},
},
}
+111
View File
@@ -0,0 +1,111 @@
import type { QueryTimeseriesParams, QueryTimeseriesResponse } from '@/tools/datadog/types'
import type { ToolConfig } from '@/tools/types'
export const queryTimeseriesTool: ToolConfig<QueryTimeseriesParams, QueryTimeseriesResponse> = {
id: 'datadog_query_timeseries',
name: 'Datadog Query Timeseries',
description:
'Query metric timeseries data from Datadog. Use for analyzing trends, creating reports, or retrieving metric values.',
version: '1.0.0',
params: {
query: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description:
'Datadog metrics query (e.g., "avg:system.cpu.user{*}", "sum:nginx.requests{env:prod}.as_count()")',
},
from: {
type: 'number',
required: true,
visibility: 'user-or-llm',
description: 'Start time as Unix timestamp in seconds (e.g., 1705320000)',
},
to: {
type: 'number',
required: true,
visibility: 'user-or-llm',
description: 'End time as Unix timestamp in seconds (e.g., 1705323600)',
},
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Datadog API key',
},
applicationKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Datadog Application key',
},
site: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Datadog site/region (default: datadoghq.com)',
},
},
request: {
url: (params) => {
const site = params.site || 'datadoghq.com'
const queryParams = new URLSearchParams({
query: params.query,
from: String(params.from),
to: String(params.to),
})
return `https://api.${site}/api/v1/query?${queryParams.toString()}`
},
method: 'GET',
headers: (params) => ({
'Content-Type': 'application/json',
'DD-API-KEY': params.apiKey,
'DD-APPLICATION-KEY': params.applicationKey,
}),
},
transformResponse: async (response: Response) => {
if (!response.ok) {
const errorData = await response.json().catch(() => ({}))
return {
success: false,
output: {
series: [],
status: 'error',
},
error: errorData.errors?.[0] || `HTTP ${response.status}: ${response.statusText}`,
}
}
const data = await response.json()
const series = (data.series || []).map((s: any) => ({
metric: s.metric || s.expression,
tags: s.tag_set || [],
points: (s.pointlist || []).map((p: [number, number]) => ({
timestamp: p[0] / 1000, // Convert from milliseconds to seconds
value: p[1],
})),
}))
return {
success: true,
output: {
series,
status: data.status || 'ok',
},
}
},
outputs: {
series: {
type: 'array',
description: 'Array of timeseries data with metric name, tags, and data points',
},
status: {
type: 'string',
description: 'Query status',
},
},
}
+94
View File
@@ -0,0 +1,94 @@
import type { SendLogsParams, SendLogsResponse } from '@/tools/datadog/types'
import type { ToolConfig } from '@/tools/types'
export const sendLogsTool: ToolConfig<SendLogsParams, SendLogsResponse> = {
id: 'datadog_send_logs',
name: 'Datadog Send Logs',
description: 'Send log entries to Datadog for centralized logging and analysis.',
version: '1.0.0',
params: {
logs: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description:
'JSON array of log entries. Each entry should have message and optionally ddsource, ddtags, hostname, service.',
},
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Datadog API key',
},
site: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Datadog site/region (default: datadoghq.com)',
},
},
request: {
url: (params) => {
const site = params.site || 'datadoghq.com'
// Logs API uses a different subdomain
const logsHost =
site === 'datadoghq.com'
? 'http-intake.logs.datadoghq.com'
: site === 'datadoghq.eu'
? 'http-intake.logs.datadoghq.eu'
: `http-intake.logs.${site}`
return `https://${logsHost}/api/v2/logs`
},
method: 'POST',
headers: (params) => ({
'Content-Type': 'application/json',
'DD-API-KEY': params.apiKey,
}),
body: (params) => {
let logs: any[]
try {
logs = typeof params.logs === 'string' ? JSON.parse(params.logs) : params.logs
} catch {
throw new Error('Invalid JSON in logs parameter')
}
// Ensure each log entry has the required format
return logs.map((log: any) => ({
ddsource: log.ddsource || 'custom',
ddtags: log.ddtags || '',
hostname: log.hostname || '',
message: log.message,
service: log.service || '',
}))
},
},
transformResponse: async (response: Response) => {
if (!response.ok) {
const errorData = await response.json().catch(() => ({}))
return {
success: false,
output: {
success: false,
},
error: errorData.errors?.[0] || `HTTP ${response.status}: ${response.statusText}`,
}
}
return {
success: true,
output: {
success: true,
},
}
},
outputs: {
success: {
type: 'boolean',
description: 'Whether the logs were sent successfully',
},
},
}
+101
View File
@@ -0,0 +1,101 @@
import type { SubmitMetricsParams, SubmitMetricsResponse } from '@/tools/datadog/types'
import type { ToolConfig } from '@/tools/types'
export const submitMetricsTool: ToolConfig<SubmitMetricsParams, SubmitMetricsResponse> = {
id: 'datadog_submit_metrics',
name: 'Datadog Submit Metrics',
description:
'Submit custom metrics to Datadog. Use for tracking application performance, business metrics, or custom monitoring data.',
version: '1.0.0',
params: {
series: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description:
'JSON array of metric series to submit. Each series should include metric name, type (gauge/rate/count), points (timestamp/value pairs), and optional tags.',
},
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Datadog API key',
},
site: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Datadog site/region (default: datadoghq.com)',
},
},
request: {
url: (params) => {
const site = params.site || 'datadoghq.com'
return `https://api.${site}/api/v2/series`
},
method: 'POST',
headers: (params) => ({
'Content-Type': 'application/json',
'DD-API-KEY': params.apiKey,
}),
body: (params) => {
let series: any[]
try {
series = typeof params.series === 'string' ? JSON.parse(params.series) : params.series
} catch {
throw new Error('Invalid JSON in series parameter')
}
// Transform to Datadog API v2 format
const formattedSeries = series.map((s: any) => ({
metric: s.metric,
type: s.type === 'gauge' ? 0 : s.type === 'rate' ? 1 : s.type === 'count' ? 2 : 3,
points: s.points.map((p: any) => ({
timestamp: p.timestamp,
value: p.value,
})),
tags: s.tags || [],
unit: s.unit,
resources: s.resources || [{ name: 'host', type: 'host' }],
}))
return { series: formattedSeries }
},
},
transformResponse: async (response: Response) => {
if (!response.ok) {
const errorData = await response.json().catch(() => ({}))
return {
success: false,
output: {
success: false,
errors: [errorData.errors?.[0] || `HTTP ${response.status}: ${response.statusText}`],
},
error: errorData.errors?.[0] || `HTTP ${response.status}: ${response.statusText}`,
}
}
const data = await response.json().catch(() => ({}))
return {
success: true,
output: {
success: true,
errors: data.errors || [],
},
}
},
outputs: {
success: {
type: 'boolean',
description: 'Whether the metrics were submitted successfully',
},
errors: {
type: 'array',
description: 'Any errors that occurred during submission',
},
},
}
+782
View File
@@ -0,0 +1,782 @@
// Common types for Datadog tools
import type { ToolResponse } from '@/tools/types'
// Datadog Site/Region options
export type DatadogSite =
| 'datadoghq.com'
| 'us3.datadoghq.com'
| 'us5.datadoghq.com'
| 'datadoghq.eu'
| 'ap1.datadoghq.com'
| 'ddog-gov.com'
// Base parameters for write-only operations (only need API key)
interface DatadogWriteOnlyParams {
apiKey: string
site?: DatadogSite
}
// Base parameters for read/manage operations (need both API key and Application key)
interface DatadogBaseParams extends DatadogWriteOnlyParams {
applicationKey: string
}
// ========================
// METRICS TYPES
// ========================
export type MetricType = 'gauge' | 'rate' | 'count' | 'distribution'
interface MetricPoint {
timestamp: number
value: number
}
interface MetricSeries {
metric: string
type?: MetricType
points: MetricPoint[]
tags?: string[]
unit?: string
resources?: { name: string; type: string }[]
}
export interface SubmitMetricsParams extends DatadogWriteOnlyParams {
series: string // JSON string of MetricSeries[]
}
interface SubmitMetricsOutput {
success: boolean
errors?: string[]
}
export interface SubmitMetricsResponse extends ToolResponse {
output: SubmitMetricsOutput
}
export interface QueryTimeseriesParams extends DatadogBaseParams {
query: string
from: number // Unix timestamp in seconds
to: number // Unix timestamp in seconds
}
interface TimeseriesPoint {
timestamp: number
value: number
}
interface TimeseriesResult {
metric: string
tags: string[]
points: TimeseriesPoint[]
}
interface QueryTimeseriesOutput {
series: TimeseriesResult[]
status: string
}
export interface QueryTimeseriesResponse extends ToolResponse {
output: QueryTimeseriesOutput
}
interface ListMetricsParams extends DatadogBaseParams {
from?: number // Unix timestamp - only return metrics active since this time
host?: string // Filter by host name
tags?: string // Filter by tags (comma-separated)
}
interface ListMetricsOutput {
metrics: string[]
}
interface ListMetricsResponse extends ToolResponse {
output: ListMetricsOutput
}
interface GetMetricMetadataParams extends DatadogBaseParams {
metricName: string
}
interface MetricMetadata {
description?: string
short_name?: string
unit?: string
per_unit?: string
type?: string
integration?: string
}
interface GetMetricMetadataOutput {
metadata: MetricMetadata
}
interface GetMetricMetadataResponse extends ToolResponse {
output: GetMetricMetadataOutput
}
// ========================
// EVENTS TYPES
// ========================
export type EventAlertType =
| 'error'
| 'warning'
| 'info'
| 'success'
| 'user_update'
| 'recommendation'
| 'snapshot'
export type EventPriority = 'normal' | 'low'
export interface CreateEventParams extends DatadogWriteOnlyParams {
title: string
text: string
alertType?: EventAlertType
priority?: EventPriority
host?: string
tags?: string // Comma-separated tags
aggregationKey?: string
sourceTypeName?: string
dateHappened?: number // Unix timestamp
}
interface EventData {
id: number
title: string
text: string
date_happened: number
priority: string
alert_type: string
host?: string
tags?: string[]
url?: string
}
interface CreateEventOutput {
event: EventData
}
export interface CreateEventResponse extends ToolResponse {
output: CreateEventOutput
}
interface GetEventParams extends DatadogBaseParams {
eventId: string
}
interface GetEventOutput {
event: EventData
}
interface GetEventResponse extends ToolResponse {
output: GetEventOutput
}
interface QueryEventsParams extends DatadogBaseParams {
start: number // Unix timestamp
end: number // Unix timestamp
priority?: EventPriority
sources?: string // Comma-separated source names
tags?: string // Comma-separated tags
unaggregated?: boolean
excludeAggregate?: boolean
page?: number
}
interface QueryEventsOutput {
events: EventData[]
}
interface QueryEventsResponse extends ToolResponse {
output: QueryEventsOutput
}
// ========================
// MONITORS TYPES
// ========================
export type MonitorType =
| 'metric alert'
| 'service check'
| 'event alert'
| 'process alert'
| 'log alert'
| 'query alert'
| 'composite'
| 'synthetics alert'
| 'trace-analytics alert'
| 'slo alert'
interface MonitorThresholds {
critical?: number
critical_recovery?: number
warning?: number
warning_recovery?: number
ok?: number
}
interface MonitorOptions {
notify_no_data?: boolean
no_data_timeframe?: number
notify_audit?: boolean
renotify_interval?: number
escalation_message?: string
thresholds?: MonitorThresholds
include_tags?: boolean
require_full_window?: boolean
timeout_h?: number
evaluation_delay?: number
new_group_delay?: number
min_location_failed?: number
}
export interface CreateMonitorParams extends DatadogBaseParams {
name: string
type: MonitorType
query: string
message?: string
tags?: string // Comma-separated tags
priority?: number // 1-5
options?: string // JSON string of MonitorOptions
}
interface MonitorData {
id: number
name: string
type: string
query: string
message?: string
tags?: string[]
priority?: number
options?: MonitorOptions
overall_state?: string
created?: string
modified?: string
creator?: { email: string; handle: string; name: string }
}
interface CreateMonitorOutput {
monitor: MonitorData
}
export interface CreateMonitorResponse extends ToolResponse {
output: CreateMonitorOutput
}
export interface GetMonitorParams extends DatadogBaseParams {
monitorId: string
groupStates?: string // Comma-separated states: alert, warn, no data
withDowntimes?: boolean
}
interface GetMonitorOutput {
monitor: MonitorData
}
export interface GetMonitorResponse extends ToolResponse {
output: GetMonitorOutput
}
interface UpdateMonitorParams extends DatadogBaseParams {
monitorId: string
name?: string
query?: string
message?: string
tags?: string // Comma-separated tags
priority?: number
options?: string // JSON string of MonitorOptions
}
interface UpdateMonitorOutput {
monitor: MonitorData
}
interface UpdateMonitorResponse extends ToolResponse {
output: UpdateMonitorOutput
}
interface DeleteMonitorParams extends DatadogBaseParams {
monitorId: string
force?: boolean
}
interface DeleteMonitorOutput {
deleted_monitor_id: number
}
interface DeleteMonitorResponse extends ToolResponse {
output: DeleteMonitorOutput
}
export interface ListMonitorsParams extends DatadogBaseParams {
groupStates?: string // Comma-separated states
name?: string // Filter by name
tags?: string // Filter by tags (comma-separated)
monitorTags?: string // Filter by monitor tags
withDowntimes?: boolean
idOffset?: number
page?: number
pageSize?: number
}
interface ListMonitorsOutput {
monitors: MonitorData[]
}
export interface ListMonitorsResponse extends ToolResponse {
output: ListMonitorsOutput
}
export interface MuteMonitorParams extends DatadogBaseParams {
monitorId: string
scope?: string // Scope to mute (e.g., "host:myhost")
end?: number // Unix timestamp when mute ends
}
interface MuteMonitorOutput {
success: boolean
}
export interface MuteMonitorResponse extends ToolResponse {
output: MuteMonitorOutput
}
interface UnmuteMonitorParams extends DatadogBaseParams {
monitorId: string
scope?: string
allScopes?: boolean
}
interface UnmuteMonitorOutput {
success: boolean
}
interface UnmuteMonitorResponse extends ToolResponse {
output: UnmuteMonitorOutput
}
// ========================
// LOGS TYPES
// ========================
interface LogEntry {
ddsource?: string
ddtags?: string
hostname?: string
message: string
service?: string
}
export interface SendLogsParams extends DatadogWriteOnlyParams {
logs: string // JSON string of LogEntry[]
}
interface SendLogsOutput {
success: boolean
}
export interface SendLogsResponse extends ToolResponse {
output: SendLogsOutput
}
export interface QueryLogsParams extends DatadogBaseParams {
query: string
from: string // ISO-8601 or relative (now-1h)
to: string // ISO-8601 or relative (now)
limit?: number
sort?: 'timestamp' | '-timestamp'
indexes?: string // Comma-separated index names
}
interface LogData {
id: string
content: {
timestamp: string
host?: string
service?: string
message: string
status?: string
attributes?: Record<string, any>
tags?: string[]
}
}
interface QueryLogsOutput {
logs: LogData[]
nextLogId?: string
}
export interface QueryLogsResponse extends ToolResponse {
output: QueryLogsOutput
}
// ========================
// DOWNTIME TYPES
// ========================
export interface CreateDowntimeParams extends DatadogBaseParams {
scope: string // Scope to apply downtime (e.g., "host:myhost" or "*")
message?: string
start?: number // Unix timestamp, defaults to now
end?: number // Unix timestamp
timezone?: string
monitorId?: string // Monitor ID to mute
monitorTags?: string // Comma-separated tags to match monitors
muteFirstRecoveryNotification?: boolean
notifyEndTypes?: string // Comma-separated: "canceled", "expired"
recurrence?: string // JSON string of recurrence config
}
interface DowntimeData {
id: number
scope: string[]
message?: string
start?: number
end?: number
timezone?: string
monitor_id?: number
monitor_tags?: string[]
mute_first_recovery_notification?: boolean
disabled?: boolean
created?: number
modified?: number
creator_id?: number
canceled?: number
active?: boolean
}
interface CreateDowntimeOutput {
downtime: DowntimeData
}
export interface CreateDowntimeResponse extends ToolResponse {
output: CreateDowntimeOutput
}
export interface ListDowntimesParams extends DatadogBaseParams {
currentOnly?: boolean
withCreator?: boolean
monitorId?: string
}
interface ListDowntimesOutput {
downtimes: DowntimeData[]
}
export interface ListDowntimesResponse extends ToolResponse {
output: ListDowntimesOutput
}
export interface CancelDowntimeParams extends DatadogBaseParams {
downtimeId: string
}
interface CancelDowntimeOutput {
success: boolean
}
export interface CancelDowntimeResponse extends ToolResponse {
output: CancelDowntimeOutput
}
// ========================
// SLO TYPES
// ========================
export type SloType = 'metric' | 'monitor' | 'time_slice'
interface SloThreshold {
timeframe: '7d' | '30d' | '90d' | 'custom'
target: number // Target percentage (e.g., 99.9)
target_display?: string
warning?: number
warning_display?: string
}
interface CreateSloParams extends DatadogBaseParams {
name: string
type: SloType
description?: string
tags?: string // Comma-separated tags
thresholds: string // JSON string of SloThreshold[]
// For metric-based SLO
query?: string // JSON string of { numerator: string, denominator: string }
// For monitor-based SLO
monitorIds?: string // Comma-separated monitor IDs
groups?: string // Comma-separated group names
}
interface SloData {
id: string
name: string
type: string
description?: string
tags?: string[]
thresholds: SloThreshold[]
creator?: { email: string; handle: string; name: string }
created_at?: number
modified_at?: number
}
interface CreateSloOutput {
slo: SloData
}
interface CreateSloResponse extends ToolResponse {
output: CreateSloOutput
}
interface GetSloHistoryParams extends DatadogBaseParams {
sloId: string
fromTs: number // Unix timestamp
toTs: number // Unix timestamp
target?: number // Target SLO percentage
}
interface SloHistoryData {
from_ts: number
to_ts: number
type: string
type_id: number
sli_value?: number
overall: {
name: string
sli_value: number
span_precision: number
precision: { [key: string]: number }
}
series?: {
times: number[]
values: number[]
}
}
interface GetSloHistoryOutput {
history: SloHistoryData
}
interface GetSloHistoryResponse extends ToolResponse {
output: GetSloHistoryOutput
}
// ========================
// DASHBOARD TYPES
// ========================
export type DashboardLayoutType = 'ordered' | 'free'
interface CreateDashboardParams extends DatadogBaseParams {
title: string
layoutType: DashboardLayoutType
description?: string
widgets?: string // JSON string of widget definitions
isReadOnly?: boolean
notifyList?: string // Comma-separated user handles to notify
templateVariables?: string // JSON string of template variable definitions
tags?: string // Comma-separated tags
}
interface DashboardData {
id: string
title: string
layout_type: string
description?: string
url?: string
author_handle?: string
created_at?: string
modified_at?: string
is_read_only?: boolean
tags?: string[]
}
interface CreateDashboardOutput {
dashboard: DashboardData
}
interface CreateDashboardResponse extends ToolResponse {
output: CreateDashboardOutput
}
interface GetDashboardParams extends DatadogBaseParams {
dashboardId: string
}
interface GetDashboardOutput {
dashboard: DashboardData
}
interface GetDashboardResponse extends ToolResponse {
output: GetDashboardOutput
}
interface ListDashboardsParams extends DatadogBaseParams {
filterShared?: boolean
filterDeleted?: boolean
count?: number
start?: number
}
interface DashboardSummary {
id: string
title: string
description?: string
layout_type: string
url?: string
author_handle?: string
created_at?: string
modified_at?: string
is_read_only?: boolean
popularity?: number
}
interface ListDashboardsOutput {
dashboards: DashboardSummary[]
total?: number
}
interface ListDashboardsResponse extends ToolResponse {
output: ListDashboardsOutput
}
// ========================
// HOSTS TYPES
// ========================
interface ListHostsParams extends DatadogBaseParams {
filter?: string // Filter hosts by name, alias, or tag
sortField?: string // Field to sort by
sortDir?: 'asc' | 'desc'
start?: number // Starting offset
count?: number // Max hosts to return
from?: number // Unix timestamp - hosts seen in last N seconds
includeMutedHostsData?: boolean
includeHostsMetadata?: boolean
}
interface HostData {
name: string
id: number
aliases?: string[]
apps?: string[]
aws_name?: string
host_name?: string
is_muted?: boolean
last_reported_time?: number
meta?: {
agent_version?: string
cpu_cores?: number
gohai?: string
machine?: string
platform?: string
}
metrics?: {
cpu?: number
iowait?: number
load?: number
}
mute_timeout?: number
sources?: string[]
tags_by_source?: Record<string, string[]>
up?: boolean
}
interface ListHostsOutput {
hosts: HostData[]
total_matching?: number
total_returned?: number
}
interface ListHostsResponse extends ToolResponse {
output: ListHostsOutput
}
// ========================
// INCIDENTS TYPES
// ========================
export type IncidentSeverity = 'SEV-1' | 'SEV-2' | 'SEV-3' | 'SEV-4' | 'SEV-5' | 'UNKNOWN'
export type IncidentState = 'active' | 'stable' | 'resolved'
interface CreateIncidentParams extends DatadogBaseParams {
title: string
customerImpacted: boolean
severity?: IncidentSeverity
fields?: string // JSON string of additional fields
}
interface IncidentData {
id: string
type: string
attributes: {
title: string
customer_impacted: boolean
severity?: IncidentSeverity
state?: IncidentState
created?: string
modified?: string
resolved?: string
detected?: string
customer_impact_scope?: string
customer_impact_start?: string
customer_impact_end?: string
public_id?: number
time_to_detect?: number
time_to_internal_response?: number
time_to_repair?: number
time_to_resolve?: number
}
}
interface CreateIncidentOutput {
incident: IncidentData
}
interface CreateIncidentResponse extends ToolResponse {
output: CreateIncidentOutput
}
interface ListIncidentsParams extends DatadogBaseParams {
query?: string
pageSize?: number
pageOffset?: number
include?: string // Comma-separated: users, attachments
}
interface ListIncidentsOutput {
incidents: IncidentData[]
}
interface ListIncidentsResponse extends ToolResponse {
output: ListIncidentsOutput
}
// Union type for all Datadog responses
export type DatadogResponse =
| SubmitMetricsResponse
| QueryTimeseriesResponse
| ListMetricsResponse
| GetMetricMetadataResponse
| CreateEventResponse
| GetEventResponse
| QueryEventsResponse
| CreateMonitorResponse
| GetMonitorResponse
| UpdateMonitorResponse
| DeleteMonitorResponse
| ListMonitorsResponse
| MuteMonitorResponse
| UnmuteMonitorResponse
| SendLogsResponse
| QueryLogsResponse
| CreateDowntimeResponse
| ListDowntimesResponse
| CancelDowntimeResponse
| CreateSloResponse
| GetSloHistoryResponse
| CreateDashboardResponse
| GetDashboardResponse
| ListDashboardsResponse
| ListHostsResponse
| CreateIncidentResponse
| ListIncidentsResponse