Skip to main content
Glama

get-dashboards

Retrieve all dashboards from Datadog to discover available dashboards and their IDs for further exploration and management.

Instructions

Retrieve a list of all dashboards from Datadog. Useful for discovering available dashboards and their IDs for further exploration.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filterConfiguredNo
limitNo

Implementation Reference

  • The core execution handler for the 'get-dashboards' tool. It uses the Datadog DashboardsApi to list all dashboards, applies optional client-side limiting, and returns the paginated or filtered results.
    execute: async (params: GetDashboardsParams) => {
      try {
        const { filterConfigured, limit } = params;
    
        const apiInstance = new v1.DashboardsApi(configuration);
    
        // No parameters needed for listDashboards
        const response = await apiInstance.listDashboards();
    
        // Apply client-side filtering if specified
        let filteredDashboards = response.dashboards || [];
    
        // Apply client-side limit if specified
        if (limit && filteredDashboards.length > limit) {
          filteredDashboards = filteredDashboards.slice(0, limit);
        }
    
        return {
          ...response,
          dashboards: filteredDashboards
        };
      } catch (error) {
        console.error("Error fetching dashboards:", error);
        throw error;
      }
    }
  • src/index.ts:119-132 (registration)
    Registers the 'get-dashboards' tool with the MCP server, specifying name, description, input schema, and linking to the handler execution.
    server.tool(
      "get-dashboards",
      "Retrieve a list of all dashboards from Datadog. Useful for discovering available dashboards and their IDs for further exploration.",
      {
        filterConfigured: z.boolean().optional(),
        limit: z.number().default(100)
      },
      async (args) => {
        const result = await getDashboards.execute(args);
        return {
          content: [{ type: "text", text: JSON.stringify(result) }]
        };
      }
    );
  • Zod input schema defining optional parameters: filterConfigured (boolean) and limit (number, default 100) for validating tool inputs.
    {
      filterConfigured: z.boolean().optional(),
      limit: z.number().default(100)
    },
  • Helper function to initialize the Datadog API client configuration using environment variables for 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_SITE) {
        configuration.setServerVariables({
          site: process.env.DD_SITE
        });
      }
    },
  • TypeScript type definition matching the input schema for getDashboards parameters.
    type GetDashboardsParams = {
      filterConfigured?: boolean;
      limit?: number;
    };

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