Skip to main content
Glama

get-metrics

Discover and search Datadog metrics to identify relevant data for creating monitors and dashboards.

Instructions

List available metrics from Datadog. Optionally use the q parameter to search for specific metrics matching a pattern. Helpful for discovering metrics to use in monitors or dashboards.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
qNo

Implementation Reference

  • The execute function implements the core logic of the get-metrics tool by querying the Datadog Metrics API to list metrics matching the optional 'q' search parameter.
      execute: async (params: GetMetricsParams) => {
        try {
          const { q } = params;
    
          const apiInstance = new v1.MetricsApi(configuration);
    
          const queryStr = q || "*";
    
          const apiParams: v1.MetricsApiListMetricsRequest = {
            q: queryStr
          };
    
          const response = await apiInstance.listMetrics(apiParams);
          return response;
        } catch (error) {
          console.error("Error fetching metrics:", error);
          throw error;
        }
      }
    };
  • Zod schema defining the input parameters for the get-metrics tool: optional 'q' string for metric query.
      q: z.string().optional()
    },
  • src/index.ts:148-160 (registration)
    Registers the 'get-metrics' tool with the MCP server, providing name, description, input schema, and execution handler.
    server.tool(
      "get-metrics",
      "List available metrics from Datadog. Optionally use the q parameter to search for specific metrics matching a pattern. Helpful for discovering metrics to use in monitors or dashboards.",
      {
        q: z.string().optional()
      },
      async (args) => {
        const result = await getMetrics.execute(args);
        return {
          content: [{ type: "text", text: JSON.stringify(result) }]
        };
      }
    );
  • Initializes the Datadog API client configuration with API keys and metrics site variable for use in the metrics tool.
    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
        });
      }
    },
  • TypeScript type definition for the input parameters of the getMetrics tool.
    type GetMetricsParams = {
      q?: string;
    };
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 describes the tool as a listing/search operation, which implies it's likely read-only and non-destructive, but doesn't explicitly state this. It mentions the 'q parameter' for searching but doesn't detail behavioral aspects like rate limits, authentication needs, pagination, or what the output looks like. For a tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

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

Conciseness5/5

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

The description is appropriately sized and front-loaded, with the first sentence stating the core purpose and the second adding optional functionality and usage context. Every sentence earns its place by providing essential information without redundancy or fluff, making it efficient and easy to parse.

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 the tool's low complexity (1 optional parameter, no nested objects) but lack of annotations and output schema, the description is moderately complete. It covers the purpose and basic parameter use, but misses details on behavioral traits (e.g., safety, output format) that would be crucial for an agent to invoke it correctly. It's adequate for a simple tool but has clear gaps in context.

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

Parameters3/5

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

The input schema has 1 parameter with 0% description coverage, so the schema provides no semantic information. The description adds value by explaining that 'q' is used 'to search for specific metrics matching a pattern,' which clarifies its purpose beyond the schema. However, it doesn't specify the pattern format (e.g., wildcards, regex) or provide examples, leaving some ambiguity. With low schema coverage, the description compensates partially but not fully.

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 tool's purpose with specific verbs ('List available metrics', 'search for specific metrics') and identifies the resource ('from Datadog'). It distinguishes from siblings like 'get-metric-metadata' by focusing on listing/discovering metrics rather than retrieving metadata about a specific metric. However, it doesn't explicitly contrast with all siblings (e.g., 'get-dashboards' or 'get-monitors'), keeping it from a perfect score.

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 provides implied usage context by stating the tool is 'Helpful for discovering metrics to use in monitors or dashboards,' which suggests when to use it (for metric discovery). However, it lacks explicit guidance on when to choose this tool over alternatives like 'get-metric-metadata' or 'search-logs,' and doesn't mention any prerequisites or exclusions. The guidance is present but not comprehensive.

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