list_apm_applications
Retrieve all APM applications from your New Relic account to monitor application performance and health.
Instructions
List all APM applications in your New Relic account
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| target_account_id | No | Optional New Relic account ID |
Implementation Reference
- src/tools/apm.ts:27-34 (handler)The primary handler for the 'list_apm_applications' tool. Validates the input target_account_id and calls the NewRelicClient to fetch APM applications.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; }
- src/tools/apm.ts:15-23 (schema)Input schema definition for the tool, specifying the optional target_account_id parameter.inputSchema: { type: 'object', properties: { target_account_id: { type: 'string', description: 'Optional New Relic account ID', }, }, },
- src/server.ts:71-71 (registration)Registration of the tool by adding its definition to the list of available tools in the MCP server.apmTool.getListApplicationsTool(),
- src/server.ts:170-174 (handler)MCP server dispatch handler for the tool call, instantiating ApmTool and invoking its execute method with resolved account ID.case 'list_apm_applications': return await new ApmTool(this.client).execute({ ...args, target_account_id: accountId, });
- Core helper method that executes the NerdGraph entitySearch GraphQL query to retrieve APM applications for the specified account 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), })); }