Skip to main content
Glama
cloudbring

New Relic MCP Server

by cloudbring

create_browser_monitor

Create a browser-based Synthetics monitor to track website availability and performance from specified locations at set intervals.

Instructions

Create a new browser-based Synthetics monitor

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName of the monitor
urlYesURL to monitor
frequencyYesCheck frequency in minutes
locationsYesLocation codes for monitoring
target_account_idNoOptional New Relic account ID

Implementation Reference

  • Tool schema definition for 'create_browser_monitor' — defines name, description, inputSchema (name, url, frequency, locations, optional target_account_id)
    getCreateMonitorTool(): Tool {
      return {
        name: 'create_browser_monitor',
        description: 'Create a new browser-based Synthetics monitor',
        inputSchema: {
          type: 'object',
          properties: {
            name: {
              type: 'string',
              description: 'Name of the monitor',
            },
            url: {
              type: 'string',
              description: 'URL to monitor',
            },
            frequency: {
              type: 'number',
              enum: [1, 5, 10, 15, 30, 60],
              description: 'Check frequency in minutes',
            },
            locations: {
              type: 'array',
              items: { type: 'string' },
              description: 'Location codes for monitoring',
            },
            target_account_id: {
              type: 'string',
              description: 'Optional New Relic account ID',
            },
          },
          required: ['name', 'url', 'frequency', 'locations'],
        },
      };
  • Core handler method 'createBrowserMonitor' in SyntheticsTool class — executes the NerdGraph mutation 'syntheticsCreateSimpleBrowserMonitor' to create a browser monitor with name, url, period, locations, and status ENABLED. Handles error response.
    async createBrowserMonitor(input: {
      target_account_id?: string;
      name: string;
      url: string;
      frequency: number;
      locations: string[];
    }): Promise<Record<string, unknown> | null> {
      const accountId = input.target_account_id;
      if (!accountId) {
        throw new Error('Account ID must be provided');
      }
    
      const mutation = `
        mutation {
          syntheticsCreateSimpleBrowserMonitor(
            accountId: ${accountId}
            monitor: {
              name: "${input.name}"
              uri: "${input.url}"
              period: ${this.frequencyToPeriod(input.frequency)}
              status: ENABLED
              locations: {
                public: ${JSON.stringify(input.locations)}
              }
            }
          ) {
            monitor {
              id
              name
              uri
              period
              status
            }
            errors {
              type
              description
            }
          }
        }
      `;
    
      const response = await this.client.executeNerdGraphQuery<{
        syntheticsCreateSimpleBrowserMonitor?: {
          monitor?: Record<string, unknown>;
          errors?: Array<{ description?: string }>;
        };
      }>(mutation);
      const result = response.data?.syntheticsCreateSimpleBrowserMonitor;
    
      if (Array.isArray(result?.errors) && result!.errors!.length > 0) {
        throw new Error(
          `Failed to create monitor: ${result!.errors![0]?.description || 'Unknown error'}`
        );
      }
    
      return (result?.monitor as Record<string, unknown>) || null;
    }
  • src/server.ts:57-105 (registration)
    Tool registration in the server — line 78 registers syntheticsTool.getCreateMonitorTool() into the tools Map, making it available for discovery.
    private registerTools(): void {
      const nrqlTool = new NrqlTool(this.client);
      const apmTool = new ApmTool(this.client);
      const entityTool = new EntityTool(this.client);
      const alertTool = new AlertTool(this.client);
      const syntheticsTool = new SyntheticsTool(this.client);
      const nerdGraphTool = new NerdGraphTool(this.client);
      const restDeployments = new RestDeploymentsTool();
      const restApm = new RestApmTool();
      const restMetrics = new RestMetricsTool();
    
      // Register all tools
      const tools = [
        nrqlTool.getToolDefinition(),
        apmTool.getListApplicationsTool(),
        entityTool.getSearchTool(),
        entityTool.getDetailsTool(),
        alertTool.getPoliciesTool(),
        alertTool.getIncidentsTool(),
        alertTool.getAcknowledgeTool(),
        syntheticsTool.getListMonitorsTool(),
        syntheticsTool.getCreateMonitorTool(),
        nerdGraphTool.getQueryTool(),
        // REST v2 tools
        restDeployments.getCreateTool(),
        restDeployments.getListTool(),
        restDeployments.getDeleteTool(),
        restApm.getListApplicationsTool(),
        restMetrics.getListMetricNamesTool(),
        restMetrics.getMetricDataTool(),
        restMetrics.getListApplicationHostsTool(),
        {
          name: 'get_account_details',
          description: 'Get New Relic account details',
          inputSchema: {
            type: 'object' as const,
            properties: {
              target_account_id: {
                type: 'string' as const,
                description: 'Optional account ID to get details for',
              },
            },
          },
        },
      ];
    
      tools.forEach((tool) => {
        this.tools.set(tool.name, tool);
      });
  • src/server.ts:258-307 (registration)
    Tool execution dispatch and input validation in executeTool() — when name='create_browser_monitor', validates name/url/frequency/locations, then calls SyntheticsTool.createBrowserMonitor()
        case 'create_browser_monitor': {
          const { name, url, frequency, locations } = args as Record<string, unknown>;
          if (typeof name !== 'string' || name.trim() === '') {
            throw new Error('create_browser_monitor: "name" (non-empty string) is required');
          }
          if (typeof url !== 'string' || url.trim() === '') {
            throw new Error('create_browser_monitor: "url" (non-empty string) is required');
          }
          if (typeof frequency !== 'number' || !Number.isFinite(frequency) || frequency <= 0) {
            throw new Error('create_browser_monitor: "frequency" (positive number) is required');
          }
          if (
            !Array.isArray(locations) ||
            (locations as unknown[]).some((l) => typeof l !== 'string')
          ) {
            throw new Error('create_browser_monitor: "locations" must be an array of strings');
          }
          return await new SyntheticsTool(this.client).createBrowserMonitor({
            name,
            url,
            frequency,
            locations: locations as string[],
            target_account_id: accountId,
          });
        }
        case 'run_nerdgraph_query':
          return await new NerdGraphTool(this.client).execute(args);
        default: {
          const tool = this.tools.get(name);
          if (!tool) {
            throw new Error(`Tool ${name} not found`);
          }
          throw new Error(`Tool handler for ${name} not implemented`);
        }
      }
    }
    
    private requiresAccountId(toolName: string): boolean {
      const accountRequiredTools = [
        'run_nrql_query',
        'list_apm_applications',
        'search_entities',
        'get_account_details',
        'list_alert_policies',
        'list_open_incidents',
        'list_synthetics_monitors',
        'create_browser_monitor',
      ];
      return accountRequiredTools.includes(toolName);
    }
  • Helper method 'frequencyToPeriod' used by createBrowserMonitor — maps numeric frequency (1,5,10,15,30,60) to NerdGraph period strings (EVERY_MINUTE, EVERY_5_MINUTES, etc.)
    private frequencyToPeriod(frequency: number): string {
      const periodMap: { [key: number]: string } = {
        1: 'EVERY_MINUTE',
        5: 'EVERY_5_MINUTES',
        10: 'EVERY_10_MINUTES',
        15: 'EVERY_15_MINUTES',
        30: 'EVERY_30_MINUTES',
        60: 'EVERY_HOUR',
      };
      return periodMap[frequency] || 'EVERY_5_MINUTES';
    }
Behavior2/5

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

With no annotations, the description fails to disclose behavioral traits like side effects, idempotency, or authentication requirements. Simply stating it creates a monitor is insufficient.

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, clear sentence with no wasted words. It is front-loaded with the verb and object.

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?

The description omits important details like return values, prerequisites, or error conditions. For a creation tool with no output schema, more context is needed.

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 100%, so the description adds no extra meaning beyond the parameter descriptions. Baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Create') and the specific resource ('browser-based Synthetics monitor'), distinguishing it from sibling tools like list_synthetics_monitors.

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?

No guidance is provided on when to use this tool versus alternatives, such as other monitor creation tools or modification tools. The description lacks context for appropriate usage.

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/cloudbring/newrelic-mcp'

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