GetClass
Retrieve ABAP class source code from SAP systems to access development artifacts for analysis or modification.
Instructions
Retrieve ABAP class source code
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| class_name | Yes | Name of the ABAP class |
Implementation Reference
- src/handlers/handleGetClass.ts:4-16 (handler)The main handler function that implements the logic for the GetClass tool. It fetches the source code of the specified ABAP class via the SAP ADT REST API.export async function handleGetClass(args: any) { try { if (!args?.class_name) { throw new McpError(ErrorCode.InvalidParams, 'Class name is required'); } const encodedClassName = encodeURIComponent(args.class_name); const url = `${await getBaseUrl()}/sap/bc/adt/oo/classes/${encodedClassName}/source/main`; const response = await makeAdtRequest(url, 'GET', 30000); return return_response(response); } catch (error) { return return_error(error); } }
- src/index.ts:118-131 (schema)The schema definition for the GetClass tool, including name, description, and input schema specifying the required 'class_name' parameter.{ name: 'GetClass', description: 'Retrieve ABAP class source code', inputSchema: { type: 'object', properties: { class_name: { type: 'string', description: 'Name of the ABAP class' } }, required: ['class_name'] } },
- src/index.ts:309-310 (registration)Registration of the GetClass handler in the tool dispatch switch statement within the CallToolRequest handler.case 'GetClass': return await handleGetClass(request.params.arguments);
- src/index.ts:15-15 (registration)Import statement registering the handleGetClass function for use in the MCP server.import { handleGetClass } from './handlers/handleGetClass';