Skip to main content
Glama

GetObjectStructure

Retrieve any ADT object's structure as a compact JSON tree by specifying its type and name.

Instructions

[read-only] Retrieve ADT object structure as a compact JSON tree.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
objecttypeYesADT object type (e.g. DDLS/DF)
objectnameYesADT object name (e.g. /CBY/ACQ_DDL)

Implementation Reference

  • Main handler for GetObjectStructure tool. Calls ADT client's getObjectStructure, parses XML response into flat nodes, builds nested tree, and serializes to MCP-compatible text format.
    export async function handleGetObjectStructure(
      context: HandlerContext,
      args: {
        objecttype?: string;
        objectname?: string;
        object_type?: string;
        object_name?: string;
      },
    ) {
      const { connection, logger } = context;
      try {
        const objectType = args.objecttype ?? args.object_type;
        const objectName = args.objectname ?? args.object_name;
        if (!objectType || !objectName) {
          throw new Error(
            'objecttype/objectname (or object_type/object_name) are required',
          );
        }
    
        const client = createAdtClient(connection, logger);
        const response = await client
          .getUtils()
          .getObjectStructure(objectType, objectName);
        logger?.info(`Fetched object structure for ${objectType}/${objectName}`);
    
        // Parse XML response
        const parser = new XMLParser({
          ignoreAttributes: false,
          attributeNamePrefix: '',
        });
        const parsed = parser.parse(response.data);
    
        // Get flat node list
        let nodes = parsed['projectexplorer:objectstructure']?.[
          'projectexplorer:node'
        ] as FlatObjectStructureNode | FlatObjectStructureNode[] | undefined;
        if (!nodes) {
          return {
            isError: true,
            content: [
              {
                type: 'text',
                text: 'No nodes found in object structure response.',
              },
            ],
          };
        }
        // Ensure nodes is always an array
        if (!Array.isArray(nodes)) nodes = [nodes];
    
        // Build nested tree
        const tree = buildNestedTree(nodes);
    
        // Serialize to MCP-compatible text format
        const treeText = `tree:\n${serializeTree(tree)}`;
    
        return {
          isError: false,
          content: [
            {
              type: 'text',
              text: treeText,
            },
          ],
        };
      } catch (error) {
        logger?.error(
          `Failed to fetch object structure for ${args?.objecttype ?? args?.object_type}/${args?.objectname ?? args?.object_name}`,
          error,
        );
        return {
          isError: true,
          content: [
            {
              type: 'text',
              text: `ADT error: ${String(error)}`,
            },
          ],
        };
      }
    }
  • Input schema for GetObjectStructure tool. Defines 'objecttype' and 'objectname' as required string parameters.
    export const TOOL_DEFINITION = {
      name: 'GetObjectStructure',
      available_in: ['onprem', 'cloud'] as const,
      description:
        '[read-only] Retrieve ADT object structure as a compact JSON tree.',
      inputSchema: {
        type: 'object',
        properties: {
          objecttype: {
            type: 'string',
            description: 'ADT object type (e.g. DDLS/DF)',
          },
          objectname: {
            type: 'string',
            description: 'ADT object name (e.g. /CBY/ACQ_DDL)',
          },
        },
        required: ['objecttype', 'objectname'],
      },
    } as const;
  • Registration of GetObjectStructure tool in SystemHandlersGroup. Maps toolDefinition to handler.
    {
      toolDefinition: GetObjectStructure_Tool,
      handler: (args: any) => {
        return handleGetObjectStructure(
          this.context,
          args as { object_type: string; object_name: string },
        );
      },
    },
  • Low-level handler for GetObjectStructureLow tool. Directly returns the raw ADT client response with session management support.
    export async function handleGetObjectStructure(
      context: HandlerContext,
      args: GetObjectStructureArgs,
    ) {
      const { connection, logger } = context;
      try {
        // Validate required parameters
        if (!args?.object_type) {
          return return_error(new Error('object_type is required'));
        }
        if (!args?.object_name) {
          return return_error(new Error('object_name is required'));
        }
    
        // Restore session state if provided
        if (args.session_id && args.session_state) {
          const { restoreSessionInConnection } = await import(
            '../../../lib/utils.js'
          );
          await restoreSessionInConnection(
            connection,
            args.session_id,
            args.session_state,
          );
        }
    
        // Create AdtClient and get utilities
        const client = createAdtClient(connection, logger);
        const utils = client.getUtils();
    
        logger?.info(
          `Fetching object structure for ${args.object_type}/${args.object_name}`,
        );
    
        const result = await utils.getObjectStructure(
          args.object_type,
          args.object_name,
        );
    
        logger?.debug(
          `Object structure fetched successfully for ${args.object_type}/${args.object_name}`,
        );
    
        return return_response(result);
      } catch (error: any) {
        logger?.error('Failed to fetch object structure', error);
        return return_error(error);
      }
    }
  • Input schema for GetObjectStructureLow tool. Defines object_type, object_name, session_id, and session_state parameters.
    export const TOOL_DEFINITION = {
      name: 'GetObjectStructureLow',
      available_in: ['onprem', 'cloud'] as const,
      description:
        '[low-level] Retrieve ADT object structure as compact JSON tree. Returns XML response with object structure tree. Can use session_id and session_state from GetSession to maintain the same session.',
      inputSchema: {
        type: 'object',
        properties: {
          object_type: {
            type: 'string',
            description:
              'Object type (e.g., "CLAS/OC", "PROG/P", "DEVC/K", "DDLS/DF")',
          },
          object_name: {
            type: 'string',
            description: 'Object name (e.g., "ZMY_CLASS", "ZMY_PROGRAM")',
          },
          session_id: {
            type: 'string',
            description:
              'Session ID from GetSession. If not provided, a new session will be created.',
          },
          session_state: {
            type: 'object',
            description:
              'Session state from GetSession (cookies, csrf_token, cookie_store). Required if session_id is provided.',
            properties: {
              cookies: { type: 'string' },
              csrf_token: { type: 'string' },
              cookie_store: { type: 'object' },
            },
          },
        },
        required: ['object_type', 'object_name'],
      },
    } as const;
Behavior3/5

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

The tag '[read-only]' indicates no side effects, which is good. However, no other behavioral traits are disclosed (e.g., permissions, error conditions, or limitations). With no annotations, the description carries the full burden and is minimally transparent.

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 that front-loads the read-only nature and conveys the core purpose concisely. No extraneous words.

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 retrieval tool with two parameters and no output schema, the description is adequate but lacks details about the returned tree structure (e.g., depth, format, key fields). It does not cover all potentially needed context.

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 described in the input schema (100% coverage). The description repeats the parameter names without adding new meaning or context (e.g., examples, constraints). Baseline score of 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?

The description clearly states the verb 'retrieve', the resource 'ADT object structure', and the output format 'compact JSON tree'. It distinguishes itself from sibling tools like GetClass or GetTable by focusing on the structural view of an object.

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 structure, but provides no explicit guidance on when to use this tool versus other get tools (e.g., GetClass for details). 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