mcpField
L
local-pois

local-pois

github.com/braveその他1921.2k 回インストール11 週間前に更新
リポジトリ

local-pois について

local-poisは、検索結果に含まれる場所の詳細を取得するBrave Search APIのエンドポイントです。事前の検索で得たPOI IDを指定し、住所、営業時間、連絡先、評価などの情報を返します。

主な機能

  1. 01POI IDによる場所の詳細取得
  2. 02住所と連絡先の提供
  3. 03評価と営業時間の取得
  4. 04位置情報を使った距離計算

活用シーン

  1. 01店舗の住所や電話番号の確認
  2. 02評価や価格によるレストランの絞り込み
  3. 03店舗の営業時間の確認
  4. 04ユーザー位置からの距離計算

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/brave/brave-search-skills --skill local-pois

インストール後、Claude Code で/local-poisを入力して読み込まれたか確認します。

詳細

ローカルの POI(検索 API)

API キーが必要です:https://api.search.brave.com で取得してください。

プラン:Search プランに含まれています。https://api-dashboard.search.brave.com/app/subscriptions/subscribe をご覧ください。

2 段階のフロー:このエンドポイントを使用するには、事前の検索で POI ID を取得する必要があります。

  1. local-place-search、または result_filter=locations を指定した web-search(locations.results[].id)から POI ID を取得します。
  2. それらの ID をこのエンドポイントに渡して、店舗の詳細情報を取得します。

クイックスタート(cURL)

POI の詳細を取得
curl -s "https://api.search.brave.com/res/v1/local/pois" \
  -H "Accept: application/json" \
  -H "Accept-Encoding: gzip" \
  -H "X-Subscription-Token: ${BRAVE_SEARCH_API_KEY}" \
  -G \
  --data-urlencode "ids=loc4CQWMJWLD4VBEBZ62XQLJTGK6YCJEEJDNAAAAAAA="
位置情報ヘッダーを指定して複数の POI を取得
curl -s "https://api.search.brave.com/res/v1/local/pois" \
  -H "Accept: application/json" \
  -H "Accept-Encoding: gzip" \
  -H "X-Subscription-Token: ${BRAVE_SEARCH_API_KEY}" \
  -H "X-Loc-Lat: 37.7749" \
  -H "X-Loc-Long: -122.4194" \
  -G \
  --data-urlencode "ids=loc4CQWMJWLD4VBEBZ62XQLJTGK6YCJEEJDNAAAAAAA=" \
  --data-urlencode "ids=loc4HTAVTJKP4RBEBZCEMBI3NG26YD4II4PATIHPDYI=" \
  --data-urlencode "units=imperial"

注:POI ID は、ウェブ検索の locations.results[].id で返される不透明な文字列です。ID は一時的なもので、約 8 時間後に有効期限が切れます。上記の ID は例示用です。result_filter=locations を指定した web-search で新しい ID を取得してください。ID には = が含まれる場合があるため、--data-urlencode を使用してください。

エンドポイント

GET https://api.search.brave.com/res/v1/local/pois

認証:X-Subscription-Token: <API_KEY> ヘッダー

パラメーター

パラメーター型必須デフォルト説明
idsstring[]はい—ウェブ検索結果から取得した POI ID(1~20 個)
search_langstringいいえen言語設定(2 文字以上の言語コード)
ui_langstringいいえen-USUI 言語(ロケールコード、例:「en-US」)
unitsstringいいえnullmetric(km)または imperial(マイル)
位置情報ヘッダー(任意)

ユーザーの位置情報を基準に距離を計算する場合:

ヘッダー型範囲説明
X-Loc-Latfloat-90.0~90.0ユーザーの緯度
X-Loc-Longfloat-180.0~180.0ユーザーの経度

レスポンスフィールド

レスポンスの type: "local_pois" には、LocationResult オブジェクトの results 配列が含まれます。

