MCP Tools Reference: mapstools.googleapis.com

工具:lookup_weather

擷取完整的天氣資料,包括目前天氣狀況、每小時和每日預報。可用的特定資料:溫度 (目前、體感、最高/最低、熱指數)、風 (風速、陣風、風向)、天象 (日出/日落、月相)、降水 (類型、機率、量/QPF)、大氣狀況 (紫外線指數、濕度、雲量、雷雨機率) 和地理編碼位置地址。地點和地點規則 (重要):使用「location」欄位指定要查詢天氣資料的地點。這個欄位是「oneof」結構,也就是說,您「必須」只為下列三個位置子欄位中的「其中一個」提供值,才能確保天氣資料查詢結果準確無誤。1. 地理座標 (lat_lng) * 如果您有確切的經緯度座標,請使用這項屬性。 * 示例:「lat_lng」:{「latitude」: 34.0522,「longitude」: -118.2437} // 洛杉磯 2. 地點 ID (place_id) * 不含二義性的字串 ID (Google 地圖地點 ID)。 * place_id 可從 search_places 工具擷取。 * 示例:「place_id」:「ChIJLU7jZClu5kcR4PcOOO6p3I0」// 艾菲爾鐵塔 3. 地址字串 (address) * 自由格式的字串,必須具體明確才能進行地理編碼。 * 城市和區域:請務必加入區域/國家/地區 (例如「英國倫敦」,而非「倫敦」。* 街道地址:提供完整地址 (例如 「1600 Pennsylvania Ave NW, Washington, DC」)。* 郵遞區號:必須附上國家/地區名稱 (例如 「美國 90210」,而非「90210」)。使用模式:1. 目前天氣:僅提供 address。請勿指定 datehour。2. 每小時天氣預報:提供 addressdatehour (0 到 23)。用於特定時間 (例如「下午 5 點」) 或「接下來幾小時」或「今天稍晚」等字詞。如果使用者指定分鐘,則會四捨五入至最接近的小時。系統不支援超過 48 小時的每小時天氣預報。3. 每日預報:提供 addressdate。請勿指定 hour。用於一般日期要求 (例如 「明天天氣」、「週五天氣」、「12 月 25 日天氣」。如果對話內容中沒有今天的日期,請向使用者確認。系統不支援今天起算 7 天後的每日預報。系統不支援歷史天氣資訊。參數限制: * 時區:所有 datehour 輸入內容都必須以地點的當地時區為準,而非使用者的時區。* 日期格式:輸入內容必須以 {year, month, day} 個整數分隔。* 單位:預設為 METRIC。如果使用者暗示採用美國標準或明確要求,請將 units_system 設為 IMPERIAL (華氏/英里)。

以下範例示範如何使用 curl 叫用 lookup_weather 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": "lookup_weather",
    "arguments": {
      // provide these details according to the tool's MCP specification
    }
  },
  "jsonrpc": "2.0",
  "id": 1
}'
                

輸入結構定義

要求 LookupWeather 方法 - 代表所要求位置的天氣狀況。

LookupWeatherRequest

JSON 表示法
{
  "DEPRECATEDAddress": string,
  "unitsSystem": enum (UnitsSystem),
  "location": {
    object (Location)
  },

  // Union field _date can be only one of the following:
  "date": {
    object (google.type.Date)
  }
  // End of list of possible types for union field _date.

  // Union field _hour can be only one of the following:
  "hour": integer
  // End of list of possible types for union field _hour.
}
欄位
DEPRECATEDAddress
(deprecated)

string

已淘汰:請改用位置。

unitsSystem

enum (UnitsSystem)

(選用步驟) 用於回傳天氣狀況的單位系統。如未提供,系統會以公制單位傳回天氣狀況 (預設值 = METRIC)。

location

object (Location)

必填。要取得天氣狀況的位置。

聯集欄位 _date

_date 只能是下列其中一個設定:

date

object (google.type.Date)

(選用步驟) 需要天氣資訊的日期。注意:這個日期是相對於位置欄位中指定位置的當地時區。日期必須在未來 7 天內。

聯集欄位 _hour

_hour 只能是下列其中一個設定:

hour

integer

(選用步驟) 以 24 小時制 (0-23) 表示要求天氣資訊的小時。這個值與位置欄位中指定位置的當地時區有關。每小時天氣預報僅支援目前時間起 48 小時內的天氣。

