Skip to main content
Glama

mcp-server-datadog

Apache 2.0
4,489
103
  • Apple
tool.ts1.9 kB
import { ExtendedTool, ToolHandlers } from '../../utils/types' import { v2 } from '@datadog/datadog-api-client' import { createToolSchema } from '../../utils/tool' import { GetIncidentZodSchema, ListIncidentsZodSchema } from './schema' type IncidentToolName = 'list_incidents' | 'get_incident' type IncidentTool = ExtendedTool<IncidentToolName> export const INCIDENT_TOOLS: IncidentTool[] = [ createToolSchema( ListIncidentsZodSchema, 'list_incidents', 'Get incidents from Datadog', ), createToolSchema( GetIncidentZodSchema, 'get_incident', 'Get an incident from Datadog', ), ] as const type IncidentToolHandlers = ToolHandlers<IncidentToolName> export const createIncidentToolHandlers = ( apiInstance: v2.IncidentsApi, ): IncidentToolHandlers => { return { list_incidents: async (request) => { const { pageSize, pageOffset } = ListIncidentsZodSchema.parse( request.params.arguments, ) const response = await apiInstance.listIncidents({ pageSize, pageOffset, }) if (response.data == null) { throw new Error('No incidents data returned') } return { content: [ { type: 'text', text: `Listed incidents:\n${response.data .map((d) => JSON.stringify(d)) .join('\n')}`, }, ], } }, get_incident: async (request) => { const { incidentId } = GetIncidentZodSchema.parse( request.params.arguments, ) const response = await apiInstance.getIncident({ incidentId, }) if (response.data == null) { throw new Error('No incident data returned') } return { content: [ { type: 'text', text: `Incident: ${JSON.stringify(response.data)}`, }, ], } }, } }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/winor30/mcp-server-datadog'

If you have feedback or need assistance with the MCP directory API, please join our Discord server