GetObjectsList
Retrieves a recursive list of all child ABAP repository objects for a specified parent object, including nested subcomponents.
Instructions
[read-only] Recursively retrieves all child ABAP repository objects for a given parent — programs (PROG), function groups (FUGR), classes (CLAS), packages (DEVC), and other composite objects — including nested includes and subcomponents.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| parent_name | Yes | [read-only] Parent object name | |
| parent_tech_name | Yes | [read-only] Parent technical name | |
| parent_type | Yes | [read-only] Parent object type (e.g. PROG/P, FUGR) | |
| with_short_descriptions | No | [read-only] Include short descriptions (default: true) |
Implementation Reference
- The main handler function for GetObjectsList. It validates input parameters, creates an ADT client, recursively traverses ADT node structure starting from root node_id '000000', collects all valid objects, caches the result, and returns formatted JSON content.
export async function handleGetObjectsList(context: HandlerContext, args: any) { const { connection, logger } = context; try { const { parent_name, parent_tech_name, parent_type, with_short_descriptions, } = args; if ( !parent_name || typeof parent_name !== 'string' || parent_name.trim() === '' ) { throw new McpError( ErrorCode.InvalidParams, 'Parameter "parent_name" (string) is required and cannot be empty.', ); } if ( !parent_tech_name || typeof parent_tech_name !== 'string' || parent_tech_name.trim() === '' ) { throw new McpError( ErrorCode.InvalidParams, 'Parameter "parent_tech_name" (string) is required and cannot be empty.', ); } if ( !parent_type || typeof parent_type !== 'string' || parent_type.trim() === '' ) { throw new McpError( ErrorCode.InvalidParams, 'Parameter "parent_type" (string) is required and cannot be empty.', ); } const withDescriptions = with_short_descriptions !== undefined ? Boolean(with_short_descriptions) : true; // Create AdtClient and get utilities const client = createAdtClient(connection, logger); const utils = client.getUtils(); // Begin traversal from node_id '000000' (the root node) const objects = await collectValidObjectsStrict( utils, parent_name.toUpperCase(), parent_type, '000000', withDescriptions, new Set(), ); // Format the aggregated data as JSON const result = { parent_name, parent_tech_name, parent_type, total_objects: objects.length, objects, }; // Persist the result inside the in-memory cache objectsListCache.setCache(result); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], // Expose the cache snapshot for potential reuse by other modules cache: objectsListCache.getCache(), }; } catch (error) { // MCP-compliant error response: always return content[] with type "text" return { isError: true, content: [ { type: 'text', text: `ADT error: ${String(error)}`, }, ], }; } } - TOOL_DEFINITION for GetObjectsList - defines the tool name, availability (onprem/cloud), description, and input schema with required parameters (parent_name, parent_tech_name, parent_type) and optional with_short_descriptions.
export const TOOL_DEFINITION = { name: 'GetObjectsList', available_in: ['onprem', 'cloud'] as const, description: '[read-only] Recursively retrieves all child ABAP repository objects for a given parent — programs (PROG), function groups (FUGR), classes (CLAS), packages (DEVC), and other composite objects — including nested includes and subcomponents.', inputSchema: { type: 'object', properties: { parent_name: { type: 'string', description: '[read-only] Parent object name', }, parent_tech_name: { type: 'string', description: '[read-only] Parent technical name', }, parent_type: { type: 'string', description: '[read-only] Parent object type (e.g. PROG/P, FUGR)', }, with_short_descriptions: { type: 'boolean', description: '[read-only] Include short descriptions (default: true)', }, }, required: ['parent_name', 'parent_tech_name', 'parent_type'], }, } as const; - src/lib/handlers/groups/SearchHandlersGroup.ts:35-43 (registration)Registration of GetObjectsList as a handler entry in SearchHandlersGroup, binding the TOOL_DEFINITION to the handleGetObjectsList function.
{ toolDefinition: GetObjectsList_Tool, handler: (args: any) => { return handleGetObjectsList( this.context, args as { object_type: string }, ); }, }, - src/lib/getObjectsListCache.ts:1-21 (helper)In-memory cache singleton for GetObjectsList results, used to store and retrieve cached object list data between handler invocations.
// In-memory cache for GetObjectsList type ObjectsListCacheType = any | null; class ObjectsListCache { private cache: ObjectsListCacheType = null; setCache(data: any) { this.cache = data; } getCache(): ObjectsListCacheType { return this.cache; } clearCache() { this.cache = null; } } export const objectsListCache = new ObjectsListCache();