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.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get-dashboards"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filterConfigured | No | ||
| limit | No |
Implementation Reference
- src/tools/getDashboards.ts:28-53 (handler)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) }] }; } ); - src/index.ts:122-125 (schema)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) }, - src/tools/getDashboards.ts:11-26 (helper)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 }); } }, - src/tools/getDashboards.ts:3-6 (schema)TypeScript type definition matching the input schema for getDashboards parameters.
type GetDashboardsParams = { filterConfigured?: boolean; limit?: number; };