GetPackage
Retrieve ABAP package details from SAP systems to access development artifacts and table structures for analysis and integration.
Instructions
Retrieve ABAP package details
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| package_name | Yes | Name of the ABAP package |
Implementation Reference
- src/handlers/handleGetPackage.ts:5-43 (handler)The handler function that executes the GetPackage tool: validates input, queries SAP ADT repository for package node structure, parses XML response, extracts object details, and returns JSON.export async function handleGetPackage(args: any) { try { if (!args?.package_name) { throw new McpError(ErrorCode.InvalidParams, 'Package name is required'); } const nodeContentsUrl = `${await getBaseUrl()}/sap/bc/adt/repository/nodestructure`; const encodedPackageName = encodeURIComponent(args.package_name); const nodeContentsParams = { parent_type: "DEVC/K", parent_name: encodedPackageName, withShortDescriptions: true }; const package_structure_response = await makeAdtRequest(nodeContentsUrl, 'POST', 30000, undefined, nodeContentsParams); const result = convert.xml2js(package_structure_response.data, {compact: true}); const nodes = result["asx:abap"]?.["asx:values"]?.DATA?.TREE_CONTENT?.SEU_ADT_REPOSITORY_OBJ_NODE || []; const extractedData = (Array.isArray(nodes) ? nodes : [nodes]).filter(node => node.OBJECT_NAME?._text && node.OBJECT_URI?._text ).map(node => ({ OBJECT_TYPE: node.OBJECT_TYPE._text, OBJECT_NAME: node.OBJECT_NAME._text, OBJECT_DESCRIPTION: node.DESCRIPTION?._text, OBJECT_URI: node.OBJECT_URI._text })); return { isError: false, content: [{ type: 'text', text: JSON.stringify(extractedData) }] }; } catch (error) { return return_error(error); } }
- src/index.ts:212-223 (schema)Input schema definition for the GetPackage tool in the ListTools response, requiring 'package_name' string.name: 'GetPackage', description: 'Retrieve ABAP package details', inputSchema: { type: 'object', properties: { package_name: { type: 'string', description: 'Name of the ABAP package' } }, required: ['package_name'] }
- src/index.ts:321-322 (registration)Dispatches calls to the GetPackage handler in the CallToolRequest switch statement.case 'GetPackage': return await handleGetPackage(request.params.arguments);
- src/index.ts:21-21 (registration)Import of the GetPackage handler function.import { handleGetPackage } from './handlers/handleGetPackage';