Skip to main content
Glama
cloudbring

New Relic MCP Server

by cloudbring

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
NameRequiredDescriptionDefault
application_idYes
filter_hostnameNo
filter_idsNo
pageNo
auto_paginateNo
regionNo

Implementation Reference

  • 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;
    }
  • 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'],
        },
      };
    }
  • 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]
      );

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