Skip to content

Conversation

@meirk-brd
Copy link
Collaborator

Summary

This PR adds geo-location targeting support to the search_engine and search_engine_batch tools, allowing users to specify a 2-letter country code to get geo-targeted Google search results from specific locations.

Changes

Core Functionality

  • Updated search_url() function
    • Added geo_location parameter to the function signature
    • Appends &gl={country_code} query parameter to Google search URLs when geo_location is provided
    • No changes to Bing and Yandex URL generation

Tool Updates

  1. search_engine tool

    • Added optional geo_location parameter (2-letter country code string)
    • Updated execute function to pass geo_location to search_url()
    • Fixed Google URL formatting by adding &brd_json=1 to the URL parameter
  2. search_engine_batch tool

    • Added optional geo_location parameter to query object schema
    • Updated map function to destructure and pass geo_location for each query
    • Fixed Google URL formatting by adding &brd_json=1 to the URL parameter

Usage Examples

Single Search with Geo-Location

{
  query: "pizza delivery",
  engine: "google",
  geo_location: "us"  // Get results from United States
}

Batch Search with Different Locations

{
  queries: [
    {
      query: "best restaurants",
      engine: "google",
      geo_location: "uk"  // Results from United Kingdom
    },
    {
      query: "best restaurants",
      engine: "google",
      geo_location: "fr"  // Results from France
    }
  ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants