get-dashboards
Retrieve a list of all dashboards from Datadog to discover available dashboards and their IDs, enabling further exploration and monitoring.
Instructions
Retrieve a list of all dashboards from Datadog. Useful for discovering available dashboards and their IDs for further exploration.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filterConfigured | No | ||
| limit | No |
Implementation Reference
- src/tools/getDashboards.ts:28-53 (handler)The main execution logic for the 'get-dashboards' tool: calls Datadog's DashboardsApi.listDashboards(), handles client-side limiting, and returns the dashboards list.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)MCP server registration of the 'get-dashboards' tool, including name, description, Zod input schema, and wrapper handler invoking getDashboards.execute().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) }] }; } );
- src/tools/getDashboards.ts:3-6 (schema)TypeScript type definition for the tool's input parameters (matches the Zod schema in registration).type GetDashboardsParams = { filterConfigured?: boolean; limit?: number; };
- src/tools/getDashboards.ts:11-26 (helper)Initialization function for setting up Datadog API client configuration with auth keys and site variable (called from index.ts).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 }); } },