Skip to main content
Glama
piekstra

New Relic MCP Server

by piekstra

get_application_metric_data

Retrieve performance metrics for a specific application from New Relic monitoring data to analyze application behavior and identify issues.

Instructions

Get metric data for an application

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
app_idYes
metric_namesYes
from_timeNo
to_timeNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler that wraps the client method, handles client initialization check, calls the helper, formats response as JSON, and handles exceptions.
    @mcp.tool()
    async def get_application_metric_data(
        app_id: str,
        metric_names: List[str],
        from_time: Optional[str] = None,
        to_time: Optional[str] = None,
    ) -> str:
        """Get metric data for an application"""
        if not client:
            return json.dumps({"error": "New Relic client not initialized"})
    
        try:
            result = await client.get_application_metric_data(
                app_id, metric_names, from_time, to_time
            )
            return json.dumps(result, indent=2)
        except Exception as e:
            return json.dumps({"error": str(e)}, indent=2)
  • Core helper method in NewRelicClient class that constructs the New Relic API request for application metric data and executes it using _make_request.
    async def get_application_metric_data(
        self,
        app_id: str,
        metric_names: List[str],
        from_time: Optional[str] = None,
        to_time: Optional[str] = None,
    ) -> Dict[str, Any]:
        """Get metric data for an application"""
        url = f"{self.base_url}/applications/{app_id}/metrics/data.json"
        params = {"names": metric_names}
    
        if from_time:
            params["from"] = from_time
        if to_time:
            params["to"] = to_time
    
        return await self._make_request("GET", url, params=params)
  • The @mcp.tool() decorator registers this function as an MCP tool.
    @mcp.tool()
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. 'Get metric data' implies a read-only operation, but it doesn't specify authentication needs, rate limits, error handling, or what the output contains (though an output schema exists). For a tool with 4 parameters and no annotation coverage, this is insufficient to inform the agent about behavioral traits beyond the basic read implication.

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 a single, efficient sentence with no wasted words, making it appropriately concise. It's front-loaded with the core action, though it could be more structured by including key details. The brevity is good, but it risks under-specification given the tool's complexity.

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 tool has 4 parameters with 0% schema coverage, no annotations, and sibling tools that might overlap, the description is incomplete. It doesn't explain parameter semantics, usage context, or behavioral aspects, though the presence of an output schema mitigates the need to describe return values. For a data retrieval tool in a monitoring context, more guidance is needed to be fully helpful.

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%, meaning none of the 4 parameters have descriptions in the schema. The tool description doesn't add any parameter details—it doesn't explain what 'app_id', 'metric_names', 'from_time', or 'to_time' mean, their formats, or examples. This leaves parameters largely undocumented, failing to compensate for the low schema coverage.

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 'Get metric data for an application' clearly states the verb ('Get') and resource ('metric data for an application'), making the purpose understandable. However, it doesn't differentiate from sibling tools like 'get_application_metrics' (which might retrieve different types of metric information), leaving the distinction vague. This is adequate but lacks specificity about what type of metric data or how it differs from similar tools.

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. It doesn't mention prerequisites, context, or exclusions, and with sibling tools like 'get_application_metrics' and 'query_nrql' that might overlap in functionality, there's no indication of when this specific tool is preferred. This leaves the agent without usage 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/piekstra/newrelic-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server