Skip to main content
Glama
piekstra

New Relic MCP Server

by piekstra

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
NameRequiredDescriptionDefault
account_idNo

Implementation Reference

  • 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)
  • 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)
  • The @mcp.tool() decorator registers the list_dashboards function as an MCP tool.
    @mcp.tool()

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/piekstra/newrelic-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server