list_dashboards
Retrieve all dashboards for a specified New Relic account to monitor application performance, track metrics, and analyze system health data.
Instructions
List all dashboards for an account
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| account_id | No |
Input Schema (JSON Schema)
{
"properties": {
"account_id": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Account Id"
}
},
"type": "object"
}
Implementation Reference
- newrelic_mcp/server.py:429-440 (handler)MCP tool handler function decorated with @mcp.tool(). It calls the NewRelicClient.list_dashboards method and returns the JSON-formatted result or error.@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)Core implementation in NewRelicClient class. Executes NerdGraph GraphQL query to fetch 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)