Skip to main content
Glama
lawchat-oss

mcp-taiwan-legal-db

by lawchat-oss

mcp-taiwan-legal-db

English · 繁體中文

台灣法規、裁判書、憲法法庭裁判 — MCP Server。

讓任何 MCP 相容的 AI 助手直接存取台灣公開法律資料:

  • 司法院裁判書 — judgment.judicial.gov.tw(全文搜尋 + 取得)

  • 全國法規資料庫 — law.moj.gov.tw(11,700+ 部法規)

  • 憲法法庭 — cons.judicial.gov.tw(868 筆大法官解釋 + 憲判字,含理由書全文,離線快取)

以 Python 搭配 FastMCP 寫成。純工具 wrapper,只連線台灣政府官方來源(詳見下方「資料來源與統計」),不發送任何其他網路請求;憲法法庭資料為內建離線打包。


特色

功能

說明

8 個 MCP 工具

裁判書搜尋/全文、法規查詢、釋字/憲判字查詢、引用關係圖譜

離線快取

868 筆大法官解釋與憲判字(含理由書/意見書全文)從本地 JSON 即時回傳

引用關係圖譜

從理由書抽取所有引用的釋字/憲判字,追溯憲法學說演變

全文搜尋

裁判書關鍵字搜尋 + 釋字爭點/理由書全文搜尋

混合請求策略

預設用 httpx 直打(~0.25s),觸發司法院 F5 WAF 時自動以 Playwright 刷 cookie 後繼續


Related MCP server: taiwan-data-hub

⚡ 安裝(PyPI,推薦)

pip install mcp-taiwan-legal-db

Debian / Ubuntu / WSL 注意:系統 Python 受 PEP 668 保護,直接 pip install 會被擋。請改用:

  • pipx install mcp-taiwan-legal-db(推薦,自動建隔離 venv,CLI tool 標準裝法)

  • pip install --user --break-system-packages mcp-taiwan-legal-db

裝完後 entry point mcp-taiwan-legal-db 會在 PATH 上。接到 Claude Code(任何專案都能用):

claude mcp add taiwan-legal-db mcp-taiwan-legal-db --scope user

接著 /mcp 重啟連線、Claude 就會在自然語言查詢時自動用 8 個 MCP tool。

選擇性 — F5 WAF fallback

playwright install chromium    # 僅在司法院 WAF 觸發時用,平時 idle

開發環境設置

下面是 clone 來修程式 / 跑測試的流程:

# 1. Clone repo
git clone https://github.com/lawchat-oss/mcp-taiwan-legal-db.git
cd mcp-taiwan-legal-db

# 2. 建立並初始化虛擬環境
python3 -m venv .venv
.venv/bin/pip install --upgrade pip
.venv/bin/pip install -e .

# 3. 安裝 Playwright Chromium(僅在司法院 WAF 觸發時使用,一般查詢不會啟動)
.venv/bin/playwright install chromium

# 4. 驗證伺服器可以啟動並註冊 8 個工具
.venv/bin/python -c "
import asyncio
from mcp_server.server import mcp
print('Server:', mcp.name)
tools = asyncio.run(mcp.list_tools())
print('Tools:', [t.name for t in tools])
assert len(tools) == 8, f'Expected 8 tools, got {len(tools)}'
print('✓ Setup OK')
"

預期輸出:

Server: 台灣法律資料庫
Tools: ['search_judgments', 'get_judgment', 'query_regulation', 'get_pcode', 'search_regulations', 'get_interpretation', 'search_interpretations', 'get_citations']
✓ Setup OK

上面沒報錯就完成了。Repo 根目錄已經帶一份 .mcp.json任何在此資料夾內開的 Claude Code session 會自動載入這個 server,不需要額外註冊。


有什麼工具可以用

8 個 MCP 工具,全部唯讀,全部只打台灣政府的公開資料庫。

法規與裁判

工具

用途

典型呼叫

search_judgments

搜尋司法院裁判書資料庫

search_judgments(keyword="預售屋 遲延交屋", case_type="民事")

get_judgment

依 JID 或 URL 取得單筆判決全文

get_judgment(jid="TPSM,114,台上,3753,20251112,1")

query_regulation

查詢法規條文/範圍/全文/修法沿革

query_regulation(law_name="民法", article_no="184")

get_pcode

將法規名稱解析為 pcode(法規代號)

get_pcode(law_name="律師法")

search_regulations

以關鍵字搜尋 11,700+ 部法規

search_regulations(keyword="勞動")

憲法法庭

工具

用途

典型呼叫

get_interpretation

大法官解釋/憲判字全文(離線快取)

get_interpretation("釋字748", reasoning_keyword="婚姻")