日期

JSON 表示法
{
  "year": integer,
  "month": integer,
  "day": integer
}
欄位
year

integer

日期年份。必須為 1 到 9999;如要指定不含年份的日期,請輸入 0。

month

integer

一年中的月份。必須為 1 到 12;如要指定不含日期的年份,請輸入 0。

day

integer

當月第幾日。必須為 1 到 31,並屬於有效的年和月;如果只指定年份,或只指定年份和月份,而不指定當月第幾日的話,請輸入 0。

位置

JSON 表示法
{

  // Union field location_type can be only one of the following:
  "latLng": {
    object (google.type.LatLng)
  },
  "placeId": string,
  "address": string
  // End of list of possible types for union field location_type.
}
欄位
聯集欄位 location_type。表示位置的不同方式。location_type 只能是下列其中一項:
latLng

object (google.type.LatLng)

使用地理座標指定的點。

placeId

string

與該地點相關聯的地點 ID。

address

string

使用者可理解的地址或 Plus Code。詳情請參閱 https://plus.codes

LatLng

JSON 表示法
{
  "latitude": number,
  "longitude": number
}
欄位
latitude

number

緯度度數,必須介於 [-90.0, +90.0] 的範圍之間。

longitude

number

經度度數,必須介於 [-180.0, +180.0] 的範圍之間。

輸出內容的結構定義

LookupWeather RPC 的回應 - 代表要求位置的天氣狀況。

這項回應代表每小時和每日資訊,因此回應會分成三節:每小時、每日和共用。「僅限每小時」和「僅限每日」欄位標示為選填。在「每小時」和「每日」資訊共用的欄位中,有些欄位一律會顯示,因此不會標示為選填;其餘欄位則會標示為選填,因為這些欄位不一定會顯示。

LookupWeatherResponse

JSON 表示法
{
  "weatherCondition": {
    object (WeatherCondition)
  },
  "precipitation": {
    object (Precipitation)
  },
  "wind": {
    object (Wind)
  },
  "DEPRECATEDGeocodedAddress": string,
  "returnedLocation": {
    object (Location)
  },

  // Union field _temperature can be only one of the following:
  "temperature": {
    object (Temperature)
  }
  // End of list of possible types for union field _temperature.

  // Union field _feels_like_temperature can be only one of the following:
  "feelsLikeTemperature": {
    object (Temperature)
  }
  // End of list of possible types for union field _feels_like_temperature.

  // Union field _heat_index can be only one of the following:
  "heatIndex": {
    object (Temperature)
  }
  // End of list of possible types for union field _heat_index.

  // Union field _air_pressure can be only one of the following:
  "airPressure": {
    object (AirPressure)
  }
  // End of list of possible types for union field _air_pressure.

  // Union field _max_temperature can be only one of the following:
  "maxTemperature": {
    object (Temperature)
  }
  // End of list of possible types for union field _max_temperature.

  // Union field _min_temperature can be only one of the following:
  "minTemperature": {
    object (Temperature)
  }
  // End of list of possible types for union field _min_temperature.

  // Union field _feels_like_max_temperature can be only one of the following:
  "feelsLikeMaxTemperature": {
    object (Temperature)
  }
  // End of list of possible types for union field _feels_like_max_temperature.

  // Union field _feels_like_min_temperature can be only one of the following:
  "feelsLikeMinTemperature": {
    object (Temperature)
  }
  // End of list of possible types for union field _feels_like_min_temperature.

  // Union field _max_heat_index can be only one of the following:
  "maxHeatIndex": {
    object (Temperature)
  }
  // End of list of possible types for union field _max_heat_index.

  // Union field _sun_events can be only one of the following:
  "sunEvents": {
    object (SunEvents)
  }
  // End of list of possible types for union field _sun_events.

  // Union field _moon_events can be only one of the following:
  "moonEvents": {
    object (MoonEvents)
  }
  // End of list of possible types for union field _moon_events.

  // Union field _relative_humidity can be only one of the following:
  "relativeHumidity": integer
  // End of list of possible types for union field _relative_humidity.

  // Union field _uv_index can be only one of the following:
  "uvIndex": integer
  // End of list of possible types for union field _uv_index.

  // Union field _thunderstorm_probability can be only one of the following:
  "thunderstormProbability": integer
  // End of list of possible types for union field _thunderstorm_probability.

  // Union field _cloud_cover can be only one of the following:
  "cloudCover": integer
  // End of list of possible types for union field _cloud_cover.
}
欄位
weatherCondition

