list_deployments_rest
Retrieve deployments for a New Relic APM application using REST v2. Specify the application ID to get a paginated list of deployment records.
Instructions
List deployments for an APM application (REST v2).
Input 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)The handler function for 'list_deployments_rest'. Makes GET request to /applications/{id}/deployments, supports pagination (page param, auto_paginate with next-link following). Returns items array and current page.
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:13-18 (schema)Type definition for the input arguments of the list_deployments_rest handler.
type ListDeploymentsArgs = { application_id: number; page?: number; auto_paginate?: boolean; region?: Region; }; - src/tools/rest/deployments.ts:67-82 (schema)Tool definition (name, description, inputSchema) for the 'list_deployments_rest' tool. Registers the schema used by the MCP protocol.
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:179-182 (registration)Dispatch/registration in the executeTool switch-case that routes 'list_deployments_rest' to the RestDeploymentsTool().list() handler.
case 'list_deployments_rest': return await new RestDeploymentsTool().list( args as Parameters<RestDeploymentsTool['list']>[0] ); - src/server.ts:82-82 (registration)Registration of the tool definition into the server's tool list via restDeployments.getListTool() in registerTools().
restDeployments.getListTool(),