get_trace_statements
Retrieve aggregated call tree with statement-level performance data for a trace ID. Analyze SQL and ABAP statement execution to identify performance bottlenecks.
Instructions
Get aggregated call tree with statement-level performance for a trace
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| trace_id | Yes | Trace ID from list_traces | |
| system_id | No | SAP system ID (e.g. DEV). Omit to use default system. |
Implementation Reference
- src/mcp-server.ts:567-578 (registration)Tool registration: 'get_trace_statements' is registered in the ListToolsRequestSchema handler with its description and input schema (requires trace_id).
{ name: "get_trace_statements", description: "Get aggregated call tree with statement-level performance for a trace", inputSchema: { type: "object" as const, properties: { trace_id: { type: "string", description: "Trace ID from list_traces" }, ...SYSTEM_ID_PROP, }, required: ["trace_id"], }, }, - src/mcp-server.ts:78-80 (schema)Trace ID schema (TraceIdSchema) used as input validation for get_trace_statements — requires a 'trace_id' string.
// Trace schemas const TraceUserSchema = z.object({ user: z.string().optional() }); const TraceIdSchema = z.object({ trace_id: z.string() }); - src/mcp-server.ts:1159-1163 (handler)Handler for the 'get_trace_statements' tool: parses trace_id from args via TraceIdSchema, calls client.getTraceStatements(trace_id), and returns the raw XML response.
case "get_trace_statements": { const { trace_id } = TraceIdSchema.parse(args); const result = await client.getTraceStatements(trace_id); return { content: [{ type: "text", text: result }] }; } - src/client-pool.ts:1-2 (helper)ClientPool imports AdtClient which contains the actual getTraceStatements method.
import { AdtClient } from "./adt-client.js"; import { SystemConfig } from "./types.js"; - src/adt-client.ts:258-264 (helper)Implementation of getTraceStatements in AdtClient: makes a GET request to /sap/bc/adt/runtime/traces/abaptraces/{traceId}/statements with a 120s timeout, returns the raw XML response.
async getTraceStatements(traceId: string): Promise<string> { const response = await this.http.get<string>( `/sap/bc/adt/runtime/traces/abaptraces/${encodeURIComponent(traceId)}/statements`, { headers: { Accept: "*/*" }, responseType: "text", timeout: 120000 } ); return response.data; }