list_deployments_rest
Retrieve deployment details for an APM application using REST v2. Input includes application ID, page number, auto-paginate option, and region.
Instructions
List deployments for an APM application (REST v2).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| application_id | Yes | ||
| auto_paginate | No | ||
| page | No | ||
| region | No |
Implementation Reference
- src/tools/rest/deployments.ts:84-110 (handler)Executes the tool: fetches deployments for a given APM application ID using New Relic REST API v2, supports manual page and auto-pagination.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-82 (schema)Defines the tool metadata, name, description, and input schema for list_deployments_rest.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 tool schema by including getListTool() in the list of tools advertised via MCP list_tools.restDeployments.getCreateTool(), restDeployments.getListTool(), restDeployments.getDeleteTool(),
- src/server.ts:179-182 (registration)Dispatches tool execution in the MCP call_tool handler by instantiating RestDeploymentsTool and calling its list() method.case 'list_deployments_rest': return await new RestDeploymentsTool().list( args as Parameters<RestDeploymentsTool['list']>[0] );
- src/tools/rest/deployments.ts:14-18 (schema)TypeScript type definition for the input arguments used in schema and handler.application_id: number; page?: number; auto_paginate?: boolean; region?: Region; };