GetTransaction
Retrieve details of an ABAP transaction (t-code) to identify its program, screen, authorization object, and transaction type for analysis or documentation.
Instructions
[read-only] Retrieve ABAP transaction (t-code) details — program, screen, authorization object, and transaction type (dialog, report, OO).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| transaction_name | Yes | Name of the ABAP transaction |
Implementation Reference
- The main handler function for the GetTransaction tool. It takes a HandlerContext and args, logs, and returns a placeholder 'Not implemented' response. The real implementation (with ADT client calls) is commented out.
export async function handleGetTransaction( context: HandlerContext, _args: any, ) { const { connection, logger } = context; // try { // if (!args?.transaction_name) { // throw new McpError(ErrorCode.InvalidParams, 'Transaction name is required'); // } // logger?.info(`Fetching transaction info for ${args.transaction_name}`); // const client = createAdtClient(connection, logger); // const result = await client.readTransaction(args.transaction_name); // return result; // } catch (error) { // logger?.error(`Failed to fetch transaction ${args?.transaction_name}`, error as any); // // MCP-compliant error response: always return content[] with type "text" // return { // isError: true, // content: [ // { // type: "text", // text: `ADT error: ${String(error)}` // } // ] // }; // } return { isError: false, content: [{ type: 'json', json: { message: 'Not implemented' } }], }; } - The TOOL_DEFINITION export contains the tool name 'GetTransaction', description, and inputSchema (requires a 'transaction_name' string property).
export const TOOL_DEFINITION = { name: 'GetTransaction', available_in: ['onprem', 'cloud'] as const, description: '[read-only] Retrieve ABAP transaction (t-code) details — program, screen, authorization object, and transaction type (dialog, report, OO).', inputSchema: { type: 'object', properties: { transaction_name: { type: 'string', description: 'Name of the ABAP transaction', }, }, required: ['transaction_name'], }, } as const; - src/lib/handlers/groups/SystemHandlersGroup.ts:128-131 (registration)Registration of GetTransaction in the SystemHandlersGroup: binds GetTransaction_Tool to handleGetTransaction.
{ toolDefinition: GetTransaction_Tool, handler: (args: any) => handleGetTransaction(this.context, args), }, - Helper function _parseTransactionXml that parses XML (ADT transaction XML format) into a structured object with name, objectType, description, package, type.
function _parseTransactionXml(xml: string) { const parser = new XMLParser({ ignoreAttributes: false, attributeNamePrefix: '', parseAttributeValue: true, trimValues: true, }); const result = parser.parse(xml); // ADT Transaction XML (opr:objectProperties) if (result['opr:objectProperties']?.['opr:object']) { const obj = result['opr:objectProperties']['opr:object']; return { name: obj.name, objectType: 'transaction', description: obj.text, package: obj.package, type: obj.type, }; } // fallback: return raw return { raw: result }; }