MCPcopy Create free account
hub / github.com/github/gh-aw / processMCPFailureEntry

Function processMCPFailureEntry

pkg/cli/logs_metrics.go:764–806  ·  view source on GitHub ↗
(entry map[string]any, run WorkflowRun, verbose bool, experimentName, variant string, mcpFailures *[]MCPFailureReport)

Source from the content-addressed store, hash-verified

762}
763
764func processMCPFailureEntry(entry map[string]any, run WorkflowRun, verbose bool, experimentName, variant string, mcpFailures *[]MCPFailureReport) {
765 entryType, ok := typeutil.LookupString(entry, "type")
766 if !ok || entryType != "system" {
767 return
768 }
769
770 subtype, ok := typeutil.LookupString(entry, "subtype")
771 if !ok || subtype != "init" {
772 return
773 }
774
775 mcpServers, ok := entry["mcp_servers"].([]any)
776 if !ok {
777 return
778 }
779
780 timestamp, _ := typeutil.LookupString(entry, "timestamp") // Optional field, ignore if missing.
781
782 for _, serverInterface := range mcpServers {
783 server, ok := serverInterface.(map[string]any)
784 if !ok {
785 continue
786 }
787
788 serverName, hasName := typeutil.LookupString(server, "name")
789 status, hasStatus := typeutil.LookupString(server, "status")
790 if !hasName || !hasStatus || status != "failed" {
791 continue
792 }
793
794 failure := MCPFailureReport{
795 ServerName: serverName,
796 Status: status,
797 ReportProvenance: buildReportProvenance(run, timestamp, experimentName, variant),
798 }
799
800 *mcpFailures = append(*mcpFailures, failure)
801
802 if verbose {
803 fmt.Fprintln(os.Stderr, console.FormatWarningMessage(fmt.Sprintf("Found MCP server failure: %s (status: %s)", serverName, status)))
804 }
805 }
806}

Callers 1

Calls 3

LookupStringFunction · 0.92
FormatWarningMessageFunction · 0.92
buildReportProvenanceFunction · 0.85

Tested by

no test coverage detected