GetFunction
Retrieve ABAP Function Module source code by specifying the function name and group. This tool helps developers access and review ABAP development artifacts from SAP systems.
Instructions
Retrieve ABAP Function Module source code
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| function_name | Yes | Name of the function module | |
| function_group | Yes | Name of the function group |
Implementation Reference
- src/handlers/handleGetFunction.ts:4-17 (handler)The handler function that implements the GetFunction tool logic, fetching the source code of an ABAP function module from the SAP ADT API using the provided function name and group.export async function handleGetFunction(args: any) { try { if (!args?.function_name || !args?.function_group) { throw new McpError(ErrorCode.InvalidParams, 'Function name and group are required'); } const encodedFunctionName = encodeURIComponent(args.function_name); const encodedFunctionGroup = encodeURIComponent(args.function_group); const url = `${await getBaseUrl()}/sap/bc/adt/functions/groups/${encodedFunctionGroup}/fmodules/${encodedFunctionName}/source/main`; const response = await makeAdtRequest(url, 'GET', 30000); return return_response(response); } catch (error) { return return_error(error); } }
- src/index.ts:147-162 (schema)The input schema definition for the GetFunction tool, specifying required parameters: function_name and function_group.name: 'GetFunction', description: 'Retrieve ABAP Function Module source code', inputSchema: { type: 'object', properties: { function_name: { type: 'string', description: 'Name of the function module' }, function_group: { type: 'string', description: 'Name of the function group' } }, required: ['function_name', 'function_group'] }
- src/index.ts:311-312 (registration)Registration of the GetFunction tool handler in the CallToolRequest switch statement.case 'GetFunction': return await handleGetFunction(request.params.arguments);
- src/index.ts:17-17 (registration)Import statement for the GetFunction handler.import { handleGetFunction } from './handlers/handleGetFunction';