get_alert_policy
Retrieve alert policy details from New Relic to monitor application performance and configure notification rules for system events.
Instructions
Get details for a specific alert policy
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| policy_id | Yes |
Input Schema (JSON Schema)
{
"properties": {
"policy_id": {
"title": "Policy Id",
"type": "string"
}
},
"required": [
"policy_id"
],
"type": "object"
}
Implementation Reference
- newrelic_mcp/server.py:390-400 (handler)MCP tool handler function for get_alert_policy. Takes policy_id as input, calls the NewRelicClient's get_alert_policy method, and returns the result as formatted JSON or an 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)NewRelicClient helper method that performs the actual HTTP GET request to the New Relic API endpoint for retrieving a specific alert policy by ID.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)