Skip to main content
Glama

GetDataElement

Retrieve ABAP data element definitions, supporting both active and inactive versions.

Instructions

Retrieve ABAP data element definition. Supports reading active or inactive version.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
data_element_nameYesData element name (e.g., Z_MY_DATA_ELEMENT).
versionNoVersion to read: "active" (default) for deployed version, "inactive" for modified but not activated version.active

Implementation Reference

  • Main handler function for GetDataElement tool. Uses AdtClient.getDataElement().read() to retrieve a data element by name, supporting both 'active' and 'inactive' versions. Validates input, calls the ADT client, and returns the data element definition.
    export async function handleGetDataElement(
      context: HandlerContext,
      args: GetDataElementArgs,
    ) {
      const { connection, logger } = context;
      try {
        const { data_element_name, version = 'active' } =
          args as GetDataElementArgs;
    
        // Validation
        if (!data_element_name) {
          return return_error(new Error('data_element_name is required'));
        }
    
        const client = createAdtClient(connection, logger);
        const dataElementName = data_element_name.toUpperCase();
    
        logger?.info(
          `Reading data element ${dataElementName}, version: ${version}`,
        );
    
        try {
          // Read data element using AdtClient
          const dataElementObject = client.getDataElement();
          const readResult = await dataElementObject.read(
            { dataElementName },
            version as 'active' | 'inactive',
          );
    
          if (!readResult || !readResult.readResult) {
            throw new Error(`Data element ${dataElementName} not found`);
          }
    
          // Extract data from read result
          const dataElementData =
            typeof readResult.readResult.data === 'string'
              ? readResult.readResult.data
              : JSON.stringify(readResult.readResult.data);
    
          logger?.info(
            `✅ GetDataElement completed successfully: ${dataElementName}`,
          );
    
          return return_response({
            data: JSON.stringify(
              {
                success: true,
                data_element_name: dataElementName,
                version,
                data_element_data: dataElementData,
                status: readResult.readResult.status,
                status_text: readResult.readResult.statusText,
              },
              null,
              2,
            ),
          } as AxiosResponse);
        } catch (error: any) {
          logger?.error(
            `Error reading data element ${dataElementName}: ${error?.message || error}`,
          );
    
          // Parse error message
          let errorMessage = `Failed to read data element: ${error.message || String(error)}`;
    
          if (error.response?.status === 404) {
            errorMessage = `Data element ${dataElementName} not found.`;
          } else if (error.response?.status === 423) {
            errorMessage = `Data element ${dataElementName} is locked by another user.`;
          }
    
          return return_error(new Error(errorMessage));
        }
      } catch (error: any) {
        return return_error(error);
      }
    }
  • Tool definition (TOOL_DEFINITION) including name 'GetDataElement', availability ('onprem','cloud'), description, and inputSchema with required 'data_element_name' string and optional 'version' enum ('active'/'inactive').
    export const TOOL_DEFINITION = {
      name: 'GetDataElement',
      available_in: ['onprem', 'cloud'] as const,
      description:
        'Retrieve ABAP data element definition. Supports reading active or inactive version.',
      inputSchema: {
        type: 'object',
        properties: {
          data_element_name: {
            type: 'string',
            description: 'Data element name (e.g., Z_MY_DATA_ELEMENT).',
          },
          version: {
            type: 'string',
            enum: ['active', 'inactive'],
            description:
              'Version to read: "active" (default) for deployed version, "inactive" for modified but not activated version.',
            default: 'active',
          },
        },
        required: ['data_element_name'],
      },
    } as const;
  • TypeScript interface GetDataElementArgs defining the structure of input arguments (data_element_name: string, version?: 'active' | 'inactive').
    interface GetDataElementArgs {
      data_element_name: string;
      version?: 'active' | 'inactive';
    }
  • Registration of handleGetDataElement as the 'get' handler for DATA_ELEMENT in the compact router map, enabling dispatch for the GetDataElement tool.
    DATA_ELEMENT: {
      create: handleCreateDataElement as unknown as CompactHandler,
      get: handleGetDataElement as unknown as CompactHandler,
      update: handleUpdateDataElement as unknown as CompactHandler,
      delete: handleDeleteDataElement as unknown as CompactHandler,
    },
  • Import statement pulling handleGetDataElement into the compact router for registration.
    import { handleGetDataElement } from '../../data_element/high/handleGetDataElement';
Behavior3/5

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

No annotations are provided, so the description must carry the burden. It mentions version support but does not disclose whether the operation is read-only, what happens on missing elements, or response structure. Adequate but minimal.

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?

The description is concise, with two sentences that front-load the core purpose and add the version feature. No superfluous text.

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?

Given the tool's simplicity (2 params, no output schema), the description covers the essential behavior (retrieve and version). It lacks mention of return value structure but is mostly complete for a basic GET operation.

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% for both parameters, and the description adds no additional meaning beyond the schema definitions. The baseline score applies.

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?

The description clearly states it retrieves an ABAP data element definition and supports version selection. This differentiates it from sibling tools like CreateDataElement or DeleteDataElement.

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?

The description does not provide explicit guidance on when to use this tool versus alternatives, nor does it mention prerequisites. It only states the version option, which implies usage context but lacks comparison with other GET tools.

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