{
  "descriptorVersion": "1.0.0",
  "name": "find_mtr_next_train_sources",
  "title": "MTR next train sources",
  "description": "Source discovery for MTR real-time next train information, the official line and station list, and the Airport Express timetable and fares: returns the official Hong Kong government data sources (API, feed, file, PDF list or official service), their format, update notes, how to use them, limits and the matching Agoodeal page. Does not fetch or return live records, and is not a booking, diagnosis or eligibility service. No government data is fetched when it is called. Calculation or source matching runs in this page; arguments and results are not uploaded to Agoodeal servers or to Google Analytics, and the result is returned only to the calling agent. Non-sensitive usage metadata (tool name, outcome, execution mode, error code, duration; predefined source IDs for source matching) is reported through the site’s existing Google Analytics 4.",
  "execution": {
    "environment": "browser",
    "interface": "WebMCP imperative API: document.modelContext.registerTool (experimental)",
    "executionMode": "source_discovery",
    "pageUrls": [
      "https://www.agoodeal.com/tools/mtr-next-train/",
      "https://www.agoodeal.com/tools/mtr-next-train/airport-express/"
    ],
    "requirement": "Open one of pageUrls in a browser that exposes document.modelContext. As of October 2026 this is experimental: Chrome 149+ with chrome://flags/#enable-webmcp-testing, or an origin trial that Agoodeal has not joined. Without it the page works normally for people and no tool is registered.",
    "serverEndpoint": null,
    "argumentsEncoding": "JSON object (some browser versions require callers to pass it as a JSON string).",
    "returns": "A JSON string matching outputSchema."
  },
  "annotations": {
    "readOnlyHint": true,
    "untrustedContentHint": false,
    "consequentialHint": false
  },
  "annotationNotes": "readOnlyHint is true: the tool only returns stored official source information and does not change the page.",
  "inputSchema": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
      "topic": {
        "type": "string",
        "enum": [
          "all",
          "next_train",
          "stations",
          "airport_express"
        ],
        "description": "Which official source to return. Omit for all. next_train: Next train times; stations: Lines and stations; airport_express: Airport Express timetable and fares."
      }
    }
  },
  "outputSchema": {
    "oneOf": [
      {
        "type": "object",
        "required": [
          "ok",
          "tool",
          "mode",
          "liveDataFetched",
          "topic",
          "sources",
          "agoodealPage",
          "limits",
          "notice"
        ],
        "properties": {
          "ok": {
            "const": true
          },
          "tool": {
            "type": "string"
          },
          "mode": {
            "const": "source_discovery"
          },
          "liveDataFetched": {
            "const": false
          },
          "topic": {
            "type": "string"
          },
          "pageScope": {
            "type": [
              "string",
              "null"
            ]
          },
          "notice": {
            "type": "string"
          },
          "sources": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "type": "object",
              "required": [
                "id",
                "name",
                "publisher",
                "kind",
                "url",
                "agoodealUse",
                "updateFrequency"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "publisher": {
                  "type": "string"
                },
                "kind": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "datasetUrl": {
                  "type": "string"
                },
                "documentationUrl": {
                  "type": "string"
                },
                "agoodealUse": {
                  "type": "string"
                },
                "updateFrequency": {
                  "type": "string"
                }
              }
            }
          },
          "agoodealPage": {
            "type": "string"
          },
          "coverage": {
            "type": "string"
          },
          "limits": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "howToUse": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "versionedContract": {
            "type": [
              "object",
              "null"
            ]
          },
          "disclaimer": {
            "type": "object",
            "required": [
              "text",
              "url"
            ],
            "properties": {
              "text": {
                "type": "string"
              },
              "textZh": {
                "type": "string"
              },
              "url": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      },
      {
        "type": "object",
        "required": [
          "ok",
          "error"
        ],
        "properties": {
          "ok": {
            "const": false
          },
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "enum": [
                  "invalid_json",
                  "invalid_argument",
                  "unknown_argument",
                  "internal_error"
                ]
              },
              "message": {
                "type": "string"
              },
              "field": {
                "type": "string"
              }
            }
          }
        }
      }
    ]
  },
  "privacy": "Returns stored source records only; no government data is fetched per call and nothing from the page is read. Calculation or source matching runs in this page; arguments and results are not uploaded to Agoodeal servers or to Google Analytics, and the result is returned only to the calling agent. Non-sensitive usage metadata (tool name, outcome, execution mode, error code, duration; predefined source IDs for source matching) is reported through the site’s existing Google Analytics 4.",
  "coverage": "MTR Next Train API for 10 heavy-rail lines (up to four trains per direction), the MTR line and station list, and for the Airport Express the MTR timetable page, average frequency and open fare data.",
  "limits": [
    "Next trains are estimates; the Airport Express timetable covers first and last trains, journey times and average frequency only.",
    "Light Rail, MTR Bus and the high-speed rail are not covered."
  ],
  "officialSources": [
    {
      "id": "mtr-next-train-api",
      "name": "港鐵實時列車服務資訊",
      "publisher": "MTR Corporation Limited (DATA.GOV.HK)",
      "kind": "json_api",
      "url": "https://rt.data.gov.hk/v1/transport/mtr/getSchedule.php"
    },
    {
      "id": "mtr-lines-stations",
      "name": "港鐵綫、車費和無障礙設施（車站名單）",
      "publisher": "MTR Corporation Limited (DATA.GOV.HK)",
      "kind": "csv_file",
      "url": "https://opendata.mtr.com.hk/data/mtr_lines_and_stations.csv"
    },
    {
      "id": "mtr-airport-express-fares",
      "name": "港鐵綫、車費和無障礙設施（機場快綫車費）",
      "publisher": "MTR Corporation Limited (DATA.GOV.HK)",
      "kind": "csv_file",
      "url": "https://opendata.mtr.com.hk/data/airport_express_fares.csv"
    },
    {
      "id": "mtr-timetable-page",
      "name": "列車服務時間",
      "publisher": "MTR Corporation Limited",
      "kind": "web_page",
      "url": "https://www.mtr.com.hk/ch/customer/services/timetable_index.html"
    },
    {
      "id": "mtr-service-hours-page",
      "name": "服務時間",
      "publisher": "MTR Corporation Limited",
      "kind": "web_page",
      "url": "https://www.mtr.com.hk/ch/customer/services/train_service_index.html"
    }
  ],
  "agoodealPage": "https://www.agoodeal.com/tools/mtr-next-train/"
}
