Skip to main content
Glama
ethanhan2014

SAP ADT MCP Server

by ethanhan2014

fetch_st22_dumps

Retrieve ABAP runtime error dumps (ST22) for a specified date, including dump time, user, error type, and program, by querying the SNAP table.

Instructions

Fetch ABAP runtime error dumps (ST22/short dumps) for a specific date. Returns dump time, user, runtime error type, and program. Queries the SNAP table and parses the encoded dump headers.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dateYesDate in YYYYMMDD or YYYY-MM-DD format (e.g. 20260402)
userNoFilter by SAP username (e.g. WF-BATCH)
max_resultsNoMax dumps to return (default: 100)
system_idNoSAP system ID (e.g. DEV). Omit to use default system.

Implementation Reference

  • The handler for the fetch_st22_dumps tool. Parses input with FetchSt22Schema, builds an SQL query against the SNAP table, executes it via client.executeFreestyleSql(), parses the XML result with parseSnapDumps(), and formats output with formatSt22Dumps().
    case "fetch_st22_dumps": {
      const parsed = FetchSt22Schema.parse(args);
      const dateStr = parsed.date.replace(/-/g, "");
      const maxRows = parsed.max_results ?? 100;
    
      let query = `SELECT * FROM snap UP TO ${maxRows} ROWS WHERE datum = '${dateStr}' AND seqno = '000'`;
      if (parsed.user) {
        query += ` AND uname = '${parsed.user.toUpperCase()}'`;
      }
      query += ` ORDER BY uzeit DESCENDING`;
    
      const xml = await client.executeFreestyleSql(query);
      const dumps = parseSnapDumps(xml);
      const displayDate = `${dateStr.substring(0, 4)}-${dateStr.substring(4, 6)}-${dateStr.substring(6, 8)}`;
      const text = formatSt22Dumps(dumps, displayDate);
      return { content: [{ type: "text", text }] };
    }
  • Zod schema for fetch_st22_dumps input: date (required), user (optional), max_results (optional, default 100).
    const FetchSt22Schema = z.object({
      date: z.string().describe("Date in YYYYMMDD or YYYY-MM-DD format"),
      user: z.string().optional().describe("Filter by SAP username"),
      max_results: z.number().optional().describe("Max dumps to return (default: 100)"),
    });
  • Registration of fetch_st22_dumps in the ListTools handler. Defines the tool name, description, and input schema properties.
      name: "fetch_st22_dumps",
      description:
        "Fetch ABAP runtime error dumps (ST22/short dumps) for a specific date. " +
        "Returns dump time, user, runtime error type, and program. " +
        "Queries the SNAP table and parses the encoded dump headers.",
      inputSchema: {
        type: "object" as const,
        properties: {
          date: { type: "string", description: "Date in YYYYMMDD or YYYY-MM-DD format (e.g. 20260402)" },
          user: { type: "string", description: "Filter by SAP username (e.g. WF-BATCH)" },
          max_results: { type: "number", description: "Max dumps to return (default: 100)", default: 100 },
          ...SYSTEM_ID_PROP,
        },
        required: ["date"],
      },
    },
  • formatSt22Dumps() helper - formats the parsed ST22 dump data into a human-readable table. Called by the fetch_st22_dumps handler.
    export function formatSt22Dumps(dumps: St22Dump[], date: string): string {
      if (dumps.length === 0) {
        return `No ST22 dumps found for ${date}`;
      }
    
      const totalRows = extractTotalRows("");
      const header = `Found ${dumps.length} ST22 dump(s) on ${date}\n`;
    
      const padRight = (s: string, w: number) =>
        s.length > w ? s.substring(0, w - 1) + "~" : s.padEnd(w);
    
      const cols = [
        { label: "#", width: 4 },
        { label: "Time", width: 8 },
        { label: "User", width: 12 },
        { label: "Runtime Error", width: 32 },
        { label: "Program", width: 40 },
      ];
    
      const headerLine = cols.map((c) => padRight(c.label, c.width)).join(" | ");
      const separator = cols.map((c) => "-".repeat(c.width)).join("-+-");
    
      const rows = dumps.map((d, i) => {
        const values = [
          String(i + 1),
          formatTime(d.time),
          d.user,
          d.runtimeError,
          d.program,
        ];
        return values.map((v, j) => padRight(v, cols[j].width)).join(" | ");
      });
    
      return [header, headerLine, separator, ...rows].join("\n");
    }
  • parseSnapDumps() helper - parses XML data preview response (from SNAP table) into St22Dump objects. Used by the fetch_st22_dumps handler.
    export function parseSnapDumps(xml: string): St22Dump[] {
      const columns = extractColumns(xml);
      if (columns.length === 0) return [];
    
      const colMap = new Map(columns.map((c) => [c.name, c.values]));
      const datumVals = colMap.get("DATUM") ?? [];
      const uzeitVals = colMap.get("UZEIT") ?? [];
      const unameVals = colMap.get("UNAME") ?? [];
      const ahostVals = colMap.get("AHOST") ?? [];
      const flistVals = colMap.get("FLIST") ?? [];
    
      const dumps: St22Dump[] = [];
      for (let i = 0; i < datumVals.length; i++) {
        const { runtimeError, program } = parseFlistField(flistVals[i] ?? "");
        dumps.push({
          date: datumVals[i] ?? "",
          time: uzeitVals[i] ?? "",
          user: (unameVals[i] ?? "").trim(),
          host: (ahostVals[i] ?? "").trim(),
          runtimeError,
          program,
        });
      }
    
      return dumps;
    }
Behavior4/5

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

With no annotations provided, the description carries the full burden and discloses that it queries the SNAP table and parses encoded dump headers, implying a read-only operation. It does not mention rate limits or authentication, but for a fetch operation this is adequate.

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 two sentences, front-loading the purpose and key capabilities. Every sentence adds value with no redundancy.

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?

Given no output schema, the description includes the fields returned (time, user, error type, program) and explains the data source. It does not describe pagination or error handling, but the max_results parameter is documented in the schema. Overall, it provides sufficient context for an agent.

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?

The input schema has 100% coverage with clear descriptions for all parameters. The description does not add meaning beyond what the schema provides, but the background on data source and parsing is contextually useful. 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 tool fetches ABAP runtime error dumps (ST22/short dumps) for a specific date, listing returned fields and the underlying mechanism (query SNAP table, parse headers). It is distinct from sibling tools which focus on debugging, tracing, or transport operations.

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 does not explicitly state when to use this tool versus alternatives or provide context for exclusion. While the tool is specialized enough that implicit usage is clear, there is no guidance on scenarios like multiple dates or handling large result sets.

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