Skip to main content
Glama
ethanhan2014

SAP ADT MCP Server

by ethanhan2014

enable_st05_trace

Enable ST05 performance tracing for a SAP user to diagnose database and buffer issues. Activate SQL, buffer, enqueue, RFC, HTTP, or authorization traces with optional ABAP stack traces. Trace runs continuously until stopped.

Instructions

Enable ST05 performance trace (SQL trace, buffer trace, etc.) for a specific user. By default enables SQL trace with stack trace. The trace runs continuously until disabled with disable_st05_trace.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
userNoSAP username to trace (default: current user)
sqlNoEnable SQL trace (default: true)
bufferNoEnable buffer trace (default: false)
enqueueNoEnable enqueue trace (default: false)
rfcNoEnable RFC trace (default: false)
httpNoEnable HTTP trace (default: false)
authNoEnable authorization trace (default: false)
stack_traceNoInclude ABAP stack traces (default: true)
system_idNoSAP system ID (e.g. DEV). Omit to use default system.

Implementation Reference

  • Handler for enable_st05_trace - parses args with EnableSt05Schema, calls client.enableSt05Trace(), parses XML response, and returns formatted output
    case "enable_st05_trace": {
      const opts = EnableSt05Schema.parse(args);
      const result = await client.enableSt05Trace({
        user: opts.user,
        sql: opts.sql,
        buffer: opts.buffer,
        enqueue: opts.enqueue,
        rfc: opts.rfc,
        http: opts.http,
        auth: opts.auth,
        stackTrace: opts.stack_trace,
      });
      const sqlOn = result.match(/<ts:sqlOn>(\w+)<\/ts:sqlOn>/)?.[1];
      const bufOn = result.match(/<ts:bufOn>(\w+)<\/ts:bufOn>/)?.[1];
      const enqOn = result.match(/<ts:enqOn>(\w+)<\/ts:enqOn>/)?.[1];
      const rfcOn = result.match(/<ts:rfcOn>(\w+)<\/ts:rfcOn>/)?.[1];
      const httpOn = result.match(/<ts:httpOn>(\w+)<\/ts:httpOn>/)?.[1];
      const authOn = result.match(/<ts:authOn>(\w+)<\/ts:authOn>/)?.[1];
      const stackOn = result.match(/<ts:stackTraceOn>(\w+)<\/ts:stackTraceOn>/)?.[1];
      const traceUser = result.match(/<ts:traceUser>([^<]*)<\/ts:traceUser>/)?.[1] || "(all)";
      const lines = [
        "ST05 trace enabled:",
        `  User:        ${traceUser}`,
        `  SQL:         ${sqlOn}`,
        `  Buffer:      ${bufOn}`,
        `  Enqueue:     ${enqOn}`,
        `  RFC:         ${rfcOn}`,
        `  HTTP:        ${httpOn}`,
        `  Auth:        ${authOn}`,
        `  Stack trace: ${stackOn}`,
      ];
      return { content: [{ type: "text", text: lines.join("\n") }] };
    }
  • Zod schema for enable_st05_trace input validation
    const EnableSt05Schema = z.object({
      user: z.string().optional(),
      sql: z.boolean().optional(),
      buffer: z.boolean().optional(),
      enqueue: z.boolean().optional(),
      rfc: z.boolean().optional(),
      http: z.boolean().optional(),
      auth: z.boolean().optional(),
      stack_trace: z.boolean().optional(),
    });
  • Tool registration for enable_st05_trace in ListToolsRequestSchema handler
      name: "enable_st05_trace",
      description: "Enable ST05 performance trace (SQL trace, buffer trace, etc.) for a specific user. By default enables SQL trace with stack trace. The trace runs continuously until disabled with disable_st05_trace.",
      inputSchema: {
        type: "object" as const,
        properties: {
          user: { type: "string", description: "SAP username to trace (default: current user)" },
          sql: { type: "boolean", description: "Enable SQL trace (default: true)" },
          buffer: { type: "boolean", description: "Enable buffer trace (default: false)" },
          enqueue: { type: "boolean", description: "Enable enqueue trace (default: false)" },
          rfc: { type: "boolean", description: "Enable RFC trace (default: false)" },
          http: { type: "boolean", description: "Enable HTTP trace (default: false)" },
          auth: { type: "boolean", description: "Enable authorization trace (default: false)" },
          stack_trace: { type: "boolean", description: "Include ABAP stack traces (default: true)" },
          ...SYSTEM_ID_PROP,
        },
        required: [],
      },
    },
  • Helper method in AdtClient that sends ST05 trace state XML to the SAP ADT ST05 endpoint
      async enableSt05Trace(options: {
        user?: string;
        sql?: boolean;
        buffer?: boolean;
        enqueue?: boolean;
        rfc?: boolean;
        http?: boolean;
        auth?: boolean;
        stackTrace?: boolean;
      }): Promise<string> {
        const state = await this.getSt05TraceState();
    
        const instanceMatch = state.match(/<ts:instance>([^<]+)<\/ts:instance>/);
        const hostMatch = state.match(/<ts:host>([^<]+)<\/ts:host>/);
        const instance = instanceMatch?.[1] ?? "";
        const host = hostMatch?.[1] ?? "";
        const traceUser = (options.user ?? this.config.username).toUpperCase();
    
        const xml = `<?xml version="1.0" encoding="UTF-8"?>
    <ts:traceStateInstanceTable xmlns:ts="http://www.sap.com/adt/tools/performance/tracestate">
      <ts:traceStateInstance>
        <ts:instance>${this.escapeXml(instance)}</ts:instance>
        <ts:host>${this.escapeXml(host)}</ts:host>
        <ts:isLocal>true</ts:isLocal>
        <ts:isSelected>true</ts:isSelected>
        <ts:modificationUser>${this.escapeXml(this.config.username.toUpperCase())}</ts:modificationUser>
        <ts:modificationDateTime>${new Date().toISOString().replace(/\.\d+Z$/, "Z")}</ts:modificationDateTime>
        <ts:traceTypes>
          <ts:sqlOn>${options.sql !== false}</ts:sqlOn>
          <ts:bufOn>${options.buffer ?? false}</ts:bufOn>
          <ts:enqOn>${options.enqueue ?? false}</ts:enqOn>
          <ts:rfcOn>${options.rfc ?? false}</ts:rfcOn>
          <ts:httpOn>${options.http ?? false}</ts:httpOn>
          <ts:apcOn>false</ts:apcOn>
          <ts:amcOn>false</ts:amcOn>
          <ts:authOn>${options.auth ?? false}</ts:authOn>
        </ts:traceTypes>
        <ts:traceProperties>
          <ts:includeMissingTableNameOn>false</ts:includeMissingTableNameOn>
          <ts:authErrorsOnly>false</ts:authErrorsOnly>
          <ts:stackTraceOn>${options.stackTrace !== false}</ts:stackTraceOn>
          <ts:includedTables/>
          <ts:excludedTables/>
        </ts:traceProperties>
        <ts:traceFilter>
          <ts:traceUser>${this.escapeXml(traceUser)}</ts:traceUser>
          <ts:transactionCode/>
          <ts:program/>
          <ts:rfcFunction/>
          <ts:url/>
          <ts:wpId/>
        </ts:traceFilter>
      </ts:traceStateInstance>
    </ts:traceStateInstanceTable>`;
    
        return (await this.putWithCsrf(
          "/sap/bc/adt/st05/trace/state",
          xml,
          "application/vnd.sap.adt.perf.trace.state.v1+xml",
          "application/vnd.sap.adt.perf.trace.state.v1+xml"
        )).data as string;
      }
Behavior3/5

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

Describes default behavior (SQL trace with stack trace) and continuous running, but lacks details on performance impact, idempotency, or what happens if already enabled.

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?

Two concise sentences: first states purpose and variants, second explains duration and defaults. No unnecessary 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?

Covers defaults and operation, but does not explain output/return value or prerequisites for system_id; somewhat adequate for a trace tool.

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 coverage is 100%, so baseline 3. Description adds default behavior context but no new meaning beyond schema.

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?

Clearly states the tool enables ST05 performance trace for a specific user, listing variants like SQL trace. Distinguishes from sibling tools like disable_st05_trace.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Indicates trace runs until disabled with disable_st05_trace, but does not mention when not to use or differentiate from enable_cross_trace.

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