Skip to main content
Glama
cloudbring

New Relic MCP Server

by cloudbring

get_metric_data_for_host

Retrieve metric timeslice data for a specific host in New Relic applications using REST v2 queries to monitor performance and analyze system behavior.

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

  • The handler function that implements the core logic for fetching metric timeslices data for a host via New Relic REST API v2, supporting pagination and query parameters.
    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 };
    }
  • Defines the tool's metadata, description, and input schema for validation.
    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:85-87 (registration)
    Registers the tool by including its definition in the server's list of available tools.
    restMetrics.getListMetricNamesTool(),
    restMetrics.getMetricDataTool(),
    restMetrics.getListApplicationHostsTool(),
  • src/server.ts:195-198 (registration)
    Registers the execution handler in the server's tool dispatcher switch statement.
    case 'get_metric_data_for_host':
      return await new RestMetricsTool().getMetricData(
        args as Parameters<RestMetricsTool['getMetricData']>[0]
      );
  • TypeScript type definition for the tool's input arguments, aligning with the inputSchema.
    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;
    };
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It mentions 'REST v2' which hints at API versioning, but doesn't disclose whether this is a read-only operation, what authentication is needed, rate limits, pagination behavior (despite having 'page' and 'auto_paginate' parameters), or what format the returned data takes.

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

Conciseness4/5

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

The description is appropriately concise with a single sentence that gets straight to the point. However, it's front-loaded with minimal information rather than being efficiently informative - it could convey more value in the same space.

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?

For a complex tool with 11 parameters, 0% schema coverage, no annotations, and no output schema, the description is severely inadequate. It doesn't explain what data is returned, how to interpret results, or provide any context about the numerous parameters that control the query.

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?

With 0% schema description coverage for 11 parameters, the description provides no information about any parameters. It doesn't explain what 'application_id', 'host_id', 'names', 'values', 'from', 'to', 'period', 'summarize', 'page', 'auto_paginate', or 'region' mean or how they should be used.

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

Purpose3/5

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

The description states the action ('Get metric timeslices') and target ('metrics on a host'), but it's vague about what 'metric timeslices' are and doesn't distinguish this tool from sibling tools like 'list_metric_names_for_host' or 'run_nrql_query'. The mention of 'REST v2' adds technical context but doesn't clarify functional purpose.

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 is provided about when to use this tool versus alternatives. There's no mention of prerequisites, when this tool is appropriate versus sibling tools like 'list_metric_names_for_host' or 'run_nrql_query', or any context about the required parameters (application_id, host_id, names).

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