Skip to main content
Glama

GetLocalTypes

Retrieve local types source code from a class, including implementations. Supports reading active or inactive version.

Instructions

Retrieve local types source code from a class (implementations include). Supports reading active or inactive version.

Input Schema

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

Implementation Reference

  • Main handler function `handleGetLocalTypes` that reads local types from an ABAP class via AdtClient.getLocalTypes().read(). Validates class_name, supports active/inactive versions, and returns the source code.
    export async function handleGetLocalTypes(
      context: HandlerContext,
      args: GetLocalTypesArgs,
    ) {
      const { connection, logger } = context;
      try {
        const { class_name, version = 'active' } = args as GetLocalTypesArgs;
    
        if (!class_name) {
          return return_error(new Error('class_name is required'));
        }
    
        const client = createAdtClient(connection, logger);
        const className = class_name.toUpperCase();
    
        logger?.info(`Reading local types for ${className}, version: ${version}`);
    
        try {
          const localTypes = client.getLocalTypes();
          const readResult = await localTypes.read(
            { className },
            version as 'active' | 'inactive',
          );
    
          if (!readResult || !readResult.readResult) {
            throw new Error(`Local types for ${className} not found`);
          }
    
          const sourceCode =
            typeof readResult.readResult.data === 'string'
              ? readResult.readResult.data
              : JSON.stringify(readResult.readResult.data);
    
          logger?.info(`✅ GetLocalTypes completed successfully: ${className}`);
    
          return return_response({
            data: JSON.stringify(
              {
                success: true,
                class_name: className,
                version,
                local_types_code: sourceCode,
                status: readResult.readResult.status,
              },
              null,
              2,
            ),
          } as AxiosResponse);
        } catch (error: any) {
          const status = error?.response?.status;
          const url = error?.response?.config?.url;
          const rawData = error?.response?.data;
          const responseSnippet =
            typeof rawData === 'string' ? rawData.slice(0, 800) : rawData;
          logger?.warn(
            `GetLocalTypes failed (HTTP ${status ?? 'unknown'}) for ${className}${url ? ` at ${url}` : ''}`,
            responseSnippet ? { response: responseSnippet } : undefined,
          );
          logger?.error(
            `Error reading local types for ${className}: ${error?.message || error}`,
          );
    
          let errorMessage = `Failed to read local types: ${error.message || String(error)}`;
    
          if (error.response?.status === 404) {
            errorMessage = `Local types for ${className} not found.`;
          } else if (error.response?.status === 423) {
            errorMessage = `Class ${className} is locked by another user.`;
          } else if (error.response?.status === 406) {
            const status = error?.response?.status;
            const url = error?.response?.config?.url;
            const rawData = error?.response?.data;
            const responseSnippet =
              typeof rawData === 'string' ? rawData.slice(0, 800) : rawData;
            errorMessage = `Local types read not supported on this system (HTTP ${status}). ${url ? `URL: ${url}. ` : ''}${responseSnippet ? `Response: ${typeof responseSnippet === 'string' ? responseSnippet : JSON.stringify(responseSnippet)}` : ''}`;
          }
    
          return return_error(new Error(errorMessage));
        }
      } catch (error: any) {
        return return_error(error);
      }
    }
  • TOOL_DEFINITION constant defining the 'GetLocalTypes' tool with inputSchema (class_name required, version optional with active/inactive enum).
    export const TOOL_DEFINITION = {
      name: 'GetLocalTypes',
      available_in: ['onprem', 'cloud', 'legacy'] as const,
      description:
        'Retrieve local types source code from a class (implementations include). Supports reading active or inactive version.',
      inputSchema: {
        type: 'object',
        properties: {
          class_name: {
            type: 'string',
            description: 'Parent class name (e.g., ZCL_MY_CLASS).',
          },
          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: ['class_name'],
      },
    } as const;
  • Import of TOOL_DEFINITION and handleGetLocalTypes from the handler file.
    import {
      TOOL_DEFINITION as GetLocalTypes_Tool,
      handleGetLocalTypes,
    } from '../../../handlers/class/high/handleGetLocalTypes';
  • Registration of GetLocalTypes_Tool and handleGetLocalTypes in the high-level handlers group (toolDefinition/handler pair).
    {
      toolDefinition: GetLocalTypes_Tool,
      handler: withContext(handleGetLocalTypes),
    },
  • Registration of handleGetLocalTypes in the compact router under LOCAL_TYPES.get.
    LOCAL_TYPES: {
      get: handleGetLocalTypes as unknown as CompactHandler,
      update: handleUpdateLocalTypes as unknown as CompactHandler,
      delete: handleDeleteLocalTypes as unknown as CompactHandler,
    },
Behavior2/5

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

With no annotations, the description bears full responsibility for behavioral transparency. It mentions that implementations are included and version support, but omits details on authentication needs, error handling, or return format. The tool's read-only nature is implicit but not assured.

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: two sentences that front-load the purpose and key feature (version support). Every word earns its place with no superfluous information.

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

Completeness3/5

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

For a simple tool with 2 parameters and no output schema, the description is adequate but not thorough. It explains what is retrieved and version support, but does not specify the output format or any error scenarios, which would help prevent misuse.

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%, so baseline is 3. The description adds 'implementations include' which provides extra context for what the source code contains, but does not significantly enhance parameter understanding beyond the schema's own descriptions.

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

Purpose4/5

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

The description clearly states the tool retrieves local types source code from a class and includes implementations. It specifies the resource and verb, distinguishing from siblings like GetLocalDefinitions which retrieve other definitions. However, it could be more explicit about differentiating from similar tools.

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

Usage Guidelines2/5

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

No usage guidelines are provided. The description does not indicate when to use this tool versus alternatives like GetLocalDefinitions, GetLocalMacros, or UpdateLocalTypes. It only mentions version support but no context for appropriate 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