Skip to main content
Glama

New Relic MCP Server

by cloudbring
nerdgraph.test.ts1.23 kB
import { beforeEach, describe, expect, it, vi } from 'vitest'; import { NerdGraphTool } from '../../src/tools/nerdgraph'; describe('NerdGraph Tool', () => { const client = { executeNerdGraphQuery: vi.fn() } as any; let tool: NerdGraphTool; beforeEach(() => { vi.resetAllMocks(); tool = new NerdGraphTool(client); }); it('getQueryTool: has correct name and schema', () => { const def = tool.getQueryTool(); expect(def.name).toBe('run_nerdgraph_query'); expect(def.inputSchema).toHaveProperty('properties.query'); expect((def.inputSchema as any).required).toContain('query'); }); it('execute: calls client with query and variables', async () => { const mockResult = { data: { actor: { user: { id: 1 } } } }; client.executeNerdGraphQuery = vi.fn().mockResolvedValue(mockResult); const res = await tool.execute({ query: '{ actor { user { id } } }', variables: { limit: 10 }, }); expect(client.executeNerdGraphQuery).toHaveBeenCalledWith('{ actor { user { id } } }', { limit: 10, }); expect(res).toBe(mockResult); }); it('execute: throws for empty query', async () => { await expect(tool.execute({ query: '' })).rejects.toThrow(); }); });

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