search_interpretations

搜尋釋字/憲判字(爭點 + 理由書全文)

search_interpretations(keyword="集會自由")

get_citations

引用關係圖譜(往前追溯)

get_citations("釋字748", include_context=True)

工具細節

搜尋司法院判決系統。支援:

  • 精確案號查詢(快,HTTP GET):設定 case_word + case_number + year_from

  • 全文關鍵字搜尋:設定 keyword

  • 裁判主文篩選main_text="被告應將 移轉" + keyword="借名登記" → 找被告敗訴的借名登記案

  • 可依 courtcase_type(民事/刑事/行政/懲戒)、year_fromyear_to 過濾

  • 結果自動依法院層級排序(最高 → 高等 → 地方)

  • 資料涵蓋範圍:民國 89 年(2000)起接近完整,81–88 年(1992–1999)僅零星收錄,80 年(1991)以前查無。這是司法院系統本身的收錄範圍,本工具不做任何年份裁切

重要:要查某個特定案號時,一定要用 case_word+case_number,不要放進 keyword

# ✅ 正確 — 查 114 台上 3753 最高法院
search_judgments(case_word="台上", case_number="3753", year_from=114, court="最高法院")

# ✅ 正確 — 全文搜尋
search_judgments(keyword="預售屋 遲延交屋")

# ❌ 錯 — 把案號放進 keyword
search_judgments(keyword="114年度台上字第3753號")

取得單筆判決的結構化全文。

  • 輸入:jid(從 search_judgments 結果取得)或 url

  • 輸出:{case_id, court, date, main_text, facts, reasoning, cited_statutes, cited_cases, full_text, source_url}

  • HTTP GET data.aspx 取得全文

  • 結果快取 30 天

get_judgment(jid="TPSM,114,台上,3753,20251112,1")

單筆判決可能超過 1 萬 token。建議先用 search_judgments 取得 metadata,只在使用者明確需要時才抓全文。

查詢全國法規資料庫。

# 單一條文
query_regulation(law_name="民法", article_no="184")

# 條文範圍
query_regulation(law_name="民法", from_no="184", to_no="198")

# 完整法規
query_regulation(law_name="律師法")

# 附修法沿革
query_regulation(law_name="勞動基準法", article_no="23", include_history=True)

支援 law_name(透過 get_pcode 自動解析 pcode)或直接傳 pcode。子條文如 247-115-1 都支援。

取得大法官解釋(釋字第 1–813 號)或憲法法庭裁判(憲判字)全文。預設層從本地 JSON 快取即時回傳。

分層設計(節省 context):

層級

觸發條件

離線?

預設層(字號/日期/爭點/解釋文)

永遠回傳

理由書片段

reasoning_keyword="關鍵字"

理由書全文(最多 15,000 字)

include_reasoning=True

意見書片段

opinions_keyword="關鍵字"

意見書全文

include_opinions=True

# 預設層(離線,~0ms)
get_interpretation("釋字748")

# 理由書中搜尋關鍵字
get_interpretation("釋字748", reasoning_keyword="婚姻自由")

# 在意見書中定位特定大法官
get_interpretation("釋字499", opinions_keyword="林子儀")

# 新制憲判字
get_interpretation("111年憲判字第1號")

建議先用 keyword 片段模式定位,只在需要時才開全文模式。

搜尋大法官解釋與憲判字。關鍵字同時匹配標題、爭點、理由書全文。

# 全文搜尋(搜爭點 + 理由書)
search_interpretations(keyword="集會自由")

# 篩選年度(新制)
search_interpretations(keyword="言論自由", year=112)

# 列舉最後 10 筆釋字
search_interpretations(number_from=804, number_to=813)

從理由書中抽取所有引用的釋字/憲判字字號。追溯方向:查詢指定裁判引用了哪些先前裁判

get_citations("釋字748")
# → citations: [釋字第242號, 釋字第362號, 釋字第365號, ...]

# 附上引用前後 80 字片段
get_citations("釋字748", include_context=True)

範例問法

「查民法第 184 條」
「搜尋跟預售屋遲延交屋有關的最高法院判決」
「釋字 748 的理由書重點是什麼」
「哪些大法官解釋討論過集會自由」
「釋字 748 引用了哪些先前的釋字」
「查 111 年憲判字第 1 號」

註冊到你的 Claude client

依你使用的 Claude client 選對應的段落。

Claude Code (CLI)

Claude Code 會自動載入專案根目錄的 .mcp.json。這個 repo 已經內建一份:

{
  "mcpServers": {
    "taiwan-legal-db": {
      "command": ".venv/bin/python",
      "args": ["-m", "mcp_server.server"]
    }
  }
}

