Skip to main content
Glama

get-events

Search Datadog events like deployments, alerts, and comments within a specified time range to correlate system behaviors with specific activities.

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
startYes
endYes
priorityNo
sourcesNo
tagsNo
unaggregatedNo
excludeAggregationNo
limitNo

Implementation Reference

  • The main handler function that performs the Datadog API call to list events using the provided parameters.
    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; } }
  • Zod input schema defining parameters for the get-events tool: time range (start/end), filters (priority, sources, tags), aggregation options, and limit.
    { 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) },
  • src/index.ts:176-195 (registration)
    Registers the 'get-events' tool with the MCP server, providing name, description, input schema, and execution wrapper.
    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 GetEventsParams matching the tool input schema.
    type GetEventsParams = { start: number; end: number; priority?: "normal" | "low"; sources?: string; tags?: string; unaggregated?: boolean; excludeAggregation?: boolean; limit?: number; };
  • Initialization function sets up Datadog client configuration with API keys and site.
    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 }); } },

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