Skip to content

Agent Mesh

Update cmd/sam-node/mcp_handlers.go

Antonio Ojeaf637ad9edc09
diff --git a/cmd/sam-node/mcp_handlers.go b/cmd/sam-node/mcp_handlers.go
index 49ede545..19f32b8b 100644
--- a/cmd/sam-node/mcp_handlers.go
+++ b/cmd/sam-node/mcp_handlers.go
@@ -1063,8 +1063,8 @@ func PaginateSlice[T any](items []T, cursor string, limit int) ([]T, string, err
startIdx := 0
if cursor != "" {
idx, err := strconv.Atoi(cursor)
- if err != nil {
- return nil, "", err
+ if err != nil || idx < 0 {
+ return nil, "", fmt.Errorf("invalid cursor: %q", cursor)
}
startIdx = idx
}