零設定cd 進 repo 之後跑 claude 就好。MCP server 列表會看到 taiwan-legal-db,而且此資料夾不會有其他多餘的 server。

跟隊友分享.mcp.json 已經 commit 進 repo。任何人 clone 下來跟著 Quick Start 跑完,就會自動完成 MCP 註冊。

加到其他專案(你想在另一個資料夾用這個 MCP):用 claude mcp add 以 project scope 加入:

cd /path/to/your/other/project
claude mcp add taiwan-legal-db --scope project -- \
  /absolute/path/to/mcp-taiwan-legal-db/.venv/bin/python \
  -m mcp_server.server

這會在你另一個專案的根目錄寫出一份 .mcp.json。想在每個專案都能用,把 --scope project 改成 --scope user

Claude Desktop (macOS / Windows)

Claude Desktop 使用一個全域設定檔:

  • macOS~/Library/Application Support/Claude/claude_desktop_config.json

  • Windows%APPDATA%\Claude\claude_desktop_config.json

  • Windows (Microsoft Store / WinGet / MSIX 安裝)C:\Users\<YourName>\AppData\Local\Packages\Claude_pzs8sxrjxfjjc\LocalCache\Roaming\Claude\claude_desktop_config.json

最快開啟方式:在 Claude Desktop 點選單列(不是視窗)→ SettingsDeveloperEdit Config。檔案若不存在 Claude Desktop 會自動建立。

mcpServers 下加入以下內容(跟已有內容合併):

{
  "mcpServers": {
    "taiwan-legal-db": {
      "command": "/absolute/path/to/mcp-taiwan-legal-db/.venv/bin/python",
      "args": ["-m", "mcp_server.server"],
      "cwd": "/absolute/path/to/mcp-taiwan-legal-db"
    }
  }
}

/absolute/path/to/mcp-taiwan-legal-db 換成你的實際 clone 路徑。cwd 欄位必填,Python 才找得到 mcp_server 套件。

存檔後,完全關閉並重新開啟 Claude Desktop(不是只關視窗 — macOS 用 ⌘Q、Windows 右鍵工具列圖示 → Quit)。設定檔只會在重啟時重新載入。

Claude Cowork (Pro 以上方案)

Claude Cowork 跑在 Claude Desktop 裡面,共用同一個 claude_desktop_config.json — 沒有另外的 Cowork 設定檔。任何你在 Claude Desktop 註冊的 MCP server 會自動透過 Claude Desktop SDK 橋接進 Cowork 的沙盒 VM。

設定步驟

  1. 照上面 Claude Desktop 段落把 taiwan-legal-db 加進 claude_desktop_config.json

  2. 完全關閉並重新開啟 Claude Desktop — 同時也會重啟 Cowork

  3. 開一個 Cowork session,taiwan-legal-db 的工具就可以用了

注意:Cowork 目前在 Claude Pro / Max / Team / Enterprise 方案都可以用,且只能存取你明確授權的資料夾。MCP server 本身跑在你的 host 上(不是 Cowork VM 裡面),透過 Desktop SDK bridge 溝通,所以不管你授權哪個資料夾給 Cowork,它都存取得到內建的資料檔。

其他 MCP 相容 client

任何符合 Model Context Protocol 規範 的 MCP client 都可以使用這個 server。啟動指令永遠是:

.venv/bin/python -m mcp_server.server

⋯⋯加上 cwd 設定為 repo 根目錄(Python 才找得到 mcp_server 套件)。設定位置請參考你使用的 client 的文件,找 mcpServers JSON 區塊寫在哪裡。


在這個 server 上面建 A2A agent

想用 A2A agent 驅動這些工具?請見 examples/agno-bindu/ — 一個社群貢獻的 A2A agent 範例。


疑難排解

ModuleNotFoundError: No module named 'mcp_server' → 你沒有在 venv 裡面跑 pip install -e .。回到 Quick Start 步驟 2。

FileNotFoundError: data/pcode_all.json → 內建的 mcp_server/data/pcode_all.json 不見或被刪了。用 git checkout mcp_server/data/pcode_all.json 還原,或觸發重新下載:

.venv/bin/python -m mcp_server.updater

MCP client 回報「伺服器啟動失敗」 → 直接跑 Quick Start 步驟 3 的驗證指令。若失敗,代表 import chain 壞了 — 看 traceback。若通過,問題在 MCP client 的啟動設定(路徑或 cwd 錯了)。

