Skip to main content
Glama
piekstra

New Relic MCP Server

by piekstra

get_application_metrics

Retrieve available performance metrics for a New Relic application to monitor its health and analyze data trends.

Instructions

Get available metrics for an application

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
app_idYes
namesNo

Implementation Reference

  • MCP tool handler function for get_application_metrics. Handles input parameters, initializes client check, calls the NewRelicClient method, and returns JSON-formatted results or errors.
    @mcp.tool()
    async def get_application_metrics(
        app_id: str, names: Optional[List[str]] = None
    ) -> str:
        """Get available metrics for an application"""
        if not client:
            return json.dumps({"error": "New Relic client not initialized"})
    
        try:
            result = await client.get_application_metrics(app_id, names)
            return json.dumps(result, indent=2)
        except Exception as e:
            return json.dumps({"error": str(e)}, indent=2)
  • Core helper method in NewRelicClient class that constructs the API URL for application metrics and makes the HTTP GET request using _make_request.
    async def get_application_metrics(
        self, app_id: str, names: Optional[List[str]] = None
    ) -> Dict[str, Any]:
        """Get available metrics for an application"""
        url = f"{self.base_url}/applications/{app_id}/metrics.json"
        params = {}
        if names:
            params["name"] = ",".join(names)
        return await self._make_request("GET", url, params=params)

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