Skip to main content
Glama

get-events

Search and retrieve Datadog events within a defined time range to analyze deployments, alerts, and system activities. Helps correlate events with system behaviors for monitoring insights.

Instructions

Search for events in Datadog within a specified time range. Events include deployments, alerts, comments, and other activities. Useful for correlating system behaviors with specific events.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
endYes
excludeAggregationNo
limitNo
priorityNo
sourcesNo
startYes
tagsNo
unaggregatedNo

Implementation Reference

  • The execute function that implements the core logic for fetching events from Datadog API using the EventsApi.listEvents method, destructuring input params, making the API call, applying optional limit, and handling errors.
    execute: async (params: GetEventsParams) => { try { const { start, end, priority, sources, tags, unaggregated, excludeAggregation, limit } = params; const apiInstance = new v1.EventsApi(configuration); const apiParams: v1.EventsApiListEventsRequest = { start: start, end: end, priority: priority, sources: sources, tags: tags, unaggregated: unaggregated, excludeAggregate: excludeAggregation }; const response = await apiInstance.listEvents(apiParams); // Apply client-side limit if specified if (limit && response.events && response.events.length > limit) { response.events = response.events.slice(0, limit); } return response; } catch (error) { console.error("Error fetching events:", error); throw error; } }
  • src/index.ts:176-195 (registration)
    Registers the 'get-events' tool with MCP server, providing description, Zod input schema validation, and handler that calls getEvents.execute and formats response.
    server.tool( "get-events", "Search for events in Datadog within a specified time range. Events include deployments, alerts, comments, and other activities. Useful for correlating system behaviors with specific events.", { start: z.number(), end: z.number(), priority: z.enum(["normal", "low"]).optional(), sources: z.string().optional(), tags: z.string().optional(), unaggregated: z.boolean().optional(), excludeAggregation: z.boolean().optional(), limit: z.number().default(100) }, async (args) => { const result = await getEvents.execute(args); return { content: [{ type: "text", text: JSON.stringify(result) }] }; } );
  • TypeScript type definition for the input parameters of the get-events tool, matching the Zod schema used in registration.
    type GetEventsParams = { start: number; end: number; priority?: "normal" | "low"; sources?: string; tags?: string; unaggregated?: boolean; excludeAggregation?: boolean; limit?: number; };
  • Initialization function that sets up the Datadog client configuration with API keys and site variable for use in the execute handler.
    initialize: () => { const configOpts = { authMethods: { apiKeyAuth: process.env.DD_API_KEY, appKeyAuth: process.env.DD_APP_KEY } }; configuration = client.createConfiguration(configOpts); if (process.env.DD_SITE) { configuration.setServerVariables({ site: process.env.DD_SITE }); } },

Other Tools

Related Tools

Latest Blog Posts

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/GeLi2001/datadog-mcp-server'

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