list_application_hosts
Discover and filter APM application hosts using REST v2 queries. Specify hostnames, IDs, and pagination for targeted results with New Relic MCP Server integration.
Instructions
List hosts for an APM application (REST v2).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| application_id | Yes | ||
| auto_paginate | No | ||
| filter_hostname | No | ||
| filter_ids | No | ||
| page | No | ||
| region | No |
Implementation Reference
- src/tools/rest/metrics.ts:158-167 (handler)The core handler function that implements the logic for the 'list_application_hosts' tool by querying the New Relic REST API for application hosts.async listApplicationHosts(args: ListHostsArgs): Promise<unknown> { const client = this.restFor(args.region); const path = `/applications/${args.application_id}/hosts`; const query: Record<string, unknown> = {}; if (args.filter_hostname) query['filter[hostname]'] = args.filter_hostname; if (args.filter_ids) query['filter[ids]'] = args.filter_ids; if (args.page) query.page = args.page; const res = await client.get<unknown>(path, query); return res; }
- src/tools/rest/metrics.ts:27-34 (schema)TypeScript type definition for the input parameters of the list_application_hosts tool.type ListHostsArgs = { application_id: number; filter_hostname?: string; filter_ids?: string; // comma-separated page?: number; auto_paginate?: boolean; region?: Region; };
- src/tools/rest/metrics.ts:139-156 (registration)Tool definition method that provides the name, description, and input schema for registering the 'list_application_hosts' tool.getListApplicationHostsTool(): Tool { return { name: 'list_application_hosts', description: 'List hosts for an APM application (REST v2).', inputSchema: { type: 'object', properties: { application_id: { type: 'number' }, filter_hostname: { type: 'string' }, filter_ids: { type: 'string' }, page: { type: 'number' }, auto_paginate: { type: 'boolean' }, region: { type: 'string', enum: ['US', 'EU'] }, }, required: ['application_id'], }, }; }
- src/server.ts:87-87 (registration)Registration of the tool in the server's tools list by calling getListApplicationHostsTool().restMetrics.getListApplicationHostsTool(),
- src/server.ts:199-202 (registration)Dispatch handler in the server's executeTool switch statement that invokes the tool's handler function.case 'list_application_hosts': return await new RestMetricsTool().listApplicationHosts( args as Parameters<RestMetricsTool['listApplicationHosts']>[0] );