Skip to main content
Glama
piekstra

New Relic MCP Server

by piekstra

nerdgraph_query

Execute custom GraphQL queries to interact with New Relic monitoring and observability data through the NerdGraph API.

Instructions

Execute a custom NerdGraph GraphQL query

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
variablesNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler for 'nerdgraph_query'. This is the main entrypoint decorated with @mcp.tool() that handles the tool execution by calling the client's method and formatting the JSON response.
    @mcp.tool()
    async def nerdgraph_query(
        query: str, variables: Optional[Dict[str, Any]] = None
    ) -> str:
        """Execute a custom NerdGraph GraphQL query"""
        if not client:
            return json.dumps({"error": "New Relic client not initialized"})
    
        try:
            result = await client.nerdgraph_query(query, variables)
            return json.dumps(result, indent=2)
        except Exception as e:
            return json.dumps({"error": str(e)}, indent=2)
  • Helper method in NewRelicClient class that performs the actual NerdGraph GraphQL query by constructing the request payload and calling the generic HTTP request method.
    async def nerdgraph_query(
        self, query: str, variables: Optional[Dict[str, Any]] = None
    ) -> Dict[str, Any]:
        """Execute a NerdGraph GraphQL query"""
        data = {"query": query}
        if variables:
            data["variables"] = variables
        return await self._make_request("POST", self.nerdgraph_url, json=data)
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 but offers minimal information. It implies a read/write operation ('Execute') without specifying permissions, rate limits, or response behavior. The agent must infer details from the tool name and context, which is insufficient for safe use.

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 with zero waste—every word contributes to conveying the tool's purpose. It is appropriately sized and front-loaded, making it easy for an agent to parse quickly.

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

Completeness3/5

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

Given the tool's complexity (executing arbitrary GraphQL queries) and lack of annotations, the description is incomplete. However, the presence of an output schema mitigates some gaps by defining return values. The description should ideally include more about authentication, error handling, or query constraints to be fully adequate.

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

Parameters3/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 but does not add meaning beyond the schema. It mentions 'custom NerdGraph GraphQL query' which hints at the 'query' parameter's purpose, but provides no details on syntax, format, or the 'variables' parameter. Baseline 3 is appropriate as the schema defines parameters clearly despite lack of descriptions.

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 ('Execute') and resource ('custom NerdGraph GraphQL query'), making the purpose immediately understandable. It distinguishes itself from sibling tools like 'query_nrql' by specifying GraphQL rather than NRQL queries, though it doesn't explicitly contrast with all siblings.

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 'query_nrql' or other data retrieval tools in the sibling list. It lacks context about appropriate use cases, prerequisites, or exclusions, leaving the agent with minimal 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