Skip to main content
Glama
ethanhan2014

SAP ADT MCP Server

by ethanhan2014

get_abap_program

Retrieve the complete source code of any ABAP program or report from your SAP system by providing the program name. Optionally specify the system ID for multi-system environments.

Instructions

Fetch ABAP program/report source code from SAP system

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesProgram name (e.g. ZHANZ_CMR)
system_idNoSAP system ID (e.g. DEV). Omit to use default system.

Implementation Reference

  • Handler for 'get_abap_program' tool. Parses the 'name' argument via NameSchema, then calls client.getSource() with the ADT URI for program source code and returns the result as text.
    case "get_abap_program": {
      const { name: progName } = NameSchema.parse(args);
      const source = await client.getSource(
        `/sap/bc/adt/programs/programs/${encodeURIComponent(progName.toUpperCase())}/source/main`
      );
      return { content: [{ type: "text", text: source }] };
    }
  • The NameSchema used for input validation: expects a single 'name' string field.
    const NameSchema = z.object({ name: z.string() });
  • Registration of the 'get_abap_program' tool in the ListTools handler. Defines name, description, and inputSchema with required 'name' property and optional 'system_id'.
      name: "get_abap_program",
      description: "Fetch ABAP program/report source code from SAP system",
      inputSchema: {
        type: "object" as const,
        properties: { name: { type: "string", description: "Program name (e.g. ZHANZ_CMR)" }, ...SYSTEM_ID_PROP },
        required: ["name"],
      },
    },
  • The getSource() method in AdtClient used by the handler to fetch source code from the SAP system via a plain text GET request to the given ADT URI.
    async getSource(path: string): Promise<string> {
      const response = await this.http.get<string>(path, {
        headers: { Accept: "text/plain" },
        responseType: "text",
      });
      return response.data;
    }
Behavior2/5

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

No annotations are provided, and the description does not disclose behavioral traits such as read-only nature, required permissions, rate limits, or potential side effects. For a read operation, this is a notable gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence that front-loads the key action. No redundant information, though it could benefit from structured formatting (e.g., bullet points) for complex details.

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?

With no output schema, the description fails to mention the return format (likely source code text). The tool is simple but for completeness, a note about the nature of the returned data would be helpful.

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 description coverage is 100%, so the parameter descriptions in the schema are sufficient. The tool description adds no extra meaning beyond stating the resource type (ABAP program/report source code).

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 tool fetches ABAP program/report source code, using specific verb 'Fetch' and resource 'ABAP program/report source code'. This distinguishes it from sibling get_* tools that retrieve different SAP objects (e.g., get_class, get_function_module).

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 guidance on when to use this tool vs alternatives like change_abap_program or execute_program. The description omits context such as prerequisites or typical use cases, leaving the agent without decision support.

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/ethanhan2014/sap-adt-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server