get_alert_policy
Retrieve alert policy details from New Relic to monitor application performance and configure notification rules.
Instructions
Get details for a specific alert policy
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| policy_id | Yes |
Implementation Reference
- newrelic_mcp/server.py:390-400 (handler)The MCP tool handler function for 'get_alert_policy'. It checks if the client is initialized, calls the client's get_alert_policy method, and returns the JSON-formatted result or error.@mcp.tool() async def get_alert_policy(policy_id: str) -> str: """Get details for a specific alert policy""" if not client: return json.dumps({"error": "New Relic client not initialized"}) try: result = await client.get_alert_policy(policy_id) return json.dumps(result, indent=2) except Exception as e: return json.dumps({"error": str(e)}, indent=2)
- newrelic_mcp/server.py:111-114 (helper)Helper method in the NewRelicClient class that constructs the API URL and makes the GET request to retrieve the specific alert policy details from New Relic API.async def get_alert_policy(self, policy_id: str) -> Dict[str, Any]: """Get details for a specific alert policy""" url = f"{self.base_url}/alerts_policies/{policy_id}.json" return await self._make_request("GET", url)