list_dashboards
Retrieve all dashboards for a New Relic account to monitor application performance and infrastructure metrics.
Instructions
List all dashboards for an account
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| account_id | No |
Implementation Reference
- newrelic_mcp/server.py:429-440 (handler)MCP tool handler for 'list_dashboards'. This is the main entry point decorated with @mcp.tool(), which calls the client method and returns JSON response.@mcp.tool() async def list_dashboards(account_id: Optional[str] = None) -> str: """List all dashboards for an account""" if not client: return json.dumps({"error": "New Relic client not initialized"}) try: result = await client.list_dashboards(account_id) return json.dumps(result, indent=2) except Exception as e: return json.dumps({"error": str(e)}, indent=2)
- newrelic_mcp/server.py:185-212 (helper)NewRelicClient helper method that executes the GraphQL query via nerdgraph_query to retrieve the list of dashboards for the given account.async def list_dashboards(self, account_id: Optional[str] = None) -> Dict[str, Any]: """List all dashboards for an account""" acc_id = account_id or self.account_id if not acc_id: raise Exception("Account ID is required for dashboard operations") query = """ query($accountId: Int!) { actor { account(id: $accountId) { dashboards { results { guid name description createdAt updatedAt permissions } } } } } """ variables = {"accountId": int(acc_id)} return await self.nerdgraph_query(query, variables)
- newrelic_mcp/server.py:429-429 (registration)The @mcp.tool() decorator registers the list_dashboards function as an MCP tool.@mcp.tool()