MCP Tools Reference: mapstools.googleapis.com

ツール: compute_routes

指定された出発地と目的地の間の移動ルートを計算します。サポートされている移動手段: 車(デフォルト)、徒歩。

入力要件(重要): 出発地目的地 の両方が必要です。それぞれ、次のいずれかの方法で指定する必要があります。

  • address: (文字列、例: 'Eiffel Tower, Paris')。注: 入力する住所が詳細であるほど、より的確な結果を得られます。

  • lat_lng: (オブジェクト、{"latitude": 数値, "longitude": 数値})

  • place_id: (文字列、例: 'ChIJOwE_Id1w5EAR4Q27FkL6T_0')注: この ID は search_places ツールで取得できます。入力タイプは自由に組み合わせることができます(例: 出発地は住所、目的地は lat_lng)。出発地または目的地のいずれかが欠けている場合は、ツールを呼び出す前にユーザーに確認する必要があります

ツール呼び出しの例: {"origin":{"address":"Eiffel Tower"},"destination":{"place_id":"ChIJt_5xIthw5EARoJ71mGq7t74"},"travel_mode":"DRIVE"}

  • グラウンディングされた出力は、attribution フィールドの情報を使用して、ソースに帰属させる必要があります(利用可能な場合)。

次のサンプルは、curl を使用して compute_routes 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": "compute_routes",
    "arguments": {
      // provide these details according to the tool's MCP specification
    }
  },
  "jsonrpc": "2.0",
  "id": 1
}'
                

入力スキーマ

ComputeRoutesRequest。

ComputeRoutesRequest

JSON 表現
{
  "origin": {
    object (Waypoint)
  },
  "destination": {
    object (Waypoint)
  },
  "travelMode": enum (RouteTravelMode)
}
フィールド
origin

object (Waypoint)

必須。出発地のウェイポイント。

destination

object (Waypoint)

必須。目的地のウェイポイント。

travelMode

enum (RouteTravelMode)

省略可。移動手段を指定します。

Waypoint

JSON 表現
{

  // Union field location_type can be only one of the following:
  "latLng": {
    object (LatLng)
  },
  "placeId": string,
  "address": string
  // End of list of possible types for union field location_type.
}
フィールド
共用体フィールド location_type。ビジネス拠点を表すさまざまな方法。location_type は次のいずれかになります。
latLng

object (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] 内になければなりません。

出力スキーマ

ComputeRoutesResponse。

ComputeRoutesResponse

JSON 表現
{
  "routes": [
    {
      object (Route)
    }
  ]
}
フィールド
routes[]

object (Route)

リクエストされた出発地と目的地の間のルートが含まれます。現在、返されるルートは 1 つのみです。

ルート

JSON 表現
{
  "distanceMeters": integer,
  "duration": string,
  "attribution": {
    object (Attribution)
  }
}
フィールド
distanceMeters

integer

ルートの移動距離(メートル単位)。

duration

string (Duration format)

ルートの移動に必要な時間。

`s` で終わる小数 9 桁までの秒単位の期間。例: "3.5s"

attribution

object (Attribution)

ルートとともに表示する必須のアトリビューション。

所要時間

JSON 表現
{
  "seconds": string,
  "nanos": integer
}
フィールド
seconds

string (int64 format)

期間の符号付き秒数。-315,576,000,000 ~+315,576,000,000 の範囲内(境界含む)である必要があります。注: これらの上限は、60 秒/分 * 60 分/時間 * 24 時間/日 * 365.25 日/年 * 10,000 年で計算されます。

nanos

integer

期間のナノ秒分解能による、秒の符号付き小数以下部分。1 秒未満の期間は、0 の seconds フィールドと正または負の nanos フィールドで表されます。1 秒以上の期間の場合、nanos フィールドのゼロ以外の値は、seconds フィールドと同じ符号にする必要があります。-999,999,999 ~+999,999,999 の範囲内(境界含む)である必要があります。

アトリビューション

JSON 表現
{
  "title": string,
  "url": string
}
フィールド
title

string

アトリビューションに表示するタイトル。

url

string

アトリビューションのリンク先 URL。

ツールのアノテーション

破壊的ヒント: ❌ | べき等ヒント: ❌ | 読み取り専用ヒント: ✅ | オープン ワールド ヒント: ❌