get_application_metrics
Retrieve available performance metrics for a specific New Relic application to monitor and analyze application health, performance data, and operational insights.
Instructions
Get available metrics for an application
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| app_id | Yes | ||
| names | No |
Input Schema (JSON Schema)
{
"properties": {
"app_id": {
"title": "App Id",
"type": "string"
},
"names": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"title": "Names"
}
},
"required": [
"app_id"
],
"type": "object"
}
Implementation Reference
- newrelic_mcp/server.py:329-341 (handler)MCP tool handler function that calls the NewRelicClient to retrieve available metrics for a specific application and returns JSON-formatted result.@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)
- newrelic_mcp/server.py:78-86 (helper)NewRelicClient helper method that performs the HTTP GET request to New Relic API to fetch metrics data for the given application ID.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)