Skip to main content
Glama
cloudbring

New Relic MCP Server

by cloudbring

get_metric_data_for_host

Retrieve metric timeslices for specified metrics on a host to analyze performance data over time.

Instructions

Get metric timeslices for metrics on a host (REST v2).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
application_idYes
host_idYes
namesYes
valuesNo
fromNo
toNo
periodNo
summarizeNo
pageNo
auto_paginateNo
regionNo

Implementation Reference

  • Handler function that fetches metric timeslice data for a host via the New Relic REST v2 API. Supports auto-pagination and filtering by names, values, time range, period, and summarize flag.
    async getMetricData(args: GetMetricDataArgs): Promise<unknown> {
      const client = this.restFor(args.region);
      const path = `/applications/${args.application_id}/hosts/${args.host_id}/metrics/data`;
      const query: Record<string, unknown> = { names: args.names, values: args.values };
      if (args.from) query.from = args.from;
      if (args.to) query.to = args.to;
      if (args.period) query.period = args.period;
      if (args.summarize !== undefined) query.summarize = args.summarize;
      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 };
    }
  • TypeScript type definition for the input arguments of getMetricData.
    type GetMetricDataArgs = {
      application_id: number;
      host_id: number;
      names: string[];
      values?: string[];
      from?: string;
      to?: string;
      period?: number;
      summarize?: boolean;
      page?: number;
      auto_paginate?: boolean;
      region?: Region;
    };
  • MCP Tool schema definition (name, description, inputSchema) for the get_metric_data_for_host tool.
    getMetricDataTool(): Tool {
      return {
        name: 'get_metric_data_for_host',
        description: 'Get metric timeslices for metrics on a host (REST v2).',
        inputSchema: {
          type: 'object',
          properties: {
            application_id: { type: 'number' },
            host_id: { type: 'number' },
            names: { type: 'array', items: { type: 'string' } },
            values: { type: 'array', items: { type: 'string' } },
            from: { type: 'string' },
            to: { type: 'string' },
            period: { type: 'number' },
            summarize: { type: 'boolean' },
            page: { type: 'number' },
            auto_paginate: { type: 'boolean' },
            region: { type: 'string', enum: ['US', 'EU'] },
          },
          required: ['application_id', 'host_id', 'names'],
        },
      };
  • src/server.ts:195-198 (registration)
    Registration in the server's executeTool method that dispatches the tool name to the getMetricData handler.
    case 'get_metric_data_for_host':
      return await new RestMetricsTool().getMetricData(
        args as Parameters<RestMetricsTool['getMetricData']>[0]
      );
  • src/server.ts:86-86 (registration)
    Tool registration: getMetricDataTool() is added to the tools array during server construction.
    restMetrics.getMetricDataTool(),
Behavior2/5

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

Annotations are absent; the description only mentions 'REST v2' but doesn't disclose pagination, rate limits, or data format, leaving significant behavioral gaps.

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

Conciseness3/5

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

The single sentence is concise but too brief for a tool with many parameters; it could include more detail without becoming verbose.

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

Completeness1/5

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

With 11 parameters, no annotations, and no output schema, the description fails to provide essential context like return format, pagination behavior, or interpretation of results.

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

Parameters1/5

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

Schema description coverage is 0%, and the description provides no explanation for any of the 11 parameters, forcing the agent to rely solely on parameter names.

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

Purpose5/5

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

The description clearly states it retrieves metric timeslices for a host, distinguishing it from sibling tools like list_metric_names_for_host and run_nrql_query.

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?

No guidance on when to use this tool versus alternatives, such as run_nrql_query for custom queries or listing metrics first.

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