Skip to main content
Glama
cloudbring

New Relic MCP Server

by cloudbring

list_apm_applications_rest

Retrieve APM application details using REST v2 API. Filter by name, host, IDs, language, or region, and manage pagination for efficient data querying.

Instructions

List APM applications via REST v2.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
auto_paginateNo
filter_hostNo
filter_idsNo
filter_languageNo
filter_nameNo
pageNo
regionNo

Implementation Reference

  • The core handler function that performs REST API calls to list New Relic APM applications, supporting filters, pagination, and auto-pagination.
    async listApplications(args: ListApplicationsArgs): Promise<unknown> { const client = this.restFor(args.region); const path = '/applications'; const query: Record<string, unknown> = {}; if (args.filter_name) query['filter[name]'] = args.filter_name; if (args.filter_host) query['filter[host]'] = args.filter_host; if (args.filter_language) query['filter[language]'] = args.filter_language; if (args.filter_ids && args.filter_ids.length > 0) query['filter[ids]'] = args.filter_ids.join(','); if (args.page) query.page = args.page; const results: unknown[] = []; let nextUrl: string | undefined; let page = args.page; do { const res = await client.get<unknown>(path, page ? { ...query, page } : query); results.push(res.data); const next = res.links?.next; if (args.auto_paginate && next) { const u = new URL(next); const p = u.searchParams.get('page'); page = p ? Number(p) : undefined; nextUrl = next; } else { nextUrl = undefined; } } while (args.auto_paginate && nextUrl); return { items: args.auto_paginate ? results : results[0], page }; } }
  • Defines the tool's metadata including name 'list_apm_applications_rest', description, and input schema for arguments.
    getListApplicationsTool(): Tool { return { name: 'list_apm_applications_rest', description: 'List APM applications via REST v2.', inputSchema: { type: 'object', properties: { filter_name: { type: 'string' }, filter_host: { type: 'string' }, filter_ids: { type: 'array', items: { type: 'number' } }, filter_language: { type: 'string' }, page: { type: 'number' }, auto_paginate: { type: 'boolean' }, region: { type: 'string', enum: ['US', 'EU'] }, }, }, }; }
  • src/server.ts:187-190 (registration)
    Registers and dispatches the tool call in the server's executeTool switch statement by invoking RestApmTool.listApplications.
    case 'list_apm_applications_rest': return await new RestApmTool().listApplications( args as Parameters<RestApmTool['listApplications']>[0] );
  • src/server.ts:84-84 (registration)
    Adds the tool definition to the server's tools list for listTools requests.
    restApm.getListApplicationsTool(),
  • Helper method to create REST client instance for the specified region.
    private restFor(region?: Region): NewRelicRestClient { const apiKey = process.env.NEW_RELIC_API_KEY as string; return new NewRelicRestClient({ apiKey, region: region ?? 'US' }); }

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