Skip to main content
Glama
cloudbring

New Relic MCP Server

by cloudbring

run_nerdgraph_query

Execute custom GraphQL queries to interact with New Relic's NerdGraph API for data retrieval and management tasks.

Instructions

Execute a custom NerdGraph GraphQL query

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesThe GraphQL query to execute
variablesNoOptional GraphQL variables to supply to the query

Implementation Reference

  • The primary handler for the 'run_nerdgraph_query' tool. Validates the GraphQL query and variables input using Zod, then delegates execution to the NewRelicClient.
    async execute(input: unknown): Promise<unknown> { // Validate input with Zod for consistency const schema = z.object({ query: z.string().min(1, 'Invalid or empty GraphQL query provided'), variables: z.record(z.any()).optional(), }); const { query, variables } = schema.parse(input); return await this.client.executeNerdGraphQuery(query, variables); }
  • Defines the tool's metadata, including name, description, and input schema specifying a required 'query' string and optional 'variables' object.
    getQueryTool(): Tool { return { name: 'run_nerdgraph_query', description: 'Execute a custom NerdGraph GraphQL query', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'The GraphQL query to execute', }, variables: { type: 'object', description: 'Optional GraphQL variables to supply to the query', }, }, required: ['query'], }, };
  • src/server.ts:79-80 (registration)
    Registers the 'run_nerdgraph_query' tool by including NerdGraphTool.getQueryTool() in the server's list of available tools.
    nerdGraphTool.getQueryTool(), // REST v2 tools
  • Server-side dispatch handler that instantiates NerdGraphTool and calls its execute method for 'run_nerdgraph_query' tool invocations.
    case 'run_nerdgraph_query': return await new NerdGraphTool(this.client).execute(args);

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