Skip to main content
Glama

GetTypeInfo

Retrieve ABAP type metadata for domains, data elements, table types, and structures, including field definitions and value ranges.

Instructions

[read-only] Retrieve ABAP type information for domains (DOMA), data elements (DTEL), table types, and structures. Returns field definitions, value ranges, fixed values, and DDIC metadata.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
type_nameYesName of the ABAP type
include_structure_fallbackNoWhen true (default), tries DDIC structure lookup only if type lookup returns 404/empty.

Implementation Reference

  • Main handler function for GetTypeInfo tool. Accepts type_name and optional include_structure_fallback, tries multiple ADT endpoint lookups (domain, data element, table type, repository info system), and falls back to structure lookup. Returns JSON content with type metadata.
    export async function handleGetTypeInfo(context: HandlerContext, args: any) {
      const { connection, logger } = context;
      const includeStructureFallback = args?.include_structure_fallback !== false;
      try {
        if (!args?.type_name) {
          throw new McpError(ErrorCode.InvalidParams, 'Type name is required');
        }
      } catch (error) {
        logger?.error('Invalid parameters for GetTypeInfo', error as any);
        // MCP-compliant error response: always return content[] with type "text"
        return {
          isError: true,
          content: [
            {
              type: 'text',
              text: `ADT error: ${String(error)}`,
            },
          ],
        };
      }
    
      try {
        const typeName = args.type_name;
        const encodedTypeName = encodeSapObjectName(typeName);
        const uri = encodeURIComponent(
          `/sap/bc/adt/ddic/domains/${typeName.toLowerCase()}`,
        );
    
        const lookups: Array<{
          label: string;
          url: string;
          parseFn: (xml: string) => any;
        }> = [
          {
            label: 'domain',
            url: `/sap/bc/adt/ddic/domains/${encodedTypeName}/source/main`,
            parseFn: parseTypeInfoXml,
          },
          {
            label: 'data element',
            url: `/sap/bc/adt/ddic/dataelements/${encodedTypeName}`,
            parseFn: parseTypeInfoXml,
          },
          {
            label: 'table type',
            url: `/sap/bc/adt/ddic/tabletypes/${encodedTypeName}`,
            parseFn: parseTypeInfoXml,
          },
          {
            label: 'repository information system',
            url: `/sap/bc/adt/repository/informationsystem/objectproperties/values?uri=${uri}`,
            parseFn: parseTypeInfoXml,
          },
        ];
    
        for (const lookup of lookups) {
          logger?.debug(`Trying ${lookup.label} lookup for ${typeName}`);
          const result = await tryLookup(connection, lookup.url, lookup.parseFn);
          if (result.status === 'ok') {
            const mcpResult = {
              isError: false,
              content: [{ type: 'json', json: result.payload }],
            };
            objectsListCache.setCache(mcpResult);
            return mcpResult;
          }
        }
    
        if (includeStructureFallback) {
          logger?.debug(
            `Type lookups returned 404/empty for ${typeName}, trying structure fallback`,
          );
          const structureResult = await tryLookup(
            connection,
            `/sap/bc/adt/ddic/structures/${encodedTypeName}`,
            parseStructureInfoXml,
          );
          if (structureResult.status === 'ok') {
            const mcpResult = {
              isError: false,
              content: [{ type: 'json', json: structureResult.payload }],
            };
            objectsListCache.setCache(mcpResult);
            return mcpResult;
          }
        }
    
        return {
          isError: true,
          content: [
            {
              type: 'text',
              text: `Type ${typeName} was not found as domain, data element, table type, or structure.`,
            },
          ],
        };
      } catch (error) {
        logger?.error(
          `Failed to resolve type info for ${args.type_name}`,
          error as any,
        );
        return {
          isError: true,
          content: [
            {
              type: 'text',
              text: `ADT error: ${String(error)}`,
            },
          ],
        };
      }
    }
  • TOOL_DEFINITION export containing the tool name 'GetTypeInfo', description, and inputSchema with type_name (required string) and include_structure_fallback (optional boolean, default true).
    export const TOOL_DEFINITION = {
      name: 'GetTypeInfo',
      available_in: ['onprem', 'cloud'] as const,
      description:
        '[read-only] Retrieve ABAP type information for domains (DOMA), data elements (DTEL), table types, and structures. Returns field definitions, value ranges, fixed values, and DDIC metadata.',
      inputSchema: {
        type: 'object',
        properties: {
          type_name: {
            type: 'string',
            description: 'Name of the ABAP type',
          },
          include_structure_fallback: {
            type: 'boolean',
            description:
              'When true (default), tries DDIC structure lookup only if type lookup returns 404/empty.',
            default: true,
          },
        },
        required: ['type_name'],
      },
    } as const;
  • Registration of GetTypeInfo within SystemHandlersGroup.getHandlers(). Maps GetTypeInfo_Tool definition to handler wrapped with context.
    getHandlers(): HandlerEntry[] {
      return [
        {
          toolDefinition: GetTypeInfo_Tool,
          handler: (args: any) => handleGetTypeInfo(this.context, args),
        },
  • Import of TOOL_DEFINITION (as GetTypeInfo_Tool) and handleGetTypeInfo from the handler file.
    import {
      TOOL_DEFINITION as GetTypeInfo_Tool,
      handleGetTypeInfo,
    } from '../../../handlers/system/readonly/handleGetTypeInfo';
  • Helper functions parseTypeInfoXml and parseStructureInfoXml that parse ADT XML responses for domains, data elements, table types, and structures.
    function parseTypeInfoXml(xml: string) {
      const parser = new XMLParser({
        ignoreAttributes: false,
        attributeNamePrefix: '',
        parseAttributeValue: true,
        trimValues: true,
      });
      const result = parser.parse(xml);
    
      // Data Element (DTEL/DE)
      if (result['blue:wbobj']?.['dtel:dataElement']) {
        const wb = result['blue:wbobj'];
        const dtel = wb['dtel:dataElement'];
        return {
          name: wb['adtcore:name'],
          objectType: 'data_element',
          description: wb['adtcore:description'],
          dataType: dtel['dtel:dataType'],
          length: parseInt(dtel['dtel:dataTypeLength'], 10),
          decimals: parseInt(dtel['dtel:dataTypeDecimals'], 10),
          domain: dtel['dtel:typeName'],
          package: wb['adtcore:packageRef']?.['adtcore:name'] || null,
          labels: {
            short: dtel['dtel:shortFieldLabel'],
            medium: dtel['dtel:mediumFieldLabel'],
            long: dtel['dtel:longFieldLabel'],
            heading: dtel['dtel:headingFieldLabel'],
          },
        };
      }
    
      // Domain (DOMA/DD) via repository informationsystem
      if (result['opr:objectProperties']?.['opr:object']) {
        const obj = result['opr:objectProperties']['opr:object'];
        return {
          name: obj.name,
          objectType: 'domain',
          description: obj.text,
          package: obj.package,
          type: obj.type,
        };
      }
    
      // Table Type (not implemented, fallback)
      return { raw: result };
    }
    
    function parseStructureInfoXml(xml: string) {
      const parser = new XMLParser({
        ignoreAttributes: false,
        attributeNamePrefix: '',
        parseAttributeValue: true,
        trimValues: true,
      });
      const result = parser.parse(xml);
      const wb = result['blue:wbobj'] || {};
    
      return {
        name: wb['adtcore:name'] || null,
        objectType: 'structure',
        description: wb['adtcore:description'] || null,
        package: wb['adtcore:packageRef']?.['adtcore:name'] || null,
        resolved_as: 'structure_fallback',
        raw: result,
      };
    }
Behavior3/5

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

No annotations are provided, so the description carries full burden. It declares read-only behavior via '[read-only]' and lists return contents, but lacks details on potential side effects, permission requirements, or performance implications. This meets basic transparency but could be more informative.

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 a single sentence with a leading '[read-only]' tag, followed by a concise list of retrieval targets and return contents. No redundant or unnecessary information. Front-loaded with key constraints.

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?

No output schema is provided, so the description compensates by listing return types (field definitions, value ranges, etc.). It adequately describes what the tool does and returns, but lacks examples or format details. For a retrieval tool, it is mostly complete.

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?

Both parameters are fully described in the input schema (100% coverage). The description adds context about the type_name being an ABAP type and the include_structure_fallback behavior, but this is already covered in the schema descriptions. No significant additional meaning beyond the schema.

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 is a read-only retrieval tool for ABAP type information, specifying the exact categories (domains, data elements, table types, structures) and what it returns (field definitions, value ranges, fixed values, DDIC metadata). This distinguishes it from sibling 'Get' tools that target single object types like GetClass or GetDomain.

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 implies usage for retrieving type info but does not provide explicit guidance on when to use this tool over more specific siblings like GetDomain or GetDataElement. No when-not-to-use or alternative recommendations are given.

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