香港資料查詢 (local mirror or httpfs)
hk_query_rows
台灣專屬MIT
Scope: Hong Kong public datasets and government data.
Run SQL against a HK dataset — auto-routes to local mirror or httpfs.
**This is the ONLY way to see resource content from HK gov sources.**
Your host sandbox almost certainly does NOT whitelist `data.gov.hk`,
`data.weather.gov.hk`, or the CDN targets. Your MCP server DOES have
counts, trends, aggregates, or specific rows** — never respond "I don't
have network access to that data".
Batch pattern (recommended): call 3-5 times per turn to build up the
aggregate story (e.g. per-year totals, per-station comparisons).
Two backends (transparent):
- **local_mirror** (returns `source="local_mirror"`, ~50ms): clean
snake_case schema, no encoding gymnastics. See `hk_list_mirrors`
for what's available. HKO tables use columns: station_id, date,
year, month, day, value (or `rainfall_mm` for the rainfall table),
completeness ('C' / '#' / '***').
- **httpfs** (returns `source="httpfs"`, seconds): DuckDB pulls the
remote CSV live. Used for any non-mirrored dataset. HKO CIS raw
CSVs use bilingual columns like `"年/Year"`, `"月/Month"`, `"日/Day"`,
`"數值/Value"`, `"數據完整性/data Completeness"` — QUOTE them in SQL.
Args:
dataset_id: CKAN name (e.g. "hk-hko-rss-daily-total-rainfall").
resource_index: 0-based index into CSV resources (default 0).
Ignored for local-mirror datasets.
resource_name: alternative — pick by resource `name` (partial OK).
where: SQL WHERE clause without the "WHERE" keyword.
columns: list of SELECT expressions (default `["*"]`).
group_by / order_by: SQL clauses without keywords.
limit: default 100, hard cap 10,000. Bump for full-history extracts.
skip: preamble rows to skip (httpfs only · auto-retries skip=2 on
HKO CIS title preamble; usually leave at 0).輸入 schema
{
"properties": {
"dataset_id": {
"title": "Dataset Id",
"type": "string"
},
"resource_index": {
"default": 0,
"title": "Resource Index",
"type": "integer"
},
"resource_name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Resource Name"
},
"where": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Where"
},
"columns": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"title": "Columns"
},
"group_by": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Group By"
},
"order_by": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Order By"
},
"limit": {
"default": 100,
"title": "Limit",
"type": "integer"
},
"skip": {
"default": 0,
"title": "Skip",
"type": "integer"
}
},
"required": [
"dataset_id"
],
"title": "hk_query_rowsArguments",
"type": "object"
}呼叫方式
配置好 Twinkle Hub 的 MCP client 後,agent 會看到 hk_query_rows。直接讓它呼叫即可,例如:
# Ask Claude / any MCP client: 請用 hk_query_rows 處理 "…"。 # It will call: hk_query_rows(input="…")
尚未設定 Client?
Claude Desktop 約 3 分鐘即可完成設定 — 下載 .mcpb 檔案並雙擊即可,或參閱文件中的各 Client 安裝步驟。
查看使用者設定文件