Skip to main content
Glama
piekstra

New Relic MCP Server

by piekstra

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
NameRequiredDescriptionDefault
app_idYes
metric_namesYes
from_timeNo
to_timeNo

Implementation Reference

  • 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)
  • 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)
  • The @mcp.tool() decorator registers this 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