Skip to main content
Glama

get-monitors

Fetch Datadog monitors with filters for status, tags, or result size to manage monitoring alerts effectively.

Instructions

Fetch monitors from Datadog with optional filtering. Use groupStates to filter by monitor status (e.g., 'alert', 'warn', 'no data'), tags or monitorTags to filter by tag criteria, and limit to control result size.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
groupStatesNo
tagsNo
monitorTagsNo
limitNo

Implementation Reference

  • Executes the tool logic by calling Datadog's MonitorsApi.listMonitors with provided filters (groupStates, tags, monitorTags), applies limit if specified, handles 403 authorization errors specifically, and returns the list of monitors.
    execute: async (params: GetMonitorsParams) => {
      try {
        const { groupStates, tags, monitorTags, limit } = params;
    
        const apiInstance = new v1.MonitorsApi(configuration);
    
        const groupStatesStr = groupStates ? groupStates.join(",") : undefined;
    
        const apiParams: v1.MonitorsApiListMonitorsRequest = {
          groupStates: groupStatesStr,
          tags: tags,
          monitorTags: monitorTags
        };
    
        const response = await apiInstance.listMonitors(apiParams);
    
        if (limit && response.length > limit) {
          return response.slice(0, limit);
        }
    
        return response;
      } catch (error: any) {
        if (error.status === 403) {
          console.error(
            "Authorization failed (403 Forbidden): Check that your API key and Application key are valid and have sufficient permissions to access monitors."
          );
          throw new Error(
            "Datadog API authorization failed. Please verify your API and Application keys have the correct permissions."
          );
        } else {
          console.error("Error fetching monitors:", error);
          throw error;
        }
      }
    }
  • TypeScript type definition for the input parameters of the getMonitors tool.
    type GetMonitorsParams = {
      groupStates?: string[];
      tags?: string;
      monitorTags?: string;
      limit?: number;
    };
  • src/index.ts:88-103 (registration)
    Registers the 'get-monitors' tool with the MCP server, including description, Zod input schema validation, and a thin wrapper handler that invokes the tool's execute method and formats the result as MCP text content.
    server.tool(
      "get-monitors",
      "Fetch monitors from Datadog with optional filtering. Use groupStates to filter by monitor status (e.g., 'alert', 'warn', 'no data'), tags or monitorTags to filter by tag criteria, and limit to control result size.",
      {
        groupStates: z.array(z.string()).optional(),
        tags: z.string().optional(),
        monitorTags: z.string().optional(),
        limit: z.number().default(100)
      },
      async (args) => {
        const result = await getMonitors.execute(args);
        return {
          content: [{ type: "text", text: JSON.stringify(result) }]
        };
      }
    );
  • Initializes the Datadog API client configuration with API keys and optional site variable for metrics endpoint.
    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
        });
      }
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions filtering and result size control, but fails to describe critical behaviors such as pagination, rate limits, authentication requirements, error handling, or the format of returned data. For a read operation with no annotation coverage, this leaves significant gaps in understanding how the tool behaves.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose and efficiently uses two sentences to cover key parameters without redundancy. Every sentence adds value, but it could be slightly more structured by separating purpose from parameter details for better readability.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is incomplete for a tool with 4 parameters and complex filtering options. It covers parameter semantics adequately but lacks details on behavioral aspects like response format, error cases, or system constraints. For a read operation in a context with sibling tools, more guidance on usage and output expectations would improve completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description compensates well by explaining the semantics of all four parameters: 'groupStates' filters by status, 'tags' or 'monitorTags' filter by tag criteria, and 'limit' controls result size. It adds meaningful context beyond the bare schema, though it could clarify differences between 'tags' and 'monitorTags' or provide examples for tag formats.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('fetch monitors') and resource ('from Datadog'), making the purpose evident. However, it doesn't explicitly differentiate this tool from its sibling 'get-monitor' (singular), which might retrieve a specific monitor rather than a filtered list, leaving some ambiguity in sibling distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage through examples of filtering parameters (e.g., 'groupStates to filter by monitor status'), suggesting when to use these options, but it doesn't provide explicit guidance on when to choose this tool over alternatives like 'get-monitor' or other sibling tools, nor does it mention any prerequisites or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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