Skip to main content
Glama

get-metric-metadata

Retrieve detailed metadata for Datadog metrics to understand their meaning, type, unit, and proper usage.

Instructions

Retrieve detailed metadata about a specific metric, including its type, description, unit, and other attributes. Use this to understand a metric's meaning and proper usage.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
metricNameYes

Implementation Reference

  • The execute function implementing the core logic of the 'get-metric-metadata' tool by querying Datadog's Metrics API for the specified metric's metadata.
    execute: async (params: GetMetricMetadataParams) => {
      try {
        const { metricName } = params;
    
        const apiInstance = new v1.MetricsApi(configuration);
    
        const apiParams: v1.MetricsApiGetMetricMetadataRequest = {
          metricName: metricName
        };
    
        const response = await apiInstance.getMetricMetadata(apiParams);
        return response;
      } catch (error) {
        console.error(
          `Error fetching metadata for metric ${params.metricName}:`,
          error
        );
        throw error;
      }
    }
  • src/index.ts:162-174 (registration)
    Registers the 'get-metric-metadata' tool with the MCP server, including description, input schema validation, and delegation to the handler.
    server.tool(
      "get-metric-metadata",
      "Retrieve detailed metadata about a specific metric, including its type, description, unit, and other attributes. Use this to understand a metric's meaning and proper usage.",
      {
        metricName: z.string()
      },
      async (args) => {
        const result = await getMetricMetadata.execute(args);
        return {
          content: [{ type: "text", text: JSON.stringify(result) }]
        };
      }
    );
  • Zod input schema defining the required 'metricName' parameter as a string.
      metricName: z.string()
    },
  • Initialization helper that configures the Datadog API client with authentication and site settings.
    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 for the input parameters used in the handler.
    type GetMetricMetadataParams = {
      metricName: string;
    };

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