list_synthetics_monitors
Retrieve and filter all Synthetics monitors from your New Relic account to manage and monitor application performance.
Instructions
List all Synthetics monitors in your New Relic account
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| target_account_id | No | Optional New Relic account ID | |
| monitor_type | No | Filter by monitor type |
Implementation Reference
- src/tools/synthetics.ts:67-113 (handler)The `listSyntheticsMonitors` function implements the core logic of the tool by constructing and executing a NerdGraph query to search for synthetics monitor entities based on account ID and optional monitor type filter.async listSyntheticsMonitors(input: { target_account_id?: string; monitor_type?: 'SIMPLE' | 'BROWSER' | 'SCRIPT_API' | 'SCRIPT_BROWSER'; }): Promise<Array<Record<string, unknown>>> { const accountId = input.target_account_id; if (!accountId) { throw new Error('Account ID must be provided'); } let query = `domain = 'SYNTH' AND accountId = '${accountId}'`; if (input.monitor_type) { query += ` AND monitorType = '${input.monitor_type}'`; } const graphqlQuery = `{ actor { entitySearch(query: "${query}") { results { entities { ... on SyntheticMonitorEntityOutline { guid name monitorType period monitoredUrl tags { key values } } } } } } }`; const response = (await this.client.executeNerdGraphQuery(graphqlQuery)) as { data?: { actor?: { entitySearch?: { results?: { entities?: Array<Record<string, unknown>> }; }; }; }; }; return response.data?.actor?.entitySearch?.results?.entities || []; }
- src/tools/synthetics.ts:11-30 (schema)The `getListMonitorsTool` method defines the tool's metadata, including name, description, and input schema for parameters like target_account_id and monitor_type.getListMonitorsTool(): Tool { return { name: 'list_synthetics_monitors', description: 'List all Synthetics monitors in your New Relic account', inputSchema: { type: 'object', properties: { target_account_id: { type: 'string', description: 'Optional New Relic account ID', }, monitor_type: { type: 'string', enum: ['SIMPLE', 'BROWSER', 'SCRIPT_API', 'SCRIPT_BROWSER'], description: 'Filter by monitor type', }, }, }, }; }
- src/server.ts:253-257 (registration)In the `executeTool` switch statement, this case registers and dispatches calls to the `listSyntheticsMonitors` handler on a new SyntheticsTool instance.case 'list_synthetics_monitors': return await new SyntheticsTool(this.client).listSyntheticsMonitors({ ...args, target_account_id: accountId, });
- src/server.ts:61-78 (registration)Instantiates the `SyntheticsTool` class and calls `getListMonitorsTool()` to register the tool definition in the server's tools map for list tools request.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(),