ssl.SSLCertVerificationError: ... Missing Subject Key Identifier → 這是 OpenSSL 3.6+ 對 TWCA Global Root CA 的廣泛 rejection,不是 certifi 舊的問題。本 repo 透過 truststore 套件讓 Python 改用作業系統原生的 trust store(macOS Security framework、Windows CryptoAPI、Linux 系統 CA),所有路徑都保留完整 SSL 驗證(verify=True,不使用 verify=False。這在 macOS、Windows 以及 OpenSSL <3.6 的 Linux 都能正常工作。OpenSSL 3.6+ 的 Linux 環境(Fedora 40+、未來的 Ubuntu LTS)目前可能仍有問題,歡迎 issue 回報。


WAF 處理機制

司法院 judgment.judicial.gov.tw 部署了 F5 BIG-IP ASM WAF,純 HTTP 請求可能被擋(回固定 245 bytes 的 "Request Rejected")。

本專案採混合策略:

  • 預設用 httpx 直接請求(~0.25s)

  • 偵測到被擋(response 含 Request Rejected 或 JS challenge marker bobcmn / TSPD)自動 fallback 到 Playwright 跑一次 JS challenge

  • 取得 TSPD cookies 後持久化到 mcp_server/data/.judicial_cookies.json(0600 權限,已 gitignore)

  • 後續查詢繼續用 httpx 帶 cookies 執行

cons.judicial.gov.tw(釋字)跟 law.moj.gov.tw(法規)沒這個問題,不經過 WAF 流程。


資料來源與統計

查詢時實際連網的,只有以下兩個台灣政府公開資料庫網域:

來源

網域

用途

司法院裁判書系統

judgment.judicial.gov.tw

裁判書搜尋與全文(FJUD/Default_AD.aspxdata.aspx

全國法規資料庫

law.moj.gov.tw

法規條文與修法沿革(LawClass/*

mcp_server/config.py:ALLOWED_DOMAINS 以硬編碼 allow-list 強制執行(即上列兩個網域),伺服器會拒絕任何不在清單內的 URL。

裁判書年份涵蓋範圍:本工具即時代理司法院系統,沒有自己的資料庫,有效年份 = 司法院收錄範圍。實測(以「竊盜」為關鍵字計數)民國 89 年(2000)起每年數萬筆,81–88 年(1992–1999)合計約 2,000 筆,80 年(1991)以前為零。司法院公告其開放資料檔「收錄範圍與裁判書查詢系統相同」,因此沒有更早的公開來源。查詢 2000 年以前的裁判請預期查無或零星。

憲法法庭資料(釋字/憲判字)不在查詢時連網取得 — 它是離線打包的(old_cases.jsonnew_cases.json),來源為 cons.judicial.gov.tw,由維護腳本離線重建。詳見 SOURCES.md

憲法法庭資料統計

資料集

筆數

含理由書

含意見書

檔案大小

舊制釋字(old_cases.json)

813

734

370

7.4 MB

新制憲判字(new_cases.json)

55

55

55

1.8 MB

快取

資料類型

TTL

位置

判決全文

30 天

mcp_server/data/cache/legal_mcp.db(SQLite,首次啟動時建立)

搜尋結果

24 小時

同上

法規條文

7 天

同上

pcode metadata

30 天

同上

釋字/憲判字

本地 JSON(不過期)

mcp_server/data/old_cases.jsonnew_cases.json

全部清除:刪掉 mcp_server/data/cache/legal_mcp.db。快取檔在 .gitignore 內。

pcode_all.json 自動更新

伺服器啟動時會檢查 mcp_server/data/pcode_all.json 的時間戳。如果最後一次更新在最近的週六之前,會在背景觸發從 law.moj.gov.tw 官方 API 重新抓取。失敗會記為 warning,不會阻擋啟動。

手動更新:

.venv/bin/python -m mcp_server.updater

專案結構

mcp-taiwan-legal-db/
├── .gitignore
├── .mcp.json              # 資料夾內 Claude Code session 自動註冊用
├── LICENSE                # MIT(程式碼)
├── DATA_LICENSE           # CC0 1.0(憲法法庭資料)
├── SOURCES.md             # 資料來源說明
├── CITATION.cff           # 學術引用格式
├── README.md              # 本檔(繁體中文)
├── README.en.md           # English version
├── pyproject.toml         # 套件 metadata 與相依
└── mcp_server/
    ├── __init__.py
    ├── server.py          # FastMCP 入口 — 定義 8 個 @mcp.tool() function
    ├── config.py          # URL、法院代碼、快取 TTL、allowed domains
    ├── updater.py         # 獨立的 pcode_all.json 更新 script
    ├── cache/db.py        # SQLite 快取層
    ├── data/
    │   ├── pcode_all.json          # 11,700+ 部法規(內建,~780 KB)
    │   ├── law_histories.json      # 修法沿革(內建,~9.6 MB)
    │   ├── old_cases.json          # 813 筆舊制釋字全文(內建,~7.4 MB)
    │   └── new_cases.json          # 55 筆新制憲判字全文(內建,~1.8 MB)
    ├── models/            # Judgment / Regulation dataclass
    ├── parsers/           # 判決與法規頁面的 HTML parser
    ├── tools/
    │   ├── judicial_search.py      # search_judgments
    │   ├── judicial_doc.py         # get_judgment
    │   ├── regulations.py          # query_regulation, get_pcode, search_regulations
    │   └── constitutional_court.py # get_interpretation, search_interpretations, get_citations
    └── tests/             # pytest 測試

執行測試

.venv/bin/pip install -e ".[dev]"
.venv/bin/pytest mcp_server/tests/ -v

關於

LawChat 維護 — 一個台灣法律 AI 平台。

Best-effort 維護 — 我們會盡量跟上 upstream(司法院、法務部)頁面變動,但不保證 issue 的回覆時效。

授權

程式碼MIT License

憲法法庭資料CC0 1.0(公有領域貢獻)— 任何人皆可自由使用、修改及散布,無需取得授權或署名。學術引用格式請參考 CITATION.cff

裁判書與法規資料來源:司法院法務部(政府公開資料)。 憲法法庭資料來源:司法院憲法法庭(依中華民國著作權法第 9 條屬公有領域)。詳見 SOURCES.md

免責聲明

This is an unofficial tool for querying publicly-available Taiwan legal databases. It is not affiliated with, endorsed by, or authorized by the Judicial Yuan, the Ministry of Justice, or any Taiwan government agency.

The data returned by this tool reflects the state of the upstream official sources at the time of query. It may be cached (see TTLs above), and must not be treated as legal advice or a substitute for the authoritative official sources. Always verify against the original sources before relying on the data for any legal or official purpose.

本工具為非官方的台灣公開法規資料查詢工具,與司法院、法務部或任何台灣政府機關無隸屬關係。查詢結果以上游官方資料庫當下狀態為準(且可能被快取 — 見上方 TTL 表),不得作為法律意見或正式用途依據,使用前請向官方資料庫驗證。

在本 server 之上建構的應用:本專案是台灣公開法律來源的資料存取層。任何基於它建構的 agent、應用程式或服務(包含 examples/ 內的範例),須自行負責其行為、輸出正確性與對使用者的聲明。

Available Tools

8 tools
get_citationsA

從大法官解釋/憲判字的理由書中抽取所有引用的其他釋字/憲判字字號。

追溯方向:查詢指定裁判引用了哪些先前裁判(往前追溯)。

Args: case_id: 解釋/裁判字號字串(格式同 get_interpretation) include_context: 每個引用附上原文前後 80 字片段

ParametersJSON Schema
NameRequiredDescriptionDefault
case_idYes
include_contextNo

TDQS

A4.1/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It discloses that it extracts citations and optionally attaches context snippets. However, it does not mention any behavioral traits like whether it requires authentication, rate limits, or performance characteristics. Basic transparency is present but not rich.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is relatively concise, using a single paragraph with clear bullet points for arguments. It could be slightly more structured, but every sentence adds information. No wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema and no annotations, the description adequately explains input and what is returned (citations with optional context). It lacks mention of return format or pagination, but for a simple extraction tool, it is reasonably complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so the description must add meaning. It does: it explains that case_id should follow the same format as get_interpretation, and includes that include_context controls whether a snippet of 80 characters is attached. This adds value beyond the bare schema types.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states that the tool extracts all cited interpretation/case numbers from reasoning documents of Grand Justice interpretations. It specifies the trace direction as backward tracing (which prior judgments a given judgment cites), which distinguishes it from sibling tools like get_interpretation that retrieve a single interpretation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage: when you need to know which previous interpretations a specific case cites. It does not explicitly mention when not to use or name alternatives, but the context of sibling tools makes the use case clear. Slight lack of explicit guidance on exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_interpretationA

取得司法院大法官解釋(釋字第 1-813 號)或憲法法庭裁判(憲判字)全文。

預設層(字號/日期/爭點/解釋文)從本地快取即時回傳,無需連網。 理由書/意見書支援全文模式與關鍵字片段模式。

case_id 格式(自動解析):「釋字第748號」「釋字748」「748」 「111年憲判字第1號」「111憲判1」

Args: case_id: 解釋/裁判字號字串 include_reasoning: 回傳理由書全文(最多 15000 字) reasoning_keyword: 在理由書中搜尋關鍵字並回片段(覆蓋 include_reasoning) include_opinions: 回傳意見書全文 opinions_keyword: 在意見書中搜尋關鍵字並回片段

ParametersJSON Schema
NameRequiredDescriptionDefault
case_idYes
include_reasoningNo
reasoning_keywordNo
include_opinionsNo
opinions_keywordNo

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description discloses key behaviors: default fields from local cache (fast), reasoning/opinions have full-text and keyword modes, and reasoning_keyword overrides include_reasoning. It also mentions a 15000-character limit. However, it does not explicitly state whether reasoning/opinions require network access.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with sections for default mode, reasoning/opinions, case_id format, and parameter details. While somewhat verbose, every sentence adds value. Minor redundancy could be trimmed, but overall efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (5 parameters, no output schema), the description covers essential aspects: parameter behavior, caching, and case_id format. It lacks explicit output format details, but the tool's purpose implies returning the interpretation text. Generally sufficient.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds significant meaning beyond the input schema: it explains case_id formats (multiple accepted variants), the override behavior of reasoning_keyword and opinions_keyword, and the character limit for include_reasoning. With 0% schema coverage, this is essential and well-done.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool retrieves full text of judicial interpretations or constitutional court decisions, specifying the range (釋字第1-813號 or 憲法法庭裁判) and caching behavior. It distinguishes from sibling tools like search_interpretations, which imply search functionality.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explains when to use the tool (retrieve specific known decisions) and provides formatting examples for case_id. However, it does not explicitly contrast with sibling tools like search_interpretations for when a search would be more appropriate, leaving some ambiguity.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_judgmentA

取得單一裁判書全文。

支援兩種查詢方式:

  1. 以 JID 查詢(優先使用 Open Data API)

  2. 以 URL 查詢(直接載入頁面)

Args: jid: 裁判書 JID(如「TPSV,104,台上,472,20150326,1」),從搜尋結果取得 url: 裁判書 URL(如 https://judgment.judicial.gov.tw/FJUD/printData.aspx?id=...)

Returns: 包含裁判書全文的字典:case_id, court, date, main_text, facts, reasoning, cited_statutes, cited_cases, full_text, source_url

ParametersJSON Schema
NameRequiredDescriptionDefault
jidNo
urlNo

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden. It discloses the two query methods, preference for Open Data API with JID, and return structure. Lacks error handling or potential issues, but sufficient for a read-only fetch.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is structured with Args and Returns, but the return list is somewhat verbose. It is front-loaded with the main purpose, and each part is useful.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema, the description provides the full return structure. It covers both query methods adequately for a single document fetch tool. No missing critical info.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, but the description provides detailed parameter descriptions with examples (jid format, url example), adding significant meaning beyond the schema defaults.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it gets the full text of a single judgment (specific verb+resource). It distinguishes from siblings like search_judgments (searching) and get_citations (related items).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explains when to use the tool (to get a single judgment by JID or URL). It does not explicitly state when not to use it or mention alternatives, but the context is clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_pcodeA

將法規名稱轉換為全國法規資料庫的 pcode 代碼。

涵蓋 11,700+ 部法規(法律 + 命令),支援模糊比對。

Args: law_name: 法規名稱(如「民法」「勞基法」「消保法」)

Returns: 包含 pcode 的字典,或模糊比對建議

ParametersJSON Schema
NameRequiredDescriptionDefault
law_nameYes

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description discloses important behaviors: covering 11,700+ regulations, supporting fuzzy matching, and returning a dictionary with pcode or suggestions. It lacks details on error handling or rate limits but is adequate for a simple lookup tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise with two clear paragraphs, front-loading the purpose and providing Args/Returns sections. No wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple one-parameter tool with no output schema, the description covers purpose, input, output format, and key behaviors like fuzzy matching and coverage, making it fully self-contained.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema only provides the parameter name and type with 0% coverage. The description adds meaning by explaining law_name as a Chinese regulation name with examples (e.g., 民法, 勞基法), which goes beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: converting law names to pcode codes for the national law database. It is distinct from sibling tools like get_citations or get_interpretation, which serve different retrieval functions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for converting law names to pcode, providing context of coverage and fuzzy matching. However, it does not explicitly state when to use this tool versus alternatives or when not to use it.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

query_regulationA

查詢全國法規資料庫的法規條文。

可查詢單一條文、條號範圍、或法規全文。

Args: law_name: 法規名稱(如「民法」「勞動基準法」),會自動轉換為 pcode pcode: 法規代碼(如「B0000001」),若提供 law_name 可不填 article_no: 條號(如「184」「247-1」「15-1」),查詢單一條文 from_no: 起始條號(如「184」),查詢條號範圍時使用 to_no: 截止條號(如「198」),查詢條號範圍時使用 include_history: 是否包含修法沿革(使用者詢問修法歷程、修正時間、歷次修正內容時設為 True)

Returns: 包含法規條文的字典:law (pcode, name, status), articles, source_url, history(選填)

ParametersJSON Schema
NameRequiredDescriptionDefault
law_nameNo
pcodeNo
article_noNo
from_noNo
to_noNo
include_historyNo

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description fully addresses behavioral aspects. It discloses automatic law_name-to-pcode conversion, the return structure (law, articles, source_url, optional history), and the functional scope. No destructive behavior is expected, and the transparency is sufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with a clear purpose statement and bullet-style parameter explanations. It is slightly verbose but every part contributes to understanding. Concise enough for an AI agent to parse efficiently.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 6 parameters, 0% schema coverage, and no output schema, the description covers all parameters and return structure. It could mention error handling or prerequisites (e.g., either law_name or pcode required), but it is largely complete for the tool's complexity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description compensates fully. It explains each parameter's purpose (e.g., law_name vs pcode, article_no for single article, from_no/to_no for range, include_history for history) with examples like '民法' and '247-1'. This adds significant meaning beyond the raw schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it queries the national regulations database, specifying the types of queries (single article, range, full text). This distinguishes it from siblings like search_regulations, which likely searches across regulations rather than retrieving specific articles.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explains parameter usage (e.g., include_history for history queries) but does not explicitly guide when to use this tool versus alternatives like search_regulations or get_citations. Usage context is implied but lacks exclusions or alternative recommendations.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_interpretationsA

列舉大法官解釋 / 憲法法庭裁判。支援關鍵字全文搜尋(搜爭點 + 理由書)。

每筆結果帶 case_id,可直接傳給 get_interpretation()。

Args: keyword: 關鍵字(標題/字號/爭點/理由書全文匹配) year: 篩選民國年度(0=不篩選,>0 只回新制憲判字) number_from: 起始號次(含),0=不篩選 number_to: 截止號次(含),0=不篩選 include_old: 包含舊制釋字(year=0 時才生效) include_new: 包含新制憲判字 max_results: 回傳筆數上限(預設 30)

ParametersJSON Schema
NameRequiredDescriptionDefault
keywordNo
yearNo
number_fromNo
number_toNo
include_oldNo
include_newNo
max_resultsNo

TDQS

A4.1/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations exist, so the description carries full burden. It discloses that keyword search covers '爭點 + 理由書', and explains parameter behaviors (e.g., year=0 applies to old system). However, it does not mention side effects, authentication, rate limits, or explicitly state read-only nature, which is acceptable for a search tool but leaves some ambiguity.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with a short introductory sentence followed by a parameter list. It is slightly verbose due to parameter explanations, but every sentence adds value. Could be more concise by integrating parameter notes into a single paragraph.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool has 7 parameters and no output schema. The description explains parameters well but lacks details on return format (e.g., fields beyond case_id, pagination, sorting). It assumes output structure without specifying, leaving some gaps for an agent to infer.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema has 0% parameter description coverage, so the description fully compensates by explaining each of the 7 parameters with conditions (e.g., 'include_old only effective when year=0'). This adds essential meaning beyond the schema's default values and titles.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool enumerates (列舉) interpretations/constitutional court decisions and supports full-text keyword search across issues and reasoning. It specifies the resource (大法官解釋/憲法法庭裁判) and action (搜尋), distinguishing it from sibling 'get' tools like get_interpretation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explains that results include 'case_id' for direct use with get_interpretation(), and details each parameter's effect (e.g., year filtering, max_results). It does not explicitly state when not to use or alternative tools, but the context of siblings implies appropriate usage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_judgmentsA

搜尋司法院裁判書系統。

結果自動按法院權威性排序(最高法院→高等法院→地方法院),同層級按原始排序。 每筆結果含 court(法院名稱)、case_type(民事/刑事/行政)、court_level(1=最高/2=高等/3=地方)。

【重要】查特定案號時,必須用 case_word + case_number(精確查詢),不要把案號放在 keyword。 例如查「114年度上易字第503號」→ case_word="上易", case_number="503", year_from=114。 keyword 僅用於主題式全文檢索(如「預售屋 遲延交屋」)。

【進階實務研究欄位】:

  • main_text: 裁判主文關鍵字 — 最有效的輸贏方篩選方式。 主文措辭高度制度化(依民刑訴訟法條生成),substring match 接近 解析半結構化欄位,精度高:

    • 「被告應將 移轉」→ 被告敗訴(物權移轉類)

    • 「被告應給付」→ 被告敗訴(金錢給付類)

    • 「原告之訴駁回」→ 原告敗訴

    • 「上訴駁回」→ 維持原審 可與 keyword 併用,例: 找「借名登記成立、被告敗訴」→ main_text="被告應將 移轉", keyword="借名登記", case_type="民事"

Args: keyword: 全文檢索關鍵字(對應 jud_kw) court: 法院名稱(如「最高法院」「臺灣高等法院」「臺灣臺北地方法院」) case_type: 案件類型(民事/刑事/行政/懲戒) year_from: 起始年度(民國年,如 110) year_to: 截止年度(民國年,如 113) case_word: 字別(如「台上」「上易」「重訴」),查特定案號時必填 case_number: 案號(數字),查特定案號時必填 main_text: 裁判主文關鍵字(對應 jud_jmain)— 結構化篩選輸贏方 max_results: 回傳筆數上限(預設 10,上限 200)

Returns: 包含搜尋結果的字典:success, query, total_count, results, cached, timestamp

ParametersJSON Schema
NameRequiredDescriptionDefault
keywordNo
courtNo
case_typeNo
year_fromNo
year_toNo
case_wordNo
case_numberNo
main_textNo
max_resultsNo

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided; description bears full burden. Discloses sorting by court hierarchy, returned fields (court, case_type, court_level), and that main_text is semi-structured. Does not cover auth needs or rate limits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Well-structured with sections and examples. Somewhat lengthy due to detailed main_text variants, but all information is relevant and adds value. Front-loaded with purpose and key usage.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Comprehensive for a complex tool with 9 parameters. Covers sorting, caching, return format, parameter interactions, and advanced filtering. No output schema, but description details the return structure.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema has no parameter descriptions (0% coverage). Description adds full semantics: keyword for full-text, court name, case_type domain, ROC year format, case_word/number for exact lookup, main_text for win/loss, max_results default and limit.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description starts with '搜尋司法院裁判書系統' (Search the Judicial Yuan judgment system), clearly stating the verb and resource. It is distinct from sibling tools like get_judgment (single judgment fetch) and search_interpretations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides explicit guidance on when to use keyword vs case_word/case_number, with a concrete example. Describes advanced main_text usage for win/loss filtering. Does not explicitly mention when not to use or compare with sibling tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_regulationsA

以關鍵字搜尋法規名稱。

在完整法規清單(11,700+ 部)中搜尋,回傳符合的法規名稱與 pcode。 結果按現行法規優先排序,每頁 50 筆。

Args: keyword: 搜尋關鍵字(如「勞動」「消費」「智慧財產」) offset: 分頁偏移(從第幾筆開始,預設 0) exclude_abolished: 排除已廢止法規(預設 False,已廢止法規仍可搜尋但標記狀態)

Returns: 符合關鍵字的法規列表

ParametersJSON Schema
NameRequiredDescriptionDefault
keywordYes
offsetNo
exclude_abolishedNo

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. Explains sorting behavior, pagination, and exclude_abolished effect. Does not explicitly state read-only nature but implied by search functionality.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Concise overall, front-loaded with purpose. Some redundancy in explaining exclude_abolished both in overview and in the parameter list. Still efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Covers purpose, scope, parameters, return values, sorting, pagination. No output schema, but return description is adequate. Complete for a search tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema has 0% description coverage; description adds meaning for all three parameters: keyword with examples, offset with default, exclude_abolished with behavior explanation. Significantly enhances schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states 'search regulation names by keyword', specifies scope (11,700+ regulations), and distinguishes from sibling tools that search other content like interpretations or judgments.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides context on when to use (search in full regulation list), sorting by active regulations first, pagination of 50 per page. Does not explicitly state alternatives but sibling tool names imply different content types.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 8 tool updatesv1.0.0
    • First observedget_citations
    • First observedget_interpretation
    • First observedget_judgment
    • First observedget_pcode
    • First observedquery_regulation
    • First observedsearch_interpretations
    • First observedsearch_judgments
    • First observedsearch_regulations

TDQS

A4.2/5.0

Scored across 8 tools

Disambiguation5/5

Each tool serves a distinct purpose: citations, interpretations, judgments, regulations, and searches for each. No overlapping functionality.

Naming Consistency5/5

All tool names follow a consistent verb_noun snake_case pattern (e.g., get_interpretation, search_judgments).

Tool Count5/5

8 tools cover the main legal document types and operations without being excessive or insufficient.

Completeness5/5

The tool set covers retrieval of interpretations, judgments, and regulations with both search and full-text access, including citation analysis and law code conversion.

Maintenance

ActivityMaintained
ResponsivenessSlow

Related MCP Connectors

Related MCP Servers