GetInclude
Need the source code of an ABAP include? Provide the include name to retrieve it.
Instructions
[read-only] Retrieve source code of a specific ABAP include file.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| include_name | Yes | Name of the ABAP Include |
Implementation Reference
- Main handler function that fetches an ABAP include's source code via ADT REST API and returns it as text content.
export async function handleGetInclude(context: HandlerContext, args: any) { const { connection, logger } = context; try { if (!args?.include_name) { throw new McpError(ErrorCode.InvalidParams, 'Include name is required'); } const url = `/sap/bc/adt/programs/includes/${encodeSapObjectName(args.include_name)}/source/main`; logger?.info(`Fetching include: ${args.include_name}`); const response = await makeAdtRequestWithTimeout( connection, url, 'GET', 'default', ); const plainText = response.data; if (args.filePath) { writeResultToFile(plainText, args.filePath); } logger?.info(`✅ GetInclude completed: ${args.include_name}`); return { isError: false, content: [ { type: 'text', text: plainText, }, ], }; } catch (error) { logger?.error( `Error getting include ${args?.include_name ?? ''}: ${error instanceof Error ? error.message : String(error)}`, ); return { isError: true, content: [ { type: 'text', text: error instanceof Error ? error.message : String(error), }, ], }; } } - Tool definition/schema for GetInclude, specifying name, availability, description, and input schema with include_name as required string.
export const TOOL_DEFINITION = { name: 'GetInclude', available_in: ['onprem', 'cloud', 'legacy'] as const, description: '[read-only] Retrieve source code of a specific ABAP include file.', inputSchema: { include_name: z.string().describe('Name of the ABAP Include'), }, } as const; - src/lib/handlers/groups/ReadOnlyHandlersGroup.ts:157-160 (registration)Registration of the GetInclude tool in the ReadOnlyHandlersGroup, mapping the tool definition to its handler function.
{ toolDefinition: GetInclude_Tool, handler: (args: any) => handleGetInclude(this.context, args), },