Skip to content

Commit 29a4b31

Browse files
committed
fix: Fix nil 2
1 parent 819579e commit 29a4b31

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

tests/mcp_tool.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -862,17 +862,13 @@ func RunMCPPostgresListTriggersTest(t *testing.T, ctx context.Context, pool *pgx
862862
if mcpResp.Result.IsError {
863863
t.Fatalf("list_triggers returned error result: %v", mcpResp.Result)
864864
}
865-
var gotObj []map[string]any
866-
for _, content := range mcpResp.Result.Content {
867-
got := content.Text
868-
if got == "null" {
869-
continue
870-
}
871-
items, err := unmarshalMCPResult[map[string]any](got)
865+
gotObj := []map[string]any{}
866+
got := getMCPResultText(mcpResp)
867+
if got != "null" {
868+
gotObj, err = unmarshalMCPResult[map[string]any](got)
872869
if err != nil {
873870
t.Fatalf("failed to unmarshal nested result string: %v", err)
874871
}
875-
gotObj = append(gotObj, items...)
876872
}
877873

878874
if tc.compareSubset {

0 commit comments

Comments
 (0)