MCP Tools Reference: mapstools.googleapis.com

工具:lookup_weather

检索全面的天气数据,包括天气实况、每小时预报和每日预报。可用的具体数据:温度(当前温度、体感温度、最高/最低温度、暑热指数)、风(风速、阵风、风向)、天体事件(日出/日落、月相)、降水(类型、概率、降水量/QPF)、大气状况(紫外线指数、湿度、云量、雷暴概率)和地理编码位置地址。位置和位置规则(关键):使用“位置”字段指定请求天气数据的位置。此字段为“oneof”结构,这意味着您必须仅为以下三个位置子字段之一提供值,以确保天气数据查找的准确性。1. 地理坐标 (lat_lng) * 如果您获得了确切的纬度/经度坐标,请使用此参数。 * 示例:“lat_lng”:{“latitude”:34.0522,“longitude”:-118.2437} // 洛杉矶 2. 地点 ID (place_id) * 一个明确的字符串标识符(Google 地图地点 ID)。 * place_id 可从 search_places 工具中获取。* 示例:“place_id”:“ChIJLU7jZClu5kcR4PcOOO6p3I0”// 埃菲尔铁塔 3. 地址字符串(地址)* 一种自由格式的字符串,需要具有明确性才能进行地理编码。* 城市和地区:始终包含地区/国家/地区(例如,“英国伦敦”,而不是“伦敦”)。* 街道地址:提供完整地址(例如,1600 Pennsylvania Ave NW, Washington, DC)。* 邮政编码:必须附带国家/地区名称(例如,“90210, USA”,而不是“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 规范化(即转换为 UTC 零时区格式并在末尾附加 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 规范化(即转换为 UTC 零时区格式并在末尾附加 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)

表示世界协调时间 (UTC) 的秒数(从 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 规范化(即转换为 UTC 零时区格式并在末尾附加 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 规范化(即转换为 UTC 零时区格式并在末尾附加 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 是定量降水预报的缩写(请参阅 QuantitativePrecipitationForecast 定义了解详情)。

qpf

object (QuantitativePrecipitationForecast)

在一段时间内累积的降雨量(以等效液态水衡量)。注意:QPF 是定量降水预报的缩写(请参阅 QuantitativePrecipitationForecast 定义了解详情)。

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

在一段时间内累积的降水量,以液态水当量来衡量。

Wind

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] 范围内。

工具注释

破坏性提示:❌ | 等幂性提示:❌ | 只读提示:✅ | 开放世界提示:❌