list_apm_applications_rest
Retrieve a list of APM applications with optional filters for name, host, IDs, language, and pagination.
Instructions
List APM applications via REST v2.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filter_name | No | ||
| filter_host | No | ||
| filter_ids | No | ||
| filter_language | No | ||
| page | No | ||
| auto_paginate | No | ||
| region | No |
Implementation Reference
- src/tools/rest/apm.ts:39-68 (handler)The `listApplications` method on `RestApmTool` executes the tool logic: builds a query from filter args, calls the REST API at '/applications' with optional pagination, and returns the results.
async listApplications(args: ListApplicationsArgs): Promise<unknown> { const client = this.restFor(args.region); const path = '/applications'; const query: Record<string, unknown> = {}; if (args.filter_name) query['filter[name]'] = args.filter_name; if (args.filter_host) query['filter[host]'] = args.filter_host; if (args.filter_language) query['filter[language]'] = args.filter_language; if (args.filter_ids && args.filter_ids.length > 0) query['filter[ids]'] = args.filter_ids.join(','); if (args.page) query.page = args.page; const results: unknown[] = []; let nextUrl: string | undefined; let page = args.page; do { const res = await client.get<unknown>(path, page ? { ...query, page } : query); results.push(res.data); const next = res.links?.next; if (args.auto_paginate && next) { 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 }; } - src/tools/rest/apm.ts:4-12 (schema)Type definition `ListApplicationsArgs` for the tool's input arguments (filters, page, auto_paginate, region).
type ListApplicationsArgs = { filter_name?: string; filter_host?: string; filter_ids?: number[]; filter_language?: string; page?: number; auto_paginate?: boolean; region?: Region; }; - src/tools/rest/apm.ts:21-36 (schema)The `getListApplicationsTool` method returns the Tool definition with name 'list_apm_applications_rest' and inputSchema (type definitions for each argument).
return { name: 'list_apm_applications_rest', description: 'List APM applications via REST v2.', inputSchema: { type: 'object', properties: { filter_name: { type: 'string' }, filter_host: { type: 'string' }, filter_ids: { type: 'array', items: { type: 'number' } }, filter_language: { type: 'string' }, page: { type: 'number' }, auto_paginate: { type: 'boolean' }, region: { type: 'string', enum: ['US', 'EU'] }, }, }, }; - src/server.ts:84-84 (registration)Tool registration: `restApm.getListApplicationsTool()` is added to the tools map during `registerTools()`.
restApm.getListApplicationsTool(), - src/server.ts:187-190 (registration)The `executeTool` switch-case dispatches 'list_apm_applications_rest' to `new RestApmTool().listApplications(args)`.
case 'list_apm_applications_rest': return await new RestApmTool().listApplications( args as Parameters<RestApmTool['listApplications']>[0] );