Skip to main content
Glama
cloudbring

New Relic MCP Server

by cloudbring

list_apm_applications

Retrieve a list of all APM applications in your New Relic account using a specified account ID with this tool on the MCP server.

Instructions

List all APM applications in your New Relic account

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
target_account_idNoOptional New Relic account ID

Implementation Reference

  • Defines the tool metadata, name, description, and input schema for 'list_apm_applications'
    getListApplicationsTool(): Tool { return { name: 'list_apm_applications', description: 'List all APM applications in your New Relic account', inputSchema: { type: 'object', properties: { target_account_id: { type: 'string', description: 'Optional New Relic account ID', }, }, }, }; }
  • The main handler function for the 'list_apm_applications' tool, which validates input and delegates to NewRelicClient
    async execute(input: { target_account_id?: string }): Promise<ApmApplication[]> { if (!input.target_account_id) { throw new Error('Account ID must be provided'); } const applications = await this.client.listApmApplications(input.target_account_id); return applications; }
  • Core helper method that performs the NerdGraph GraphQL query to list APM applications and parses the response
    async listApmApplications(accountId?: string): Promise<ApmApplication[]> { const id = accountId || this.defaultAccountId; if (!id) { throw new Error('Account ID must be provided'); } const query = `{ actor { entitySearch(query: "domain = 'APM' AND type = 'APPLICATION' AND accountId = '${id}'") { results { entities { guid name ... on ApmApplicationEntityOutline { language reporting alertSeverity tags { key values } } } } } } }`; type EntitySearchResponse = { actor?: { entitySearch?: { results?: { entities?: Array<{ guid: string; name: string; language?: string; reporting?: boolean; alertSeverity?: string; tags?: Array<{ key?: string; values?: string[] }>; }>; }; }; }; }; const response = (await this.executeNerdGraphQuery<EntitySearchResponse>( query )) as GraphQLResponse<EntitySearchResponse>; const entities = (response.data?.actor?.entitySearch?.results?.entities || []) as Array<{ guid: string; name: string; language?: string; reporting?: boolean; alertSeverity?: string; tags?: Array<{ key?: string; values?: string[] }>; }>; return entities.map((entity) => ({ guid: entity.guid, name: entity.name, language: entity.language || 'unknown', reporting: entity.reporting || false, alertSeverity: entity.alertSeverity, tags: this.parseTags(entity.tags), })); }
  • src/server.ts:69-105 (registration)
    Registers the 'list_apm_applications' tool by including it in the tools Map used for ListToolsRequest
    const tools = [ nrqlTool.getToolDefinition(), apmTool.getListApplicationsTool(), entityTool.getSearchTool(), entityTool.getDetailsTool(), alertTool.getPoliciesTool(), alertTool.getIncidentsTool(), alertTool.getAcknowledgeTool(), syntheticsTool.getListMonitorsTool(), syntheticsTool.getCreateMonitorTool(), nerdGraphTool.getQueryTool(), // REST v2 tools restDeployments.getCreateTool(), restDeployments.getListTool(), restDeployments.getDeleteTool(), restApm.getListApplicationsTool(), restMetrics.getListMetricNamesTool(), restMetrics.getMetricDataTool(), restMetrics.getListApplicationHostsTool(), { name: 'get_account_details', description: 'Get New Relic account details', inputSchema: { type: 'object' as const, properties: { target_account_id: { type: 'string' as const, description: 'Optional account ID to get details for', }, }, }, }, ]; tools.forEach((tool) => { this.tools.set(tool.name, tool); });
  • Server-side dispatch handler that invokes the ApmTool execute method for tool calls
    case 'list_apm_applications': return await new ApmTool(this.client).execute({ ...args, target_account_id: accountId, });

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