工具:search_places
當使用者要求尋找地點、商家、地址、位置、景點或任何其他 Google 地圖相關搜尋時,請呼叫這項工具。
輸入規定 (重要):
text_query(字串 - 必填):主要搜尋查詢。這項資訊必須清楚定義使用者要尋找的內容。- 示例:
'restaurants in New York'、'coffee shops near Golden Gate Park'、'SF MoMA'、'1600 Amphitheatre Pkwy, Mountain View, CA, USA'、'pets friendly parks in Manhattan, New York'、'date night restaurants in Chicago'、'accessible public libraries in Los Angeles'。
- 如要取得特定地點的詳細資料:請加入要求的屬性 (例如
'Google Store Mountain View opening hours'、'SF MoMa phone number'、'Shoreline Park Mountain View address')。
- 示例:
location_bias(物件 - 選用):使用這個物件,優先顯示特定地理區域附近的結果。- 格式:
{"location_bias": {"circle": {"center": {"latitude": [value], "longitude": [value]}, "radius_meters": [value (optional)]}}}
- 使用方式:
- 將半徑設為 5 公里:
{"location_bias": {"circle": {"center": {"latitude": 34.052235, "longitude": -118.243683}, "radius_meters": 5000}}} - 如要強烈偏向中心點:
{"location_bias": {"circle": {"center": {"latitude": 34.052235, "longitude": -118.243683}}}}(省略radius_meters)。
- 將半徑設為 5 公里:
- 格式:
language_code(字串 - 選用):顯示搜尋結果摘要的語言。- 格式:雙字母語言代碼 (ISO 639-1),後面可選擇加上底線和雙字母國家/地區代碼 (ISO 3166-1 alpha-2),例如
en、ja、en_US、zh_CN、es_MX。如未提供語言代碼,結果會以英文顯示。
- 格式:雙字母語言代碼 (ISO 639-1),後面可選擇加上底線和雙字母國家/地區代碼 (ISO 3166-1 alpha-2),例如
region_code(字串 - 選用):使用者的 Unicode CLDR 區域代碼。這個參數用於顯示地點詳細資料,例如特定區域的地點名稱 (如有)。根據適用法律,這項參數可能會影響結果。- 格式:由兩個英文字母組成的國家/地區代碼 (ISO 3166-1 alpha-2),例如
US,CA。
- 格式:由兩個英文字母組成的國家/地區代碼 (ISO 3166-1 alpha-2),例如
工具呼叫的指示:
位置資訊 (重要):搜尋內容必須包含足夠的位置資訊。如果地點不明確 (例如只有「披薩店」),您必須在
text_query中指定地點 (例如 「紐約市的披薩店」),或使用location_bias參數。如需消歧義,請加入城市、州/省和區域/國家/地區名稱。請盡量提供最具體且語境豐富的
text_query。只有在明確提供座標,或從使用者已知情境推斷位置資訊是適當且有助於提升結果品質時,才使用
location_bias。
下列範例示範如何使用 curl 叫用 search_places MCP 工具。
| Curl 要求 |
|---|
curl --location 'https://mapstools.googleapis.com/mcp' \ --header 'content-type: application/json' \ --header 'accept: application/json, text/event-stream' \ --data '{ "method": "tools/call", "params": { "name": "search_places", "arguments": { // provide these details according to the tool's MCP specification } }, "jsonrpc": "2.0", "id": 1 }' |
輸入結構定義
SearchText 的要求訊息。
SearchTextRequest
| JSON 表示法 |
|---|
{ "textQuery": string, "languageCode": string, "regionCode": string, "pageSize": integer, "pageToken": string, // Union field |
| 欄位 | |
|---|---|
textQuery |
必填。文字查詢。 |
languageCode |
(選用步驟) 要求摘要回覆時使用的語言。如果語言代碼未指定或無法辨識,系統會傳回偏好使用英文的摘要。 例如「en」代表英文。 目前支援的語言清單:https://developers.google.com/maps/faq#languagesupport。 |
regionCode |
(選用步驟) 要求來源位置的 Unicode 國家/地區代碼 (CLDR)。這個參數用於顯示地點詳細資料,例如特定區域的地點名稱 (如有)。根據適用法律,這項參數可能會影響結果。 例如「US」代表美國。 詳情請參閱 https://www.unicode.org/cldr/charts/latest/supplemental/territory_language_information.html。 請注意,系統目前不支援 3 位數的區域代碼。 |
pageSize |
(選用步驟) 要傳回的地點數量上限。服務傳回的產品數量可能會少於這個值。 |
pageToken |
(選用步驟) 屬於接收自前一個 |
聯集欄位
|
|
locationBias |
可選用的區域,用於調整搜尋結果。如果 |
LocationBias
| JSON 表示法 |
|---|
{
"circle": {
object ( |
| 欄位 | |
|---|---|
circle |
(選用步驟) 以中心點和半徑定義的圓形。 |
圓形
| JSON 表示法 |
|---|
{ "center": { object ( |
| 欄位 | |
|---|---|
center |
必填。圓形的中心點。 |
聯集欄位
|
|
radiusMeters |
圓形的半徑 (以公尺為單位)。半徑必須在 50,000 公尺內。 |
LatLng
| JSON 表示法 |
|---|
{ "latitude": number, "longitude": number } |
| 欄位 | |
|---|---|
latitude |
緯度度數,必須介於 [-90.0, +90.0] 的範圍之間。 |
longitude |
經度度數,必須介於 [-180.0, +180.0] 的範圍之間。 |
輸出內容的結構定義
SearchText 的回應訊息。
SearchTextResponse
| JSON 表示法 |
|---|
{
"places": [
{
object ( |
| 欄位 | |
|---|---|
places[] |
僅供輸出。摘要中提及的地點清單。 |
summary |
僅供輸出。搜尋結果的自然語言摘要。摘要可能包含以零為基準的引文,例如「[0]」、「[1]」、「[2]」等。這些引文會對應至 |
nextPageToken |
(選用步驟) 可做為 |
PlaceView
| JSON 表示法 |
|---|
{ "place": string, "id": string, "googleMapsLinks": { object ( |
| 欄位 | |
|---|---|
place |
基礎地點的資源名稱,格式為「places/{id}」。 |
id |
基礎地點的地點 ID。 |
googleMapsLinks |
可觸發不同 Google 地圖動作的連結。 |
聯集欄位
|
|
location |
這個地點的位置。 |
LatLng
| JSON 表示法 |
|---|
{ "latitude": number, "longitude": number } |
| 欄位 | |
|---|---|
latitude |
緯度度數,必須介於 [-90.0, +90.0] 的範圍之間。 |
longitude |
經度度數,必須介於 [-180.0, +180.0] 的範圍之間。 |
GoogleMapsLinks
| JSON 表示法 |
|---|
{ "directionsUrl": string, "placeUrl": string, "writeAReviewUrl": string, "reviewsUrl": string, "photosUrl": string } |
| 欄位 | |
|---|---|
directionsUrl |
顯示前往該地點路線的連結。這個連結只會填入目的地位置,並使用預設的交通方式 |
placeUrl |
顯示這個地點的連結。 |
writeAReviewUrl |
在 Google 地圖上為這個地點撰寫評論的連結。 |
reviewsUrl |
連結:在 Google 地圖上顯示這個地點的評論。 |
photosUrl |
連結:在 Google 地圖上顯示這個地點的評論。 |
工具註解
破壞性提示:❌ | 等冪提示:❌ | 唯讀提示:✅ | 開放世界提示:❌