Skip to main content
Glama

UpdateLocalMacros

Update local macros in ABAP classes by managing lock, check, update, and unlock processes. Optionally activate the class after updating.

Instructions

Update local macros in an ABAP class (macros include). Manages lock, check, update, unlock, and optional activation. Note: Macros are supported in older ABAP versions but not in newer ones.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
class_nameYesParent class name (e.g., ZCL_MY_CLASS).
macros_codeYesUpdated source code for local macros.
transport_requestNoTransport request number.
activate_on_updateNoActivate parent class after updating. Default: false

Implementation Reference

  • Handler function handleUpdateLocalMacros that executes the UpdateLocalMacros tool logic, including lock, update, unlock, and optional activation via AdtClient.getLocalMacros().update().
    /**
     * UpdateLocalMacros Handler - Update Local Macros via AdtClient
     */
    
    import { createAdtClient } from '../../../lib/clients';
    import type { HandlerContext } from '../../../lib/handlers/interfaces';
    import {
      type AxiosResponse,
      extractAdtErrorMessage,
      return_error,
      return_response,
    } from '../../../lib/utils';
    
    export const TOOL_DEFINITION = {
      name: 'UpdateLocalMacros',
      available_in: ['onprem', 'cloud', 'legacy'] as const,
      description:
        'Update local macros in an ABAP class (macros include). Manages lock, check, update, unlock, and optional activation. Note: Macros are supported in older ABAP versions but not in newer ones.',
      inputSchema: {
        type: 'object',
        properties: {
          class_name: {
            type: 'string',
            description: 'Parent class name (e.g., ZCL_MY_CLASS).',
          },
          macros_code: {
            type: 'string',
            description: 'Updated source code for local macros.',
          },
          transport_request: {
            type: 'string',
            description: 'Transport request number.',
          },
          activate_on_update: {
            type: 'boolean',
            description: 'Activate parent class after updating. Default: false',
            default: false,
          },
        },
        required: ['class_name', 'macros_code'],
      },
    } as const;
    
    interface UpdateLocalMacrosArgs {
      class_name: string;
      macros_code: string;
      transport_request?: string;
      activate_on_update?: boolean;
    }
    
    export async function handleUpdateLocalMacros(
      context: HandlerContext,
      args: UpdateLocalMacrosArgs,
    ) {
      const { connection, logger } = context;
      try {
        const {
          class_name,
          macros_code,
          transport_request,
          activate_on_update = false,
        } = args as UpdateLocalMacrosArgs;
    
        if (!class_name || !macros_code) {
          return return_error(new Error('class_name and macros_code are required'));
        }
    
        const client = createAdtClient(connection, logger);
        const className = class_name.toUpperCase();
    
        logger?.info(`Updating local macros for ${className}`);
    
        try {
          const localMacros = client.getLocalMacros();
          const updateResult = await localMacros.update(
            {
              className,
              macrosCode: macros_code,
              transportRequest: transport_request,
            },
            { activateOnUpdate: activate_on_update },
          );
    
          if (!updateResult) {
            throw new Error(`Update did not return a result for ${className}`);
          }
    
          logger?.info(`✅ UpdateLocalMacros completed successfully: ${className}`);
    
          return return_response({
            data: JSON.stringify(
              {
                success: true,
                class_name: className,
                transport_request: transport_request || null,
                activated: activate_on_update,
                message: `Local macros updated successfully in ${className}.`,
              },
              null,
              2,
            ),
          } as AxiosResponse);
        } catch (error: any) {
          logger?.error(
            `Error updating local macros for ${className}: ${error?.message || error}`,
          );
    
          const detailedError = extractAdtErrorMessage(
            error,
            `Failed to update local macros in ${className}`,
          );
          let errorMessage = `Failed to update local macros: ${detailedError}`;
    
          if (error.response?.status === 404) {
            errorMessage = `Local macros for ${className} not found.`;
          } else if (error.response?.status === 423) {
            errorMessage = `Class ${className} is locked by another user.`;
          }
    
          return return_error(new Error(errorMessage));
        }
      } catch (error: any) {
        return return_error(error);
      }
    }
  • Input schema and tool definition for UpdateLocalMacros, with properties: class_name, macros_code, transport_request, and activate_on_update.
    export const TOOL_DEFINITION = {
      name: 'UpdateLocalMacros',
      available_in: ['onprem', 'cloud', 'legacy'] as const,
      description:
        'Update local macros in an ABAP class (macros include). Manages lock, check, update, unlock, and optional activation. Note: Macros are supported in older ABAP versions but not in newer ones.',
      inputSchema: {
        type: 'object',
        properties: {
          class_name: {
            type: 'string',
            description: 'Parent class name (e.g., ZCL_MY_CLASS).',
          },
          macros_code: {
            type: 'string',
            description: 'Updated source code for local macros.',
          },
          transport_request: {
            type: 'string',
            description: 'Transport request number.',
          },
          activate_on_update: {
            type: 'boolean',
            description: 'Activate parent class after updating. Default: false',
            default: false,
          },
        },
        required: ['class_name', 'macros_code'],
      },
    } as const;
  • TypeScript interface UpdateLocalMacrosArgs defining the expected arguments.
    interface UpdateLocalMacrosArgs {
      class_name: string;
      macros_code: string;
      transport_request?: string;
      activate_on_update?: boolean;
    }
  • Import of handleUpdateLocalMacros and TOOL_DEFINITION as UpdateLocalMacros_Tool into the HighLevelHandlersGroup.
    import {
      handleUpdateLocalMacros,
      TOOL_DEFINITION as UpdateLocalMacros_Tool,
    } from '../../../handlers/class/high/handleUpdateLocalMacros';
  • Registration of UpdateLocalMacros_Tool with handler handleUpdateLocalMacros in the tool handler group.
    {
      toolDefinition: UpdateLocalMacros_Tool,
      handler: withContext(handleUpdateLocalMacros),
    },
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Discloses the update process (lock, check, update, unlock, optional activation) and the version support note. No annotations provided, so description handles transparency well.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two efficient sentences, front-loaded with purpose, no waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Covers key behavioral aspects and version context. No output schema, but description is sufficient for a simple update tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%. Description adds minimal extra meaning beyond schema, only clarifying 'macros include'. Baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states the verb 'Update' and the resource 'local macros in an ABAP class'. Differentiates from siblings like DeleteLocalMacros and GetLocalMacros.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Implies usage with the note about older ABAP versions but lacks explicit when-to-use vs alternatives or when-not-to-use.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/fr0ster/mcp-abap-adt'

If you have feedback or need assistance with the MCP directory API, please join our Discord server