Skip to main content
Glama
cloudbring

New Relic MCP Server

by cloudbring

list_metric_names_for_host

Retrieve metric names and values for a specific application host in New Relic to monitor performance and analyze system behavior.

Instructions

List metric names and values for a specific application host (REST v2).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
application_idYes
host_idYes
nameNo
pageNo
auto_paginateNo
regionNo

Implementation Reference

  • The core handler function `listMetricNames` in `RestMetricsTool` class that performs the API call to list metric names for a given application host using New Relic REST API v2, with optional pagination support.
    async listMetricNames(args: ListMetricNamesArgs): Promise<unknown> {
      const client = this.restFor(args.region);
      const path = `/applications/${args.application_id}/hosts/${args.host_id}/metrics`;
      const query: Record<string, unknown> = {};
      if (args.name) query.name = args.name;
      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 };
    }
  • The `getListMetricNamesTool` method defining the tool's metadata, description, and input schema for validation.
    getListMetricNamesTool(): Tool {
      return {
        name: 'list_metric_names_for_host',
        description: 'List metric names and values for a specific application host (REST v2).',
        inputSchema: {
          type: 'object',
          properties: {
            application_id: { type: 'number' },
            host_id: { type: 'number' },
            name: { type: 'string' },
            page: { type: 'number' },
            auto_paginate: { type: 'boolean' },
            region: { type: 'string', enum: ['US', 'EU'] },
          },
          required: ['application_id', 'host_id'],
        },
      };
    }
  • src/server.ts:65-87 (registration)
    Registration of RestMetricsTool instance and addition of its tool definitions, including 'list_metric_names_for_host', to the server's tools registry for discovery.
    const restApm = new RestApmTool();
    const restMetrics = new RestMetricsTool();
    
    // Register all tools
    const tools = [
      nrqlTool.getToolDefinition(),
      apmTool.getListApplicationsTool(),
      entityTool.getSearchTool(),
      entityTool.getDetailsTool(),
      alertTool.getPoliciesTool(),
      alertTool.getIncidentsTool(),
      alertTool.getAcknowledgeTool(),
      syntheticsTool.getListMonitorsTool(),
      syntheticsTool.getCreateMonitorTool(),
      nerdGraphTool.getQueryTool(),
      // REST v2 tools
      restDeployments.getCreateTool(),
      restDeployments.getListTool(),
      restDeployments.getDeleteTool(),
      restApm.getListApplicationsTool(),
      restMetrics.getListMetricNamesTool(),
      restMetrics.getMetricDataTool(),
      restMetrics.getListApplicationHostsTool(),
  • src/server.ts:191-194 (registration)
    Switch case in server's `executeTool` method that dispatches tool calls to the handler by instantiating RestMetricsTool and calling `listMetricNames`.
    case 'list_metric_names_for_host':
      return await new RestMetricsTool().listMetricNames(
        args as Parameters<RestMetricsTool['listMetricNames']>[0]
      );
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the REST v2 context but fails to describe critical behaviors such as pagination handling (implied by 'page' and 'auto_paginate' parameters), rate limits, authentication needs, or response format. This leaves significant gaps for a tool with 6 parameters.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose without unnecessary details. It avoids redundancy and wastes no words, making it highly concise and well-structured for quick understanding.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (6 parameters, no annotations, no output schema), the description is inadequate. It lacks details on parameter usage, behavioral traits, output format, and differentiation from siblings. For a data retrieval tool with multiple inputs, this leaves the agent under-informed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate for undocumented parameters. It only vaguely references 'metric names and values' without explaining parameters like 'application_id', 'host_id', 'name', 'page', 'auto_paginate', or 'region'. This adds minimal semantic value beyond the schema's structure.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('List') and target resources ('metric names and values for a specific application host'), with the REST API version ('REST v2') providing technical context. However, it does not explicitly differentiate this tool from sibling tools like 'get_metric_data_for_host' or 'list_application_hosts', which limits its score to 4 instead of 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'get_metric_data_for_host' or 'list_application_hosts', nor does it mention prerequisites or exclusions. It only implies usage for listing metrics per host, offering minimal contextual direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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