/** * Datadog Monitor Tools */ import type { Tool } from '@modelcontextprotocol/sdk/types.js'; export const listMonitorsTool: Tool = { name: 'list_monitors', description: 'Lists monitors from Datadog. Use when the user wants to view all configured alerts, review monitoring coverage, or check monitor status. Returns list of monitors with their current state, type, query, and configuration. Useful for incident response, audit, and monitoring health checks.', inputSchema: { type: 'object', properties: { tags: { type: 'array', items: { type: 'string' }, description: 'Filter monitors by tags', }, name: { type: 'string', description: 'Filter by monitor name (partial match)', }, }, }, _meta: { category: 'monitors', access_level: 'read', complexity: 'low', }, }; export const getMonitorTool: Tool = { name: 'get_monitor', description: 'Retrieves a single monitor by ID from Datadog. Use when the user needs detailed monitor configuration including thresholds, notification settings, query details, and current state. Essential for troubleshooting alerts and reviewing monitor definitions.', inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'Monitor ID', }, }, required: ['id'], }, _meta: { category: 'monitors', access_level: 'read', complexity: 'low', }, }; export const createMonitorTool: Tool = { name: 'create_monitor', description: 'Creates a new monitor in Datadog. Use when the user wants to set up a new alert for metrics, logs, APM traces, or other data sources. Supports threshold-based alerts, anomaly detection, and composite conditions. Returns the newly created monitor configuration.', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Monitor name', }, type: { type: 'string', enum: ['metric alert', 'service check', 'event alert', 'query alert', 'composite', 'log alert'], description: 'Monitor type', }, query: { type: 'string', description: 'Monitor query (e.g., "avg(last_5m):avg:system.cpu.user{*} > 80")', }, message: { type: 'string', description: 'Notification message with @mentions', }, tags: { type: 'array', items: { type: 'string' }, description: 'Monitor tags', }, options: { type: 'object', properties: { thresholds: { type: 'object', properties: { critical: { type: 'number' }, warning: { type: 'number' }, }, }, notify_no_data: { type: 'boolean' }, renotify_interval: { type: 'number' }, }, description: 'Monitor options and thresholds', }, }, required: ['name', 'type', 'query'], }, _meta: { category: 'monitors', access_level: 'write', complexity: 'medium', }, }; export const updateMonitorTool: Tool = { name: 'update_monitor', description: 'Updates an existing monitor in Datadog. Use when the user needs to modify alert thresholds, change notification recipients, update query conditions, or adjust monitor settings. Returns the updated monitor configuration.', inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'Monitor ID to update', }, name: { type: 'string', description: 'Updated monitor name', }, query: { type: 'string', description: 'Updated monitor query', }, message: { type: 'string', description: 'Updated notification message', }, options: { type: 'object', description: 'Updated monitor options', }, }, required: ['id'], }, _meta: { category: 'monitors', access_level: 'write', complexity: 'medium', }, }; export const deleteMonitorTool: Tool = { name: 'delete_monitor', description: 'Deletes a monitor from Datadog. Use when removing obsolete alerts, cleaning up test monitors, or decommissioning services. This action cannot be undone. Returns confirmation of deletion.', inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'Monitor ID to delete', }, }, required: ['id'], }, _meta: { category: 'monitors', access_level: 'delete', complexity: 'low', }, };