Skip to main content
Glama
ethanhan2014

SAP ADT MCP Server

by ethanhan2014

execute_program

Execute an ABAP program on the SAP system and retrieve its WRITE output as plain text. Requires the program to be activated before running.

Instructions

Execute an ABAP program/report on the SAP system and return the list output. The program must be activated. Returns the WRITE output as plain text.

Input Schema

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

Implementation Reference

  • The executeProgram method on AdtClient that actually executes an ABAP program on the SAP system via POST to /sap/bc/adt/programs/programrun/{name}. It uses a stateful session (fetches CSRF token, posts, then ends session).
    async executeProgram(name: string): Promise<string> {
      await this.fetchStatefulCsrf();
      try {
        const resp = await this.http.post(
          `/sap/bc/adt/programs/programrun/${encodeURIComponent(name.toLowerCase())}`,
          "",
          {
            headers: this.statefulHeaders({ Accept: "text/plain" }),
            responseType: "text",
          }
        );
        return resp.data as string;
      } finally {
        await this.endStatefulSession();
      }
    }
  • The CallToolRequestSchema handler case for 'execute_program' — parses the name argument via NameSchema and delegates to client.executeProgram(progName), returning the output or '(no output)'.
    case "execute_program": {
      const { name: progName } = NameSchema.parse(args);
      const output = await client.executeProgram(progName);
      return { content: [{ type: "text", text: output || "(no output)" }] };
    }
  • NameSchema used by execute_program: a Zod object requiring a 'name' string.
    const NameSchema = z.object({ name: z.string() });
    const FunctionModuleSchema = z.object({
      function_group: z.string(),
      function_name: z.string(),
    });
    const SqlSchema = z.object({ query: z.string() });
    const SearchObjectSchema = z.object({
      query: z.string(),
      max_results: z.number().optional(),
    });
    const CreateProgramSchema = z.object({
      name: z.string(),
      description: z.string(),
      source: z.string(),
      package: z.string().optional(),
    });
  • Tool registration/definition of 'execute_program' in ListToolsRequestSchema — defines name, description, and inputSchema with only a 'name' parameter.
    {
      name: "execute_program",
      description: "Execute an ABAP program/report on the SAP system and return the list output. The program must be activated. Returns the WRITE output as plain text.",
      inputSchema: {
        type: "object" as const,
        properties: { name: { type: "string", description: "Program name to execute (e.g. ZHANZ_MCP_HELLO)" }, ...SYSTEM_ID_PROP },
        required: ["name"],
      },
    },
  • Helper methods used by executeProgram: fetchStatefulCsrf() obtains CSRF token in stateful session mode; endStatefulSession() ends the session. These are also used by the executeProgram method.
    async executeProgram(name: string): Promise<string> {
      await this.fetchStatefulCsrf();
      try {
        const resp = await this.http.post(
          `/sap/bc/adt/programs/programrun/${encodeURIComponent(name.toLowerCase())}`,
          "",
          {
            headers: this.statefulHeaders({ Accept: "text/plain" }),
            responseType: "text",
          }
        );
        return resp.data as string;
      } finally {
        await this.endStatefulSession();
      }
    }
Behavior2/5

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

No annotations are provided, so the description must fully disclose behavior. It mentions the program must be activated and that output is plain text, but omits important details such as authorization requirements, error handling, side effects, or rate limits.

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 with two sentences, no filler. It front-loads the core action and is well-structured.

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?

For a simple tool with two parameters, the description covers core functionality, precondition, and output format. Missing details like error handling and timeout behavior, but overall adequate.

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?

Input schema covers both parameters with descriptions (100% coverage). The description adds examples ('e.g. ZHANZ_MCP_HELLO', 'e.g. DEV') but does not provide significant additional meaning beyond what the schema already offers.

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 executes an ABAP program/report and returns WRITE output as plain text. It uses a specific verb 'Execute' and resource 'ABAP program/report', and is distinct from sibling tools like debugger or trace tools.

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 running ABAP programs that must be activated, but provides no explicit guidance on when to use this tool versus alternatives, nor any conditions for not using it.

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