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

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)

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