Skip to main content
Glama

GetPackageContents

Retrieve objects inside an ABAP package as a flat list. Supports recursive traversal of subpackages with configurable depth and inclusion of descriptions.

Instructions

[read-only] Retrieve objects inside an ABAP package as a flat list. Supports recursive traversal of subpackages.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
package_nameYesName of the ABAP package (e.g., "ZMY_PACKAGE")
include_subpackagesNoInclude contents of subpackages recursively (default: false)
max_depthNoMaximum depth for recursive package traversal (default: 5)
include_descriptionsNoInclude object descriptions in response (default: true)

Implementation Reference

  • Main handler function for the GetPackageContents tool. Validates input (package_name required), creates an ADT client, calls getPackageContentsList with the provided parameters (including subpackages, max depth, descriptions), and returns the result as JSON text.
    export async function handleGetPackageContents(
      context: HandlerContext,
      args: GetPackageContentsArgs,
    ) {
      const { connection, logger } = context;
      try {
        if (!args?.package_name) {
          throw new McpError(ErrorCode.InvalidParams, 'Package name is required');
        }
    
        const client = createAdtClient(connection, logger);
        const utils = client.getUtils();
    
        // Use the optimized list method from adt-clients 0.3.13
        const items = await utils.getPackageContentsList(
          args.package_name.toUpperCase(),
          {
            includeSubpackages: args.include_subpackages,
            maxDepth: args.max_depth,
            includeDescriptions: args.include_descriptions,
          },
        );
    
        const finalResult = {
          isError: false,
          content: [
            {
              type: 'text',
              text: JSON.stringify(items, null, 2),
            },
          ],
        };
    
        if (args.filePath) {
          writeResultToFile(JSON.stringify(finalResult, null, 2), args.filePath);
        }
    
        return finalResult;
      } catch (error) {
        return {
          isError: true,
          content: [
            {
              type: 'text',
              text: error instanceof Error ? error.message : String(error),
            },
          ],
        };
      }
    }
  • Schema/tool definition for GetPackageContents. Defines tool name, availability (onprem, cloud, legacy), description, and input schema with zod validators for package_name (required), include_subpackages (optional boolean), max_depth (optional number), and include_descriptions (optional boolean).
    export const TOOL_DEFINITION = {
      name: 'GetPackageContents',
      available_in: ['onprem', 'cloud', 'legacy'] as const,
      description:
        '[read-only] Retrieve objects inside an ABAP package as a flat list. Supports recursive traversal of subpackages.',
      inputSchema: {
        package_name: z
          .string()
          .describe('Name of the ABAP package (e.g., "ZMY_PACKAGE")'),
        include_subpackages: z
          .boolean()
          .optional()
          .describe('Include contents of subpackages recursively (default: false)'),
        max_depth: z
          .number()
          .optional()
          .describe('Maximum depth for recursive package traversal (default: 5)'),
        include_descriptions: z
          .boolean()
          .optional()
          .describe('Include object descriptions in response (default: true)'),
      },
    } as const;
  • Import of the GetPackageContents tool definition and handler into the ReadOnlyHandlersGroup.
    import {
      TOOL_DEFINITION as GetPackageContents_Tool,
      handleGetPackageContents,
    } from '../../../handlers/package/readonly/handleGetPackageContents';
  • Registration of GetPackageContents as a handler entry in the ReadOnlyHandlersGroup, wiring the tool definition to the handler function with context injection.
    {
      toolDefinition: GetPackageContents_Tool,
      handler: (args: any) => handleGetPackageContents(this.context, args),
    },
Behavior3/5

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

The description starts with '[read-only]' to indicate no modification, which is beneficial since annotations are absent. However, it omits details on authentication, performance with deep recursion, or what happens when descriptions are excluded. No contradictions with annotations.

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 concise sentence with a brief note on behavior. Every word is purposeful, with no redundancy or extraneous information.

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

Completeness2/5

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

Without an output schema, the description should clarify what the 'flat list' contains (e.g., object names, types). The current description lacks this information, leaving the agent uncertain about the return format despite the parameter-rich input.

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?

All four parameters have descriptions in the input schema (100% coverage). The description does not add parameter-specific meaning beyond 'recursive traversal of subpackages' which relates to include_subpackages and max_depth. 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?

The description clearly states the action ('retrieve'), resource ('objects inside an ABAP package'), and format ('flat list'), while highlighting recursive traversal. It distinguishes itself from sibling tools like GetPackageTree and specific object getters.

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 obtaining a flat list of package objects, but does not explicitly mention when to use this versus alternatives (e.g., GetPackageTree for hierarchy) or any prerequisites. No exclusion criteria 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