Class TraceService
java.lang.Object
com.shaft.mcp.TraceService
MCP tools for persisted SHAFT trace discovery, reading, and deterministic failure analysis.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordMerged-shard report result.static final recordFailed action summary from a SHAFT trace.static final recordOne persisted SHAFT trace index.static final recordRecent trace index listing result.static final recordBounded trace JSON read result.static final recordDeterministic SHAFT trace summary.static final recordResolved offline SHAFT Trace Report HTML viewer path. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoctorAnalyzeTrace(String tracePath, String backend) Analyzes a persisted SHAFT trace and returns the existing MCP Doctor remediation report shape.reportMergeShards(List<String> shardBlobPaths, String outputDirectory) Merges N per-shard blobs (raw Allure results + optional traces + optional doctorExecutionIntelligence, produced by independent-Dshaft.shard=N/Mruns) into one Allure result set plus a timeline "speedboard" HTML and a cross-shard flaky-clustering summary.traceLatest(int maxResults) Lists recent persisted SHAFT trace indexes undertarget/shaft-traces.traceOpenViewer(String tracePath) Resolves (extracting from the trace ZIP if needed) the static offline "SHAFT Trace Report.html" viewer for a persisted trace -- the same time-travel timeline / action-list / DOM-snapshot / network / console viewer produced at trace-generation time, so callers (an IDE panel, a CI step, or a human) can open a real file path without re-deriving the HTML themselves.Reads a persisted trace JSON file, trace ZIP, trace directory, or index path with bounded output.traceSummarize(String tracePath) Summarizes a persisted SHAFT trace deterministically without provider calls.
-
Constructor Details
-
TraceService
public TraceService()Creates the default local MCP trace service.
-
-
Method Details
-
traceLatest
@Tool(name="trace_latest", description="returns recent persisted SHAFT trace indexes from target/shaft-traces") public TraceService.McpTraceLatestResult traceLatest(int maxResults) Lists recent persisted SHAFT trace indexes undertarget/shaft-traces.- Parameters:
maxResults- maximum trace indexes to return- Returns:
- recent trace index metadata
-
traceRead
@Tool(name="trace_read", description="returns redacted SHAFT trace JSON from a trace path with explicit output bounds") public TraceService.McpTraceReadResult traceRead(String tracePath, int maxCharacters) Reads a persisted trace JSON file, trace ZIP, trace directory, or index path with bounded output.- Parameters:
tracePath- trace path inside the MCP workspacemaxCharacters- maximum characters to return- Returns:
- bounded redacted trace JSON content
-
traceSummarize
@Tool(name="trace_summarize", description="returns a deterministic summary of a persisted SHAFT trace without AI") public TraceService.McpTraceSummary traceSummarize(String tracePath) Summarizes a persisted SHAFT trace deterministically without provider calls.- Parameters:
tracePath- trace path inside the MCP workspace- Returns:
- deterministic failure summary
-
traceOpenViewer
@Tool(name="trace_open_viewer", description="resolves (extracting from the trace ZIP if needed) the offline SHAFT Trace Report HTML viewer for a persisted trace") public TraceService.McpTraceViewerResult traceOpenViewer(String tracePath) Resolves (extracting from the trace ZIP if needed) the static offline "SHAFT Trace Report.html" viewer for a persisted trace -- the same time-travel timeline / action-list / DOM-snapshot / network / console viewer produced at trace-generation time, so callers (an IDE panel, a CI step, or a human) can open a real file path without re-deriving the HTML themselves.- Parameters:
tracePath- trace path inside the MCP workspace (directory, index.json, or ZIP)- Returns:
- the resolved viewer HTML path and whether it had to be freshly extracted
-
reportMergeShards
@Tool(name="report_merge_shards", description="merges N per-shard Allure/trace/doctor-intelligence blobs into one Allure result set plus a flaky-clustering speedboard HTML") public TraceService.McpMergeShardsResult reportMergeShards(List<String> shardBlobPaths, String outputDirectory) Merges N per-shard blobs (raw Allure results + optional traces + optional doctorExecutionIntelligence, produced by independent-Dshaft.shard=N/Mruns) into one Allure result set plus a timeline "speedboard" HTML and a cross-shard flaky-clustering summary. SeeShardMergerfor the merge semantics.- Parameters:
shardBlobPaths- shard blob root directories inside the MCP workspace, in merge orderoutputDirectory- merged output directory inside the MCP workspace; blank selectstarget/shaft-merged-report- Returns:
- merged Allure results directory, speedboard path, and flaky-clustering summary
-
doctorAnalyzeTrace
@Tool(name="doctor_analyze_trace", description="analyzes a persisted SHAFT trace and returns deterministic Doctor remediation guidance") public McpAnalysisReport doctorAnalyzeTrace(String tracePath, String backend) Analyzes a persisted SHAFT trace and returns the existing MCP Doctor remediation report shape.- Parameters:
tracePath- trace path inside the MCP workspacebackend- optional backend label,playwrightorwebdriver- Returns:
- deterministic MCP Doctor analysis and remediation snippets
-