フィールド型説明
titlestring事業者/POI 名
urlstring場所の正規 URL
provider_urlstringプロバイダーのページ URL
typestring常に "location_result"
idstringPOI 識別子(不透明な文字列、有効期間は約 8 時間)
descriptionstring?短い説明
postal_address.typestring常に "PostalAddress"
postal_address.displayAddressstring表示用に整形された住所
postal_address.streetAddressstring?番地
postal_address.addressLocalitystring?市区町村
postal_address.addressRegionstring?州/地域
postal_address.postalCodestring?郵便番号
postal_address.countrystring?国コード
contact.telephonestring?電話番号
contact.emailstring?メールアドレス
rating.ratingValuefloat?平均評価(≥0)
rating.bestRatingfloat?評価の最大値
rating.reviewCountint?レビュー数
rating.profile.namestring?評価プロバイダー名
rating.profile.urlstring?評価プロバイダーの URL
opening_hours.current_dayobject[]?本日の営業時間(abbr_name、full_name、opens、closes)
opening_hours.daysobject[][]?1週間分の各曜日の営業時間(同じ構造)
coordinates[float, float]?[latitude, longitude] のタプル
distance.valuefloat?ユーザーの位置からの距離
distance.unitsstring?距離の単位(km または miles)
categoriesstring[]事業者のカテゴリ(デフォルトは [])
price_rangestring?価格の目安($、$$、$$$、$$$$)
serves_cuisinestring[]?料理の種類(レストラン)
thumbnail.srcstring?サムネイル画像の URL
thumbnail.originalstring?元画像の URL
profilesobject[]?外部プロフィール(name、url、long_name、img)
reviews.reviews_in_foreign_languagebool外国語のレビューがあるかどうか
pictures.resultsobject[]?写真のサムネイル
actionobject?実行するアクション。type(string)と url(string)を含みます
resultsobject[]?関連するウェブ検索結果(meta_url を含む LocationWebResult)
timezonestring?IANA タイムゾーン(例:America/Los_Angeles)
timezone_offsetint?UTC からのタイムゾーンオフセット
レスポンスの例
{
  "type": "local_pois",
  "results": [
    {
      "type": "location_result",
      "title": "Park Mediterranean Grill",
      "url": "https://yelp.com/biz/park-mediterranean-grill-sf",
      "provider_url": "https://yelp.com/biz/park-mediterranean-grill-sf",
      "id": "loc4CQWMJWLD4VBEBZ62XQLJTGK6YCJEEJDNAAAAAAA=",
      "postal_address": {
        "type": "PostalAddress",
        "displayAddress": "123 Main St, San Francisco, CA 94102",
        "streetAddress": "123 Main St",
        "addressLocality": "San Francisco",
        "addressRegion": "CA",
        "postalCode": "94102",
        "country": "US"
      },
      "contact": { "telephone": "+1 415-555-0123" },
      "thumbnail": {
        "src": "https://example.com/thumb.jpg",
        "original": "https://example.com/original.jpg"
      },
      "rating": {
        "ratingValue": 4.5,
        "bestRating": 5.0,
        "reviewCount": 234,
      },
      "opening_hours": {
        "current_day": [
          { "abbr_name": "Mon", "full_name": "Monday", "opens": "07:00", "closes": "21:00" }
        ]
      },
      "coordinates": [37.7749, -122.4194],
      "distance": { "value": 0.3, "units": "miles" },
      "categories": ["Mediterranean", "Greek"],
      "price_range": "$$",
      "serves_cuisine": ["Mediterranean", "Greek"],
      "timezone": "America/Los_Angeles"
    }
  ]
}

POI ID の取得

local-place-search は POI ID を直接返します。POI ID は、result_filter=locations を指定した Web Search API(web-search)からも取得できます。

# 1. Search for local businesses
curl -s "https://api.search.brave.com/res/v1/web/search?q=coffee+shops+near+me&result_filter=locations" \
  -H "Accept: application/json" \
  -H "X-Subscription-Token: ${BRAVE_SEARCH_API_KEY}" \
  -H "X-Loc-Lat: 37.7749" \
  -H "X-Loc-Long: -122.4194"

# 2. Extract POI IDs from locations.results[].id
# 3. Use those IDs with this endpoint

ユースケース

  • 地域の事業者情報の検索:ウェブ検索で見つかった POI の詳細情報(営業時間、連絡先、住所)を取得します
  • レストラン検索のパイプライン:レストランを検索し、POI の詳細情報を取得して、料理の種類、評価、価格帯で絞り込みます
  • 営業時間の確認:事業者の opening_hours を取得し、現在営業中かどうかを判断します
  • 位置情報を活用するアプリケーション:位置情報ヘッダーと組み合わせて、近隣の POI までの距離を計算します

注意事項

  • ID 形式:不透明な文字列です(cURL では --data-urlencode を使用してください)
  • 単位:距離の測定方法の設定には metric または imperial を指定します
  • ID の最大数:1 リクエストにつき最大 20 個の ID を指定できます

コメント