Skip to main content
Glama

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
NameRequiredDescriptionDefault
dashboardIdYes

Implementation Reference

  • 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) }]
        };
      }
    );
  • Zod schema defining the input parameters for the tool: dashboardId as a required string.
    {
      dashboardId: z.string()
    },
  • TypeScript type definition for the input parameters used in the handler.
    type GetDashboardParams = {
      dashboardId: string;
    };
  • 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
        });
      }
    },

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