object (WeatherCondition)

天氣狀況

precipitation

object (Precipitation)

降水機率和累積降水量

wind

object (Wind)

風況

DEPRECATEDGeocodedAddress
(deprecated)

string

已淘汰:請改用 returned_location。

returnedLocation

object (Location)

必填。系統傳回天氣資訊的位置。這個位置與要求中的位置相同,但如果要求的位置是自由格式的地址,且會查詢粗略位置 (例如「加州山景城」),則可能與要求中的位置不同。

聯集欄位 _temperature

_temperature 只能是下列其中一個設定:

temperature

object (Temperature)

每小時溫度

聯集欄位 _feels_like_temperature

_feels_like_temperature 只能是下列其中一個設定:

feelsLikeTemperature

object (Temperature)

每小時的體感溫度。

聯集欄位 _heat_index

_heat_index 只能是下列其中一個設定:

heatIndex

object (Temperature)

每小時的酷熱指數溫度。

聯集欄位 _air_pressure

_air_pressure 只能是下列其中一個設定:

airPressure

object (AirPressure)

每小時的氣壓狀況。

聯集欄位 _max_temperature

_max_temperature 只能是下列其中一個設定:

maxTemperature

object (Temperature)

當天的最高溫度。

聯集欄位 _min_temperature

_min_temperature 只能是下列其中一個設定:

minTemperature

object (Temperature)

當天的最低溫度。

聯集欄位 _feels_like_max_temperature

_feels_like_max_temperature 只能是下列其中一個設定:

feelsLikeMaxTemperature

object (Temperature)

全天最高體感溫度。

聯集欄位 _feels_like_min_temperature

_feels_like_min_temperature 只能是下列其中一個設定:

feelsLikeMinTemperature

object (Temperature)

全天最低體感溫度。

聯集欄位 _max_heat_index

_max_heat_index 只能是下列其中一個設定:

maxHeatIndex

object (Temperature)

當天最高體感溫度。

聯集欄位 _sun_events

_sun_events 只能是下列其中一個設定:

sunEvents

object (SunEvents)

與太陽相關的事件 (例如日出、日落)。

聯集欄位 _moon_events

_moon_events 只能是下列其中一個設定:

moonEvents

object (MoonEvents)

與月亮相關的事件 (例如月出、月落)。

聯集欄位 _relative_humidity

_relative_humidity 只能是下列其中一個設定:

relativeHumidity

integer

相對濕度百分比 (值介於 0 到 100 之間)。定義為選用,因為並非一律提供

聯集欄位 _uv_index

_uv_index 只能是下列其中一個設定:

uvIndex

integer

紫外線 (UV) 指數上限。定義為選用,因為並非一律提供

聯集欄位 _thunderstorm_probability

_thunderstorm_probability 只能是下列其中一個設定:

thunderstormProbability

integer

雷雨機率 (值介於 0 到 100 之間)。定義為選用,因為並非一律提供

聯集欄位 _cloud_cover

_cloud_cover 只能是下列其中一個設定:

cloudCover

integer

雲層遮蔽天空的百分比 (值介於 0 到 100 之間)。定義為選用,因為並非一律可用

溫度

JSON 表示法
{
  "unit": enum (TemperatureUnit),

  // Union field _degrees can be only one of the following:
  "degrees": number
  // End of list of possible types for union field _degrees.
}
欄位
unit

enum (TemperatureUnit)

用來測量溫度值的單位代碼。

聯集欄位 _degrees

_degrees 只能是下列其中一個設定:

degrees

number

指定單位的溫度值 (以度為單位)。

AirPressure

JSON 表示法
{

  // Union field _mean_sea_level_millibars can be only one of the following:
  "meanSeaLevelMillibars": number
  // End of list of possible types for union field _mean_sea_level_millibars.
}
欄位

聯集欄位 _mean_sea_level_millibars

_mean_sea_level_millibars 只能是下列其中一個設定:

meanSeaLevelMillibars

number

平均海平面氣壓,單位為毫巴。

SunEvents

JSON 表示法
{
  "sunriseTime": string,
  "sunsetTime": string
}
欄位
sunriseTime

string (Timestamp format)

太陽升起的時間。

注意:在某些特殊情況下 (例如北極圈以北),當天可能沒有日出時間。在這些情況下,這個欄位會保持未設定狀態。

使用 RFC 3339,產生的輸出內容一律會經過 Z 正規化,並使用 0、3、6 或 9 個小數位數,也接受「Z」以外的偏移量。範例:"2014-10-02T15:01:23Z""2014-10-02T15:01:23.045123456Z""2014-10-02T15:01:23+05:30"

sunsetTime

string (Timestamp format)

太陽下山的時間。

注意:在某些特殊情況下 (例如北極圈以北),一天可能沒有日落時間。在這些情況下,這個欄位會保持未設定狀態。

使用 RFC 3339,產生的輸出內容一律會經過 Z 正規化,並使用 0、3、6 或 9 個小數位數,也接受「Z」以外的偏移量。範例:"2014-10-02T15:01:23Z""2014-10-02T15:01:23.045123456Z""2014-10-02T15:01:23+05:30"

時間戳記

JSON 表示法
{
  "seconds": string,
  "nanos": integer
}
欄位
seconds

string (int64 format)

代表自 Unix 紀元 1970-01-01T00:00:00Z 起算的世界標準時間秒數。必須介於 -62135596800 和 253402300799 之間 (含),對應至 0001-01-01T00:00:00Z 至 9999-12-31T23:59:59Z。

nanos

integer

以奈秒為單位的非負值秒數小數。這個欄位是時間長度的奈秒部分,並非秒數的替代值。如果秒數值為負數,且包含小數,奈秒值仍須為非負數,且會向前計時。必須介於 0 至 999,999,999 之間 (含)。

MoonEvents

JSON 表示法
{
  "moonriseTimes": [
    string
  ],
  "moonsetTimes": [
    string
  ],
  "moonPhase": enum (MoonPhase)
}
欄位
moonriseTimes[]

string (Timestamp format)

月球上肢出現在地平線上的時間 (請參閱 https://en.wikipedia.org/wiki/Moonrise_and_moonset)

注意:在大多數情況下,每天只會顯示一次月出時間。在其他情況下,清單可能會空白 (例如月亮在隔天午夜後升起)。不過,在特殊情況下 (例如極地地區),清單可能包含多個值。在這些情況下,值會依遞增順序排序。

使用 RFC 3339,產生的輸出內容一律會經過 Z 正規化,並使用 0、3、6 或 9 個小數位數,也接受「Z」以外的偏移量。範例:"2014-10-02T15:01:23Z""2014-10-02T15:01:23.045123456Z""2014-10-02T15:01:23+05:30"

moonsetTimes[]

string (Timestamp format)

月球上緣消失在地平線下的時間 (請參閱 https://en.wikipedia.org/wiki/Moonrise_and_moonset)

注意:在大多數情況下,每天只會有一段月出時間。在其他情況下,清單可能會是空白 (例如月亮在隔天午夜後落下)。不過,在特殊情況下 (例如極地地區),清單可能包含多個值。在這些情況下,值會依遞增順序排序。

使用 RFC 3339,產生的輸出內容一律會經過 Z 正規化,並使用 0、3、6 或 9 個小數位數,也接受「Z」以外的偏移量。範例:"2014-10-02T15:01:23Z""2014-10-02T15:01:23.045123456Z""2014-10-02T15:01:23+05:30"

moonPhase

enum (MoonPhase)

月相。

WeatherCondition

JSON 表示法
{
  "iconBaseUri": string,
  "description": {
    object (google.type.LocalizedText)
  },
  "type": enum (Type)
}
欄位
iconBaseUri

string

圖示的基準 URI,不含檔案類型副檔名。如要顯示圖示,請視需要附加主題和檔案類型副檔名 (.png.svg) 至這個 URI。根據預設,圖示會採用淺色主題,但可以附加 _dark,改為深色模式。例如:「https://maps.gstatic.com/weather/v1/dust.svg」或「https://maps.gstatic.com/weather/v1/dust_dark.svg」,其中 icon_base_uri 是「https://maps.gstatic.com/weather/v1/dust」。

description

object (google.type.LocalizedText)

此天氣狀況的文字說明 (已本地化)。

type

enum (Type)

天氣狀況類型。

LocalizedText

JSON 表示法
{
  "text": string,
  "languageCode": string
}
欄位
text

string

與下方 google.type.LocalizedText.language_code 對應的語言版本字串。

languageCode

string

文字的 BCP-47 語言代碼,例如「en-US」或「sr-Latn」。

詳情請參閱 http://www.unicode.org/reports/tr35/#Unicode_locale_identifier

降水率

JSON 表示法
{
  "probability": {
    object (PrecipitationProbability)
  },
  "snowQpf": {
    object (QuantitativePrecipitationForecast)
  },
  "qpf": {
    object (QuantitativePrecipitationForecast)
  }
}
欄位
probability

object (PrecipitationProbability)

降雨機率 (值介於 0 到 100 之間)。

snowQpf

object (QuantitativePrecipitationForecast)

一段時間內累積的雪量,以等量的液態水測量。注意:QPF 是定量降水預報的縮寫 (詳情請參閱「定量降水預報」定義)。

qpf

object (QuantitativePrecipitationForecast)

一段時間內累積的降雨量,以等量的液態水測量。注意:QPF 是定量降水預報的縮寫 (詳情請參閱「定量降水預報」定義)。

PrecipitationProbability

JSON 表示法
{
  "type": enum (PrecipitationType),

  // Union field _percent can be only one of the following:
  "percent": integer
  // End of list of possible types for union field _percent.
}
欄位
type

enum (PrecipitationType)

指出降水類型的代碼。

聯集欄位 _percent

_percent 只能是下列其中一個設定:

percent

integer

降水機率,範圍為 0 到 100。

QuantitativePrecipitationForecast

JSON 表示法
{
  "unit": enum (Unit),

  // Union field _quantity can be only one of the following:
  "quantity": number
  // End of list of possible types for union field _quantity.
}
欄位
unit

enum (Unit)

用來測量累積降水量所用的單位代碼。

聯集欄位 _quantity

_quantity 只能是下列其中一個設定:

quantity

number

一段時間內累積的降水量,以等量的液態水測量。

風速

JSON 表示法
{
  "direction": {
    object (WindDirection)
  },
  "speed": {
    object (WindSpeed)
  },
  "gust": {
    object (WindSpeed)
  }
}
欄位
direction

object (WindDirection)

風向,即風吹來的角度。

speed

object (WindSpeed)

風速。

gust

object (WindSpeed)

陣風 (風速突然增加)。

WindDirection

JSON 表示法
{
  "cardinal": enum (CardinalDirection),

  // Union field _degrees can be only one of the following:
  "degrees": integer
  // End of list of possible types for union field _degrees.
}
欄位
cardinal

enum (CardinalDirection)

代表風向的方位代碼。

聯集欄位 _degrees

_degrees 只能是下列其中一個設定:

degrees

integer

風向 (以度為單位,值介於 0 到 360 之間)。

WindSpeed

JSON 表示法
{
  "unit": enum (SpeedUnit),

  // Union field _value can be only one of the following:
  "value": number
  // End of list of possible types for union field _value.
}
欄位
unit

enum (SpeedUnit)

代表用於測量風速的單位。

聯集欄位 _value

_value 只能是下列其中一個設定:

value

number

風速值。

位置

JSON 表示法
{

  // Union field location_type can be only one of the following:
  "latLng": {
    object (google.type.LatLng)
  },
  "placeId": string,
  "address": string
  // End of list of possible types for union field location_type.
}
欄位
聯集欄位 location_type。表示位置的不同方式。location_type 只能是下列其中一項:
latLng

object (google.type.LatLng)

使用地理座標指定的點。

placeId

string

與該地點相關聯的地點 ID。

address

string

使用者可理解的地址或 Plus Code。詳情請參閱 https://plus.codes

LatLng

JSON 表示法
{
  "latitude": number,
  "longitude": number
}
欄位
latitude

number

緯度度數,必須介於 [-90.0, +90.0] 的範圍之間。

longitude

number

經度度數,必須介於 [-180.0, +180.0] 的範圍之間。

工具註解

破壞性提示:❌ | 等冪提示:❌ | 唯讀提示:✅ | 開放世界提示:❌