list_deployments_rest
Retrieve deployment history for a New Relic APM application using REST v2 API to monitor application changes and track deployment timelines.
Instructions
List deployments for an APM application (REST v2).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| application_id | Yes | ||
| page | No | ||
| auto_paginate | No | ||
| region | No |
Implementation Reference
- src/tools/rest/deployments.ts:84-110 (handler)Core handler function that executes the list_deployments_rest tool: fetches deployments via REST API with optional pagination support.async list(args: ListDeploymentsArgs): Promise<unknown> { const client = this.restFor(args.region); const path = `/applications/${args.application_id}/deployments`; const results: unknown[] = []; let page = args.page; let nextUrl: string | undefined; do { const res = await client.get<unknown>(path, page ? { page } : undefined); results.push(res.data); const next = res.links?.next; if (args.auto_paginate && next) { // Extract page from next URL if present const u = new URL(next); const p = u.searchParams.get('page'); page = p ? Number(p) : undefined; nextUrl = next; } else { nextUrl = undefined; } } while (args.auto_paginate && nextUrl); return { items: args.auto_paginate ? results : results[0], page: page, }; }
- src/tools/rest/deployments.ts:67-81 (schema)Defines the tool schema including name, description, and input validation schema.getListTool(): Tool { return { name: 'list_deployments_rest', description: 'List deployments for an APM application (REST v2).', inputSchema: { type: 'object', properties: { application_id: { type: 'number' }, page: { type: 'number' }, auto_paginate: { type: 'boolean' }, region: { type: 'string', enum: ['US', 'EU'] }, }, required: ['application_id'], }, };
- src/server.ts:81-83 (registration)Registers the list_deployments_rest tool by calling getListTool() on RestDeploymentsTool instance and adding to the server's tools list.restDeployments.getCreateTool(), restDeployments.getListTool(), restDeployments.getDeleteTool(),
- src/server.ts:179-182 (handler)Server-side dispatcher that invokes the tool handler upon tool call request.case 'list_deployments_rest': return await new RestDeploymentsTool().list( args as Parameters<RestDeploymentsTool['list']>[0] );