get_function_module
Retrieve the source code of an SAP function module by specifying its function group and name. Optionally target a specific SAP system ID.
Instructions
Fetch function module source code from SAP system
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| function_group | Yes | Function group name (e.g. 2032) | |
| function_name | Yes | Function module name (e.g. SD_SALESDOCUMENT_CREATE) | |
| system_id | No | SAP system ID (e.g. DEV). Omit to use default system. |
Implementation Reference
- src/mcp-server.ts:218-230 (registration)Registration of the get_function_module tool in the MCP tool list with its name, description, and input schema.
{ name: "get_function_module", description: "Fetch function module source code from SAP system", inputSchema: { type: "object" as const, properties: { function_group: { type: "string", description: "Function group name (e.g. 2032)" }, function_name: { type: "string", description: "Function module name (e.g. SD_SALESDOCUMENT_CREATE)" }, ...SYSTEM_ID_PROP, }, required: ["function_group", "function_name"], }, }, - src/mcp-server.ts:14-17 (schema)Zod schema for validating the function_group and function_name input parameters for get_function_module.
const FunctionModuleSchema = z.object({ function_group: z.string(), function_name: z.string(), }); - src/mcp-server.ts:1015-1021 (handler)Handler logic for get_function_module: parses the function_group and function_name, constructs the SAP ADT REST URL for function module source, and returns the source code.
case "get_function_module": { const { function_group, function_name } = FunctionModuleSchema.parse(args); const source = await client.getSource( `/sap/bc/adt/functions/groups/${encodeURIComponent(function_group.toUpperCase())}/fmodules/${encodeURIComponent(function_name.toUpperCase())}/source/main` ); return { content: [{ type: "text", text: source }] }; }