get-dashboard
Retrieve complete Datadog dashboard definitions including widgets, layout, and configuration details by specifying the dashboard ID.
Instructions
Get the complete definition of a specific Datadog dashboard by its ID. Returns all widgets, layout, and configuration details.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dashboardId | Yes |
Implementation Reference
- src/tools/getDashboard.ts:27-43 (handler)The execute function implementing the core logic to fetch a specific Datadog dashboard by ID using the Datadog API client.execute: async (params: GetDashboardParams) => { try { const { dashboardId } = params; const apiInstance = new v1.DashboardsApi(configuration); const apiParams: v1.DashboardsApiGetDashboardRequest = { dashboardId: dashboardId }; const response = await apiInstance.getDashboard(apiParams); return response; } catch (error) { console.error(`Error fetching dashboard ${params.dashboardId}:`, error); throw error; } }
- src/index.ts:134-146 (registration)Registers the 'get-dashboard' tool with the MCP server, including description, Zod input schema, and wrapper that calls the handler's execute method.server.tool( "get-dashboard", "Get the complete definition of a specific Datadog dashboard by its ID. Returns all widgets, layout, and configuration details.", { dashboardId: z.string() }, async (args) => { const result = await getDashboard.execute(args); return { content: [{ type: "text", text: JSON.stringify(result) }] }; } );
- src/index.ts:137-139 (schema)Zod schema defining the input parameters for the tool: dashboardId as a required string.{ dashboardId: z.string() },
- src/tools/getDashboard.ts:3-5 (schema)TypeScript type definition for the input parameters used in the handler.type GetDashboardParams = { dashboardId: string; };
- src/tools/getDashboard.ts:10-25 (helper)Initialization function that sets up the Datadog API client configuration with API keys 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_SITE) { configuration.setServerVariables({ site: process.env.DD_SITE }); } },