[PR #14] [MERGED] feat: Add Google Reviews integration with branch matching #14

Closed
opened 2026-02-27 15:56:49 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/rersozlu/food402/pull/14
Author: @lemogras
Created: 2/2/2026
Status: Merged
Merged: 2/3/2026
Merged by: @rersozlu

Base: masterHead: feat/google-reviews-integration


📝 Commits (3)

  • b358dab feat: add Google Reviews integration with branch matching
  • e7018ed Merge branch 'master' into feat/google-reviews-integration
  • 1d78770 refactor: modularize Google Reviews into shared/modules/google-reviews

📊 Changes

18 files changed (+3844 additions, -811 deletions)

View changed files

.env.example (+11 -0)
📝 README.md (+32 -0)
📝 package-lock.json (+2176 -809)
📝 package.json (+5 -2)
📝 shared/api.ts (+18 -0)
shared/modules/google-reviews/api.ts (+274 -0)
shared/modules/google-reviews/cache.test.ts (+238 -0)
shared/modules/google-reviews/cache.ts (+144 -0)
shared/modules/google-reviews/index.ts (+41 -0)
shared/modules/google-reviews/matching.test.ts (+170 -0)
shared/modules/google-reviews/matching.ts (+184 -0)
shared/modules/google-reviews/types.ts (+140 -0)
shared/modules/google-reviews/utils.ts (+111 -0)
📝 shared/types.ts (+8 -0)
📝 src/api.ts (+18 -0)
src/google-reviews.test.ts (+230 -0)
📝 src/index.ts (+35 -0)
vitest.config.ts (+9 -0)

📄 Description

Summary

Adds a new get_google_reviews MCP tool that fetches ratings and reviews from Google Places API for any restaurant. This helps users make better dining decisions by comparing TGO ratings with Google ratings and reading recent customer reviews.

Key Features

  • Intelligent Branch Matching - Correctly identifies the right restaurant location (crucial for chains like McDonald's, Burger King, etc.) using a weighted algorithm:

    • 40% Name similarity (handles Turkish characters, abbreviations)
    • 35% Distance consistency (compares Google vs TGO distance from user)
    • 25% Neighborhood match (verifies address contains expected area)
  • Rating Comparison - Shows both TGO and Google ratings side-by-side with a summary (e.g., "Google rates 0.3 higher than TGO")

  • Recent Reviews - Returns up to 10 most recent reviews sorted by date

  • Cost Efficient - 24-hour caching reduces API calls; on-demand fetching (not auto-enrichment) keeps costs low

  • Graceful Degradation - Works without API key configured (returns helpful error message)

Usage

get_google_reviews({
  restaurantId: 12345,
  restaurantName: "Kebap 49 Çayyolu",
  neighborhoodName: "Çayyolu",
  tgoDistance: 1.6,
  tgoRating: 4.7,
  latitude: "39.123",
  longitude: "32.456"
})

Configuration

Requires GOOGLE_PLACES_API_KEY environment variable (optional - feature gracefully disabled without it).

Test Plan

  • 19 unit tests for branch matching algorithm
  • Manual testing with real restaurants in Claude Desktop
  • Verified correct branch matching for chain restaurants
  • Confirmed graceful handling without API key

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/rersozlu/food402/pull/14 **Author:** [@lemogras](https://github.com/lemogras) **Created:** 2/2/2026 **Status:** ✅ Merged **Merged:** 2/3/2026 **Merged by:** [@rersozlu](https://github.com/rersozlu) **Base:** `master` ← **Head:** `feat/google-reviews-integration` --- ### 📝 Commits (3) - [`b358dab`](https://github.com/rersozlu/food402/commit/b358dab91b74136096dea3f1f7735e770ad5bd14) feat: add Google Reviews integration with branch matching - [`e7018ed`](https://github.com/rersozlu/food402/commit/e7018ed27ea3b6fedd3c9f470f46725a14f577ff) Merge branch 'master' into feat/google-reviews-integration - [`1d78770`](https://github.com/rersozlu/food402/commit/1d78770ec8710946098761088da8fa5bb2d5624a) refactor: modularize Google Reviews into shared/modules/google-reviews ### 📊 Changes **18 files changed** (+3844 additions, -811 deletions) <details> <summary>View changed files</summary> ➕ `.env.example` (+11 -0) 📝 `README.md` (+32 -0) 📝 `package-lock.json` (+2176 -809) 📝 `package.json` (+5 -2) 📝 `shared/api.ts` (+18 -0) ➕ `shared/modules/google-reviews/api.ts` (+274 -0) ➕ `shared/modules/google-reviews/cache.test.ts` (+238 -0) ➕ `shared/modules/google-reviews/cache.ts` (+144 -0) ➕ `shared/modules/google-reviews/index.ts` (+41 -0) ➕ `shared/modules/google-reviews/matching.test.ts` (+170 -0) ➕ `shared/modules/google-reviews/matching.ts` (+184 -0) ➕ `shared/modules/google-reviews/types.ts` (+140 -0) ➕ `shared/modules/google-reviews/utils.ts` (+111 -0) 📝 `shared/types.ts` (+8 -0) 📝 `src/api.ts` (+18 -0) ➕ `src/google-reviews.test.ts` (+230 -0) 📝 `src/index.ts` (+35 -0) ➕ `vitest.config.ts` (+9 -0) </details> ### 📄 Description ## Summary Adds a new `get_google_reviews` MCP tool that fetches ratings and reviews from Google Places API for any restaurant. This helps users make better dining decisions by comparing TGO ratings with Google ratings and reading recent customer reviews. ### Key Features - **Intelligent Branch Matching** - Correctly identifies the right restaurant location (crucial for chains like McDonald's, Burger King, etc.) using a weighted algorithm: - 40% Name similarity (handles Turkish characters, abbreviations) - 35% Distance consistency (compares Google vs TGO distance from user) - 25% Neighborhood match (verifies address contains expected area) - **Rating Comparison** - Shows both TGO and Google ratings side-by-side with a summary (e.g., "Google rates 0.3 higher than TGO") - **Recent Reviews** - Returns up to 10 most recent reviews sorted by date - **Cost Efficient** - 24-hour caching reduces API calls; on-demand fetching (not auto-enrichment) keeps costs low - **Graceful Degradation** - Works without API key configured (returns helpful error message) ## Usage ``` get_google_reviews({ restaurantId: 12345, restaurantName: "Kebap 49 Çayyolu", neighborhoodName: "Çayyolu", tgoDistance: 1.6, tgoRating: 4.7, latitude: "39.123", longitude: "32.456" }) ``` ## Configuration Requires `GOOGLE_PLACES_API_KEY` environment variable (optional - feature gracefully disabled without it). ## Test Plan - [x] 19 unit tests for branch matching algorithm - [x] Manual testing with real restaurants in Claude Desktop - [x] Verified correct branch matching for chain restaurants - [x] Confirmed graceful handling without API key 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 15:56:49 +03:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/food402#14
No description provided.