Skip to main content
Glama

get-monitor

Retrieve detailed configuration, status, and information for a specific Datadog monitor using its unique ID to manage monitoring settings.

Instructions

Get detailed information about a specific Datadog monitor by its ID. Use this to retrieve the complete configuration, status, and other details of a single monitor.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
monitorIdYes

Implementation Reference

  • The core handler function that performs the API call to retrieve details of a specific Datadog monitor by its ID using the Datadog API client.
    execute: async (params: GetMonitorParams) => {
      try {
        const { monitorId } = params;
    
        const apiInstance = new v1.MonitorsApi(configuration);
    
        const apiParams: v1.MonitorsApiGetMonitorRequest = {
          monitorId: monitorId
        };
    
        const response = await apiInstance.getMonitor(apiParams);
        return response;
      } catch (error) {
        console.error(`Error fetching monitor ${params.monitorId}:`, error);
        throw error;
      }
    }
  • src/index.ts:105-117 (registration)
    Registers the 'get-monitor' tool with the MCP server, defining its name, description, input schema, and handler that delegates to getMonitor.execute.
    server.tool(
      "get-monitor",
      "Get detailed information about a specific Datadog monitor by its ID. Use this to retrieve the complete configuration, status, and other details of a single monitor.",
      {
        monitorId: z.number()
      },
      async (args) => {
        const result = await getMonitor.execute(args);
        return {
          content: [{ type: "text", text: JSON.stringify(result) }]
        };
      }
    );
  • Zod input schema for the 'get-monitor' tool, validating the monitorId parameter as a number.
    {
      monitorId: z.number()
    },
  • TypeScript type definition for the input parameters of the getMonitor tool.
    type GetMonitorParams = {
      monitorId: number;
    };
  • Initialization function that sets up the Datadog API client configuration with API keys and site variables.
    initialize: () => {
      const configOpts = {
        authMethods: {
          apiKeyAuth: process.env.DD_API_KEY,
          appKeyAuth: process.env.DD_APP_KEY
        }
      };
    
      configuration = client.createConfiguration(configOpts);
    
      if (process.env.DD_METRICS_SITE) {
        configuration.setServerVariables({
          site: process.env.DD_METRICS_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