Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions pkg/cli/audit_expanded.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func extractEngineConfig(logsPath string) *EngineConfig {
}

// Extract MCP server names from aw_info.json steps metadata
if mcpNames, ok := awInfoHasMCPServers(logsPath); ok {
if mcpNames, ok := extractMCPServerNamesFromAwInfo(logsPath); ok {
config.MCPServers = mcpNames
}

Expand Down Expand Up @@ -458,10 +458,11 @@ func buildSlowestToolCalls(calls []MCPToolCall, topN int) []MCPSlowestToolCall {
return result
}

// awInfoHasMCPServers checks if aw_info.json has MCP server configuration in steps.
// extractMCPServerNamesFromAwInfo extracts MCP server names from aw_info.json steps metadata
// and returns them along with a boolean indicating whether any servers were found.
// We need to inspect the raw JSON since AwInfoSteps.MCPServers may not be
// deserialized as a map for all formats.
func awInfoHasMCPServers(logsPath string) ([]string, bool) {
func extractMCPServerNamesFromAwInfo(logsPath string) ([]string, bool) {
awInfoPath := findAwInfoPath(logsPath)
if awInfoPath == "" {
return nil, false
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/audit_expanded_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ func TestAwInfoHasMCPServers(t *testing.T) {
err := os.WriteFile(filepath.Join(targetDir, "aw_info.json"), []byte(tt.awInfoContent), 0644)
require.NoError(t, err, "Should write aw_info.json")

names, hasMCP := awInfoHasMCPServers(tmpDir)
names, hasMCP := extractMCPServerNamesFromAwInfo(tmpDir)
assert.Equal(t, tt.expectedHasMCP, hasMCP, "Has MCP servers should match")
Comment on lines +671 to 672
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The helper was renamed for discoverability, but the test function name is still TestAwInfoHasMCPServers, which makes it harder to find the extraction logic/tests via search. Consider renaming the test (and any subtest names/messages if needed) to match extractMCPServerNamesFromAwInfo (e.g., TestExtractMCPServerNamesFromAwInfo).

Copilot uses AI. Check for mistakes.
if tt.expectedHasMCP {
assert.Equal(t, tt.expectedNames, names, "MCP server names should match")
Expand Down
Loading