Twinkle HubTwinkle Hub
登入

📌 2026-08-17 新增:⚖️ 台灣法條時光機 — 歷史法條原文 · 修法沿革 · 全文檢索 · 條文關聯圖(935 個 dataset · 35,454+ 筆 row)

查看完整 Changelog →

行政區代碼查詢

tw_lookup_admin_code

台灣​專屬MIT

縣市 [+ 鄉鎮市區] → 內政部 8 碼法定行政區代碼 (sub-ms in-process).

Args:
    county: 縣市名 e.g. '臺北市' / '新北市' / '宜蘭縣'
            (台/臺 兩種寫法都接受, auto normalise)
    town: 鄉鎮市區名 e.g. '信義區' / '羅東鎮' (空字串=只查 county)

Returns:
    {found, county, town, county_code (5-digit e.g. '63000'),
     town_code (8-digit e.g. '63000020')}

Use case: 把含 (city, 鄉鎮市區) 的 dataset row 補上 admin code
          → cross-dataset JOIN with stats / 健保 / 房價 datasets.

Mapping coverage: 全國 22 縣市 368 (county, town) pairs, OGDL v1.

輸入 schema

{
  "properties": {
    "county": {
      "title": "County",
      "type": "string"
    },
    "town": {
      "default": "",
      "title": "Town",
      "type": "string"
    }
  },
  "required": [
    "county"
  ],
  "title": "lookup_admin_codeArguments",
  "type": "object"
}

呼叫​方式

配置​好 Twinkle Hub 的 MCP client 後,​agent 會​看到 tw_lookup_admin_code。直接讓它呼叫​即可,​例如:

# Ask Claude / any MCP client:
請用 tw_lookup_admin_code 處理 "…"。

# It will call:
tw_lookup_admin_code(input="…")

尚未​設定 Client?

Claude Desktop 約 3 分鐘即可完成​設定 — 下載 .mcpb 檔案並雙擊​即可,或參閱​文件中的各 Client 安裝​步驟。

查看使用者設定​文件