get_application_metric_data
Retrieve performance metrics for a specific application from New Relic monitoring data to analyze application behavior and identify issues.
Instructions
Get metric data for an application
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| app_id | Yes | ||
| metric_names | Yes | ||
| from_time | No | ||
| to_time | No |
Implementation Reference
- newrelic_mcp/server.py:344-362 (handler)MCP tool handler that wraps the client method, handles client initialization check, calls the helper, formats response as JSON, and handles exceptions.@mcp.tool() async def get_application_metric_data( app_id: str, metric_names: List[str], from_time: Optional[str] = None, to_time: Optional[str] = None, ) -> str: """Get metric data for an application""" if not client: return json.dumps({"error": "New Relic client not initialized"}) try: result = await client.get_application_metric_data( app_id, metric_names, from_time, to_time ) return json.dumps(result, indent=2) except Exception as e: return json.dumps({"error": str(e)}, indent=2)
- newrelic_mcp/server.py:88-104 (helper)Core helper method in NewRelicClient class that constructs the New Relic API request for application metric data and executes it using _make_request.async def get_application_metric_data( self, app_id: str, metric_names: List[str], from_time: Optional[str] = None, to_time: Optional[str] = None, ) -> Dict[str, Any]: """Get metric data for an application""" url = f"{self.base_url}/applications/{app_id}/metrics/data.json" params = {"names": metric_names} if from_time: params["from"] = from_time if to_time: params["to"] = to_time return await self._make_request("GET", url, params=params)
- newrelic_mcp/server.py:344-344 (registration)The @mcp.tool() decorator registers this function as an MCP tool.@mcp.tool()