list_application_hosts
Retrieve and filter hosts associated with a New Relic APM application to monitor infrastructure supporting your services.
Instructions
List hosts for an APM application (REST v2).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| application_id | Yes | ||
| filter_hostname | No | ||
| filter_ids | No | ||
| page | No | ||
| auto_paginate | No | ||
| region | No |
Implementation Reference
- src/tools/rest/metrics.ts:158-167 (handler)The handler function that executes 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:139-156 (schema)Tool definition including name, description, and input schema for list_application_hosts.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/tools/rest/metrics.ts:27-34 (schema)TypeScript type definition for the input parameters of the listApplicationHosts handler.type ListHostsArgs = { application_id: number; filter_hostname?: string; filter_ids?: string; // comma-separated page?: number; auto_paginate?: boolean; region?: Region; };
- src/server.ts:87-87 (registration)Adds the list_application_hosts tool to the server's list of available tools.restMetrics.getListApplicationHostsTool(),
- src/server.ts:199-202 (registration)Switch case in executeTool that dispatches calls to the listApplicationHosts handler.case 'list_application_hosts': return await new RestMetricsTool().listApplicationHosts( args as Parameters<RestMetricsTool['listApplicationHosts']>[0] );