good-eggs-mcp-server 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/shared/server.js +16 -26
package/package.json
CHANGED
package/shared/server.js
CHANGED
|
@@ -559,24 +559,19 @@ export class GoodEggsClient {
|
|
|
559
559
|
const nameEl = document.querySelector('h1, [class*="product-name"], [class*="title"]');
|
|
560
560
|
return nameEl?.textContent?.trim() || 'Unknown item';
|
|
561
561
|
});
|
|
562
|
-
// Look for the favorite
|
|
563
|
-
const
|
|
564
|
-
if (!
|
|
562
|
+
// Look for the favorite control - Good Eggs uses a div, not a button
|
|
563
|
+
const favoriteControl = await page.$('.product-detail__favorite-control');
|
|
564
|
+
if (!favoriteControl) {
|
|
565
565
|
return {
|
|
566
566
|
success: false,
|
|
567
567
|
message: 'Could not find favorite button',
|
|
568
568
|
itemName,
|
|
569
569
|
};
|
|
570
570
|
}
|
|
571
|
-
// Check if already favorited
|
|
572
|
-
const isAlreadyFavorited = await page.evaluate((
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
return (classList.includes('active') ||
|
|
576
|
-
classList.includes('filled') ||
|
|
577
|
-
classList.includes('favorited') ||
|
|
578
|
-
ariaPressed === 'true');
|
|
579
|
-
}, favoriteButton);
|
|
571
|
+
// Check if already favorited by looking for 'favorited' class (vs 'not-favorited')
|
|
572
|
+
const isAlreadyFavorited = await page.evaluate((el) => {
|
|
573
|
+
return el.classList.contains('favorited');
|
|
574
|
+
}, favoriteControl);
|
|
580
575
|
if (isAlreadyFavorited) {
|
|
581
576
|
return {
|
|
582
577
|
success: true,
|
|
@@ -584,7 +579,7 @@ export class GoodEggsClient {
|
|
|
584
579
|
itemName,
|
|
585
580
|
};
|
|
586
581
|
}
|
|
587
|
-
await
|
|
582
|
+
await favoriteControl.click();
|
|
588
583
|
await page.waitForTimeout(500);
|
|
589
584
|
return {
|
|
590
585
|
success: true,
|
|
@@ -609,24 +604,19 @@ export class GoodEggsClient {
|
|
|
609
604
|
const nameEl = document.querySelector('h1, [class*="product-name"], [class*="title"]');
|
|
610
605
|
return nameEl?.textContent?.trim() || 'Unknown item';
|
|
611
606
|
});
|
|
612
|
-
// Look for the favorite
|
|
613
|
-
const
|
|
614
|
-
if (!
|
|
607
|
+
// Look for the favorite control - Good Eggs uses a div, not a button
|
|
608
|
+
const favoriteControl = await page.$('.product-detail__favorite-control');
|
|
609
|
+
if (!favoriteControl) {
|
|
615
610
|
return {
|
|
616
611
|
success: false,
|
|
617
612
|
message: 'Could not find favorite button',
|
|
618
613
|
itemName,
|
|
619
614
|
};
|
|
620
615
|
}
|
|
621
|
-
// Check if
|
|
622
|
-
const isFavorited = await page.evaluate((
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
return (classList.includes('active') ||
|
|
626
|
-
classList.includes('filled') ||
|
|
627
|
-
classList.includes('favorited') ||
|
|
628
|
-
ariaPressed === 'true');
|
|
629
|
-
}, favoriteButton);
|
|
616
|
+
// Check if favorited by looking for 'favorited' class (vs 'not-favorited')
|
|
617
|
+
const isFavorited = await page.evaluate((el) => {
|
|
618
|
+
return el.classList.contains('favorited');
|
|
619
|
+
}, favoriteControl);
|
|
630
620
|
if (!isFavorited) {
|
|
631
621
|
return {
|
|
632
622
|
success: true,
|
|
@@ -634,7 +624,7 @@ export class GoodEggsClient {
|
|
|
634
624
|
itemName,
|
|
635
625
|
};
|
|
636
626
|
}
|
|
637
|
-
await
|
|
627
|
+
await favoriteControl.click();
|
|
638
628
|
await page.waitForTimeout(500);
|
|
639
629
|
return {
|
|
640
630
|
success: true,
|