Skip to main content
Glama
cloudbring

New Relic MCP Server

by cloudbring

list_alert_policies

Retrieve all alert policies from your New Relic account to monitor and manage notification rules for application performance.

Instructions

List all alert policies in your New Relic account

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
target_account_idNoOptional New Relic account ID

Implementation Reference

  • The handler function that performs a NerdGraph query to retrieve alert policies for the specified account.
    async listAlertPolicies(input: { target_account_id?: string; }): Promise<Array<Record<string, unknown>>> { const accountId = input.target_account_id; if (!accountId) { throw new Error('Account ID must be provided'); } if (!/^\d+$/.test(accountId)) { throw new Error('Invalid account ID format'); } const query = `{ actor { account(id: ${accountId}) { alerts { policiesSearch { policies { id name incidentPreference conditions { id name enabled } } } } } } }`; const response = await this.client.executeNerdGraphQuery<{ actor?: { account?: { alerts?: { policiesSearch?: { policies?: Array<Record<string, unknown>> } } }; }; }>(query); return response.data?.actor?.account?.alerts?.policiesSearch?.policies || []; }
  • Input schema definition for the list_alert_policies tool.
    inputSchema: { type: 'object', properties: { target_account_id: { type: 'string', description: 'Optional New Relic account ID', }, }, },
  • src/server.ts:205-209 (registration)
    Registration and dispatch of the list_alert_policies tool call in the server's executeTool switch statement.
    case 'list_alert_policies': return await new AlertTool(this.client).listAlertPolicies({ ...args, target_account_id: accountId, });
  • src/server.ts:74-74 (registration)
    Registers the tool definition from AlertTool.getPoliciesTool() into the server's tools map.
    alertTool.getPoliciesTool(),
  • src/server.ts:301-301 (registration)
    Includes list_alert_policies in the list of tools requiring an account ID.
    'list_alert_policies',

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/cloudbring/newrelic-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server