get-metric-metadata
Retrieve detailed metadata for a specific metric, including its type, description, unit, and attributes, to understand its meaning and proper usage within the Datadog MCP server for monitoring and tracing.
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
| Name | Required | Description | Default |
|---|---|---|---|
| metricName | Yes |
Implementation Reference
- src/tools/getMetricMetadata.ts:27-46 (handler)The main handler function that executes the Datadog API call to retrieve metric 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 input schema and a thin wrapper around 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) }] }; } );
- src/tools/getMetricMetadata.ts:3-5 (schema)TypeScript type definition for the input parameters used by the handler.type GetMetricMetadataParams = { metricName: string; };
- src/tools/getMetricMetadata.ts:10-25 (helper)Initialization function that sets up the Datadog API client configuration with auth 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_METRICS_SITE) { configuration.setServerVariables({ site: process.env.DD_METRICS_SITE }); } },