@jurislm/judicial-mcp 1.2.6 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,236 @@
1
+ export interface TokenArgs {
2
+ token: string;
3
+ }
4
+ export interface GetJudgmentArgs {
5
+ token: string;
6
+ jid: string;
7
+ }
8
+ export interface ListResourcesArgs {
9
+ categoryNo: string;
10
+ token: string;
11
+ }
12
+ export interface DownloadFileArgs {
13
+ fileSetId: string;
14
+ token: string;
15
+ top?: number;
16
+ skip?: number;
17
+ }
18
+ export interface SearchJudgmentsArgs extends Record<string, unknown> {
19
+ keyword?: string;
20
+ court?: string;
21
+ year?: number;
22
+ caseNumber?: string;
23
+ limit?: number;
24
+ page?: number;
25
+ offset?: number;
26
+ }
27
+ export interface FetchJudgmentTextArgs extends Record<string, unknown> {
28
+ caseId: string;
29
+ }
30
+ export interface QueryRegulationArgs extends Record<string, unknown> {
31
+ lawName: string;
32
+ articleNumber: string;
33
+ refresh?: boolean;
34
+ }
35
+ export declare const TOOLS_CONFIG: {
36
+ readonly auth_token: {
37
+ readonly name: "auth_token";
38
+ readonly description: "取得司法院裁判書查詢系統的授權 Token。帳密從環境變數 JUDICIAL_USER / JUDICIAL_PASSWORD 讀取。";
39
+ readonly inputSchema: {
40
+ readonly type: "object";
41
+ readonly properties: {};
42
+ readonly additionalProperties: false;
43
+ };
44
+ };
45
+ readonly list_judgments: {
46
+ readonly name: "list_judgments";
47
+ readonly description: "取得裁判書異動清單,包含新增、修改或刪除的裁判書資訊。";
48
+ readonly inputSchema: {
49
+ readonly type: "object";
50
+ readonly properties: {
51
+ readonly token: {
52
+ readonly type: "string";
53
+ readonly description: "從 auth_token 工具取得的授權 Token";
54
+ };
55
+ };
56
+ readonly required: readonly ["token"];
57
+ readonly additionalProperties: false;
58
+ };
59
+ };
60
+ readonly get_judgment: {
61
+ readonly name: "get_judgment";
62
+ readonly description: "取得特定裁判書的完整內容,包含裁判全文。";
63
+ readonly inputSchema: {
64
+ readonly type: "object";
65
+ readonly properties: {
66
+ readonly token: {
67
+ readonly type: "string";
68
+ readonly description: "從 auth_token 工具取得的授權 Token";
69
+ };
70
+ readonly jid: {
71
+ readonly type: "string";
72
+ readonly description: "從 list_judgments 工具取得的裁判書 ID";
73
+ };
74
+ };
75
+ readonly required: readonly ["token", "jid"];
76
+ readonly additionalProperties: false;
77
+ };
78
+ };
79
+ readonly list_categories: {
80
+ readonly name: "list_categories";
81
+ readonly description: "取得司法院開放資料平台的所有主題分類清單。";
82
+ readonly inputSchema: {
83
+ readonly type: "object";
84
+ readonly properties: {
85
+ readonly token: {
86
+ readonly type: "string";
87
+ readonly description: "從 member_token 工具取得的會員授權 Token";
88
+ };
89
+ };
90
+ readonly required: readonly ["token"];
91
+ readonly additionalProperties: false;
92
+ };
93
+ };
94
+ readonly list_resources: {
95
+ readonly name: "list_resources";
96
+ readonly description: "取得指定分類下的所有資料源清單。";
97
+ readonly inputSchema: {
98
+ readonly type: "object";
99
+ readonly properties: {
100
+ readonly categoryNo: {
101
+ readonly type: "string";
102
+ readonly description: "從 list_categories 工具取得的分類編號";
103
+ };
104
+ readonly token: {
105
+ readonly type: "string";
106
+ readonly description: "從 member_token 工具取得的會員授權 Token";
107
+ };
108
+ };
109
+ readonly required: readonly ["categoryNo", "token"];
110
+ readonly additionalProperties: false;
111
+ };
112
+ };
113
+ readonly download_file: {
114
+ readonly name: "download_file";
115
+ readonly description: "下載指定檔案集的資料檔案,支援分頁參數。";
116
+ readonly inputSchema: {
117
+ readonly type: "object";
118
+ readonly properties: {
119
+ readonly fileSetId: {
120
+ readonly type: "string";
121
+ readonly description: "從 list_resources 工具取得的檔案集 ID";
122
+ };
123
+ readonly top: {
124
+ readonly type: "integer";
125
+ readonly description: "限制回傳筆數(可選)";
126
+ readonly minimum: 0;
127
+ };
128
+ readonly skip: {
129
+ readonly type: "integer";
130
+ readonly description: "跳過筆數,用於分頁(可選)";
131
+ readonly minimum: 0;
132
+ };
133
+ readonly token: {
134
+ readonly type: "string";
135
+ readonly description: "從 member_token 工具取得的會員授權 Token";
136
+ };
137
+ };
138
+ readonly required: readonly ["fileSetId", "token"];
139
+ readonly additionalProperties: false;
140
+ };
141
+ };
142
+ readonly member_token: {
143
+ readonly name: "member_token";
144
+ readonly description: "取得司法院開放平台的會員授權 Token,用於存取會員專屬資源。帳密從環境變數 JUDICIAL_USER / JUDICIAL_PASSWORD 讀取。";
145
+ readonly inputSchema: {
146
+ readonly type: "object";
147
+ readonly properties: {};
148
+ readonly additionalProperties: false;
149
+ };
150
+ };
151
+ readonly search_judgments: {
152
+ readonly name: "search_judgments";
153
+ readonly description: "透過司法院公開裁判書查詢頁搜尋裁判,不需要授權 Token。year 可使用西元或民國年;完整案號可同時指定案類。";
154
+ readonly inputSchema: {
155
+ readonly type: "object";
156
+ readonly properties: {
157
+ readonly keyword: {
158
+ readonly type: "string";
159
+ readonly description: "裁判全文關鍵字,最多 128 字元";
160
+ };
161
+ readonly court: {
162
+ readonly type: "string";
163
+ readonly description: "司法院法院名稱或官方法院代碼";
164
+ };
165
+ readonly year: {
166
+ readonly type: "integer";
167
+ readonly description: "裁判年度,可使用西元或民國年";
168
+ readonly minimum: 1;
169
+ readonly maximum: 9999;
170
+ };
171
+ readonly caseNumber: {
172
+ readonly type: "string";
173
+ readonly description: "案號數字,或「年度案類字第號」格式";
174
+ };
175
+ readonly limit: {
176
+ readonly type: "integer";
177
+ readonly description: "每頁最多回傳筆數,預設 5,上限 10";
178
+ readonly minimum: 1;
179
+ readonly maximum: 10;
180
+ };
181
+ readonly page: {
182
+ readonly type: "integer";
183
+ readonly description: "官方結果頁頁碼,預設 1,上限 50";
184
+ readonly minimum: 1;
185
+ readonly maximum: 50;
186
+ };
187
+ readonly offset: {
188
+ readonly type: "integer";
189
+ readonly description: "官方結果頁內的起始位置,預設 0,範圍 0–19;依回傳的 next_page 與 next_offset 繼續查詢";
190
+ readonly minimum: 0;
191
+ readonly maximum: 19;
192
+ };
193
+ };
194
+ readonly additionalProperties: false;
195
+ };
196
+ };
197
+ readonly fetch_judgment_text: {
198
+ readonly name: "fetch_judgment_text";
199
+ readonly description: "依 search_judgments 回傳的 case_id 取得司法院公開裁判全文,不需要授權 Token。";
200
+ readonly inputSchema: {
201
+ readonly type: "object";
202
+ readonly properties: {
203
+ readonly caseId: {
204
+ readonly type: "string";
205
+ readonly description: "search_judgments 回傳的 case_id";
206
+ };
207
+ };
208
+ readonly required: readonly ["caseId"];
209
+ readonly additionalProperties: false;
210
+ };
211
+ };
212
+ readonly query_regulation: {
213
+ readonly name: "query_regulation";
214
+ readonly description: "依官方法規名稱與條號查詢全國法規資料庫現行條文,回傳版本日期與官方來源;不提供歷史版本。";
215
+ readonly inputSchema: {
216
+ readonly type: "object";
217
+ readonly properties: {
218
+ readonly lawName: {
219
+ readonly type: "string";
220
+ readonly description: "法規名稱;若名稱不是唯一精確匹配,會回傳候選清單";
221
+ };
222
+ readonly articleNumber: {
223
+ readonly type: "string";
224
+ readonly description: "條號數字,可含連字號,例如 1 或 1-1";
225
+ };
226
+ readonly refresh: {
227
+ readonly type: "boolean";
228
+ readonly description: "設為 true 時略過快取並重新讀取官方來源";
229
+ };
230
+ };
231
+ readonly required: readonly ["lawName", "articleNumber"];
232
+ readonly additionalProperties: false;
233
+ };
234
+ };
235
+ };
236
+ export declare const TOOL_HANDLERS: Record<string, (_args: Record<string, unknown>) => Promise<unknown>>;
package/.env.example DELETED
@@ -1,7 +0,0 @@
1
- # 司法院裁判書查詢系統帳號設定
2
- # 請向司法院申請 API 存取權限並填入您的帳號密碼
3
- JUDICIAL_USER=your_username_here
4
- JUDICIAL_PASSWORD=your_password_here
5
-
6
- # 可選:伺服器端口號設定(僅適用於舊版 Express 伺服器)
7
- PORT=3000
package/CHANGELOG.md DELETED
@@ -1,67 +0,0 @@
1
- # Changelog
2
-
3
- ## [1.2.1] - 2025-07-23
4
- ### 改進
5
- - 達成 100% 測試覆蓋率 (46 tests, 278 lines covered)
6
- - 移除未使用的 Express 伺服器相關檔案和依賴
7
- - 修正所有 oxlint 警告,提升程式碼品質
8
- - 增強 MCP 配置測試,包含所有 7 個工具的完整驗證
9
- - 新增工具架構安全性驗證 (`additionalProperties: false`)
10
-
11
- ### 移除
12
- - 刪除 `server.js`, `start.js` 及相關測試檔案
13
- - 清理 62 個未使用的 npm 套件依賴
14
- - 移除 Express.js 和 HTTP API 相關程式碼
15
-
16
- ---
17
-
18
- ## [1.2.0] - 2025-07-22
19
- ### 新增
20
- - TypeScript 類型定義檔案 (`types/index.d.ts`)
21
- - 輸入驗證功能
22
- - 測試覆蓋率腳本 (`test:coverage`)
23
- - 環境變數範例檔案 (`.env.example`)
24
-
25
- ### 改進
26
- - 強化錯誤處理和日誌記錄
27
- - 新增 API 參數驗證機制
28
-
29
- ---
30
-
31
- ## [1.1.1] - 2025-07-10
32
- ### 修復
33
- - 修正版本號不一致的問題
34
- - 同步所有文件中的版本資訊
35
-
36
- ### 改進
37
- - 優化專案版本管理流程
38
-
39
- ---
40
-
41
- ## [1.1.0] - 2025-07-02
42
- ### 新增
43
- - 增加對 `list_resources` 工具的完整支持,允許用戶根據分類編號檢索資料源。
44
- - 完善 `download_file` 工具,支持分頁參數 `top` 和 `skip`。
45
-
46
- ### 改進
47
- - 優化 `auth_token` 工具的錯誤處理,提供更詳細的錯誤信息。
48
- - 更新測試覆蓋率,新增對 `list_resources` 和 `download_file` 工具的測試用例。
49
- - 改善 `README.md` 文檔,新增對新功能的使用說明。
50
-
51
- ### 修復
52
- - 修正 `get_judgment` 工具在處理無效裁判書 ID 時的錯誤回應。
53
- - 修復環境變數未正確加載時的潛在問題。
54
-
55
- ---
56
-
57
- ## [1.0.0] - 2025-06-30
58
- ### ✨ 主要功能
59
-
60
- - 🏛️ **司法院裁判書 API** - 取得裁判書授權、清單和內容
61
- - 📊 **開放資料 API** - 存取司法院開放資料平台
62
- - 🔍 **分類資料** - 瀏覽主題分類和資料源
63
- - 📥 **檔案下載** - 下載司法資料檔案
64
- - 🧪 **完整測試** - Jest 測試覆蓋
65
- - 🔒 **安全認證** - 支援 Token 基礎認證
66
- - 📖 **完整文檔** - 詳細的 API 文檔和使用範例
67
- - ⚡ **高效能** - 基於 Express.js 框架,支援非同步處理
@@ -1,78 +0,0 @@
1
- # 貢獻者行為準則
2
-
3
- ## 我們的承諾
4
-
5
- 為了營造一個開放且友善的環境,我們身為貢獻者和維護者承諾,無論年齡、體型、身心障礙、族群、性別認同與表達、經驗程度、教育程度、社會經濟地位、國籍、個人外觀、種族、宗教或性取向,參與我們專案和社群的每個人都能享有無騷擾的體驗。
6
-
7
- ## 我們的標準
8
-
9
- 有助於創造正面環境的行為範例包括:
10
-
11
- * 使用友善和包容的語言
12
- * 尊重不同的觀點和經驗
13
- * 優雅地接受建設性批評
14
- * 專注於對社群最有益的事情
15
- * 對其他社群成員展現同理心
16
-
17
- 不能接受的參與者行為範例包括:
18
-
19
- * 使用與性有關的言語或圖像,以及令人不悦的性關注或性騷擾
20
- * 惡意攻擊、侮辱或貶損的評論,人身攻擊或政治攻擊
21
- * 公開或私下的騷擾
22
- * 未經明確許可,發佈他人的個人資料,例如住址或電子信箱
23
- * 其他可以被合理認定為不恰當或不專業的行為
24
-
25
- ## 我們的責任
26
-
27
- 專案維護者有責任為可接受的行為標準做出澄清,並且會對任何不當行為採取適當且公平的糾正措施。
28
-
29
- 專案維護者有權力及責任去移除、編輯或拒絕與本行為準則不符的評論(comments)、提交(commits)、程式碼、wiki 編輯、問題(issues)和其他貢獻,或暫時或永久禁止任何他們認為有不適當、威脅、冒犯或有害行為的貢獻者。
30
-
31
- ## 適用範圍
32
-
33
- 本行為準則適用於所有專案空間,也適用於個人在公共空間代表該專案或其社群的情況。代表專案或社群的例子包括使用官方專案的電子郵件地址、透過官方社群媒體帳號發文,或在線上或線下活動中擔任指定代表。專案的代表可由專案維護者進一步定義及澄清。
34
-
35
- ## 執行
36
-
37
- 若遇到濫用、騷擾或其他不當行為,可以透過 [zxtw17985321@gmail.com] 與專案團隊聯繫。所有投訴都會被審查及調查,並會依情況給予必要且適當的回應。專案團隊有義務為舉報者的隱私保密。具體執行政策的更多細節可能會單獨發佈。
38
-
39
- 專案維護者若未能以誠信原則遵守或執行本行為準則,可能會面臨專案領導階層其他成員所決定的暫時或永久的影響。
40
-
41
- ## 特定於司法院 MCP 專案的補充說明
42
-
43
- 作為一個專注於台灣司法資料存取的開源專案,我們特別重視:
44
-
45
- ### 法律資料的正確性和倫理使用
46
-
47
- * 貢獻者應確保所提供的程式碼和文件準確無誤
48
- * 尊重司法資料的隱私和敏感性
49
- * 遵守相關的法律法規和資料使用條款
50
- * 不得將本專案用於任何非法或不當目的
51
-
52
- ### 技術討論的專業性
53
-
54
- * 在討論技術問題時保持專業和建設性的態度
55
- * 提供清晰的問題描述和重現步驟
56
- * 尊重不同的技術觀點和解決方案
57
- * 鼓勵學習和知識分享
58
-
59
- ### 社群參與
60
-
61
- * 歡迎各種背景的開發者參與貢獻
62
- * 提供中文和英文的雙語支援
63
- * 協助新手理解專案架構和貢獻流程
64
- * 分享使用案例和最佳實踐
65
-
66
- ## 歸屬
67
-
68
- 本行為準則改編自 [Contributor Covenant][homepage] 2.1 版,可於 [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1] 取得。
69
-
70
- 社群影響指引的靈感來自 [Mozilla's code of conduct enforcement ladder][Mozilla CoC]。
71
-
72
- 關於本行為準則的常見問題,請參閱 [https://www.contributor-covenant.org/faq][FAQ]。翻譯可於 [https://www.contributor-covenant.org/translations][translations] 取得。
73
-
74
- [homepage]: https://www.contributor-covenant.org
75
- [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
76
- [Mozilla CoC]: https://github.com/mozilla/diversity
77
- [FAQ]: https://www.contributor-covenant.org/faq
78
- [translations]: https://www.contributor-covenant.org/translations
package/MCP_TUTORIAL.md DELETED
@@ -1,83 +0,0 @@
1
- # 司法院 MCP 伺服器教學
2
-
3
- ## 概述
4
-
5
- 司法院 MCP 伺服器讓 AI 助手透過 Model Context Protocol 存取台灣司法院的開放資料和裁判書。
6
-
7
- ## 快速開始
8
-
9
- ### 安裝
10
- ```bash
11
- npm install judicial-mcp
12
- ```
13
-
14
- ### 環境設定
15
- ```bash
16
- cp .env.example .env
17
- # 編輯 .env 設定司法院帳號密碼
18
- JUDICIAL_USER=your_username
19
- JUDICIAL_PASSWORD=your_password
20
- ```
21
-
22
- ## MCP 客戶端配置
23
-
24
- ### Claude Desktop
25
- ```json
26
- {
27
- "mcpServers": {
28
- "judicial-mcp": {
29
- "command": "npx",
30
- "args": ["-y", "judicial-mcp@latest"],
31
- "env": {
32
- "JUDICIAL_USER": "your_username",
33
- "JUDICIAL_PASSWORD": "your_password"
34
- }
35
- }
36
- }
37
- }
38
- ```
39
-
40
- ## 可用工具
41
-
42
- ### 裁判書開放
43
- - `auth_token` - 驗證權限(服務時間:00:00~06:00)
44
- - `list_judgments` - 取得裁判書異動清單
45
- - `get_judgment` - 取得裁判書內容
46
-
47
- ### 開放平台
48
- - `list_categories` - 取得主題分類清單
49
- - `list_resources` - 取得資料源清單
50
- - `download_file` - 下載資料檔案(支援分頁)
51
- - `member_token` - 取得會員授權 Token
52
-
53
- ## 使用流程
54
-
55
- ### 裁判書開放查詢
56
- 1. `auth_token` → 驗證權限
57
- 2. `list_judgments` → 取得異動清單
58
- 3. `get_judgment` → 取得裁判書內容
59
-
60
- ### 開放平台查詢
61
- 1. `member_token` → 取得會員授權 Token
62
- 2. `list_categories` → 取得主題分類
63
- 3. `list_resources` → 取得資料源
64
- 4. `download_file` → 下載資料檔案
65
-
66
- ## 常見問題
67
-
68
- **Q: 授權失敗**
69
- A: 確認司法院帳號密碼正確,檢查環境變數設定
70
-
71
- **Q: 服務時間限制**
72
- A: `auth_token` 僅在 00:00~06:00 提供服務
73
-
74
- **Q: 大檔案處理**
75
- A: `download_file` 工具會將檔案轉為 base64 格式回傳
76
-
77
- ## 開發命令
78
-
79
- ```bash
80
- npm start # 啟動伺服器
81
- npm test # 執行測試
82
- npm run lint # 程式碼檢查
83
- ```
@@ -1,145 +0,0 @@
1
- /**
2
- * @file __tests__/mcp.test.js
3
- * @description MCP 伺服器功能測試
4
- */
5
-
6
- const { TOOLS_CONFIG, TOOL_HANDLERS } = require('../src/tools');
7
-
8
- describe('MCP 伺服器測試', () => {
9
- describe('工具配置', () => {
10
- test('所有工具都有必要的屬性', () => {
11
- const tools = Object.values(TOOLS_CONFIG);
12
-
13
- tools.forEach(tool => {
14
- expect(tool).toHaveProperty('name');
15
- expect(tool).toHaveProperty('description');
16
- expect(tool).toHaveProperty('inputSchema');
17
- expect(tool.inputSchema).toHaveProperty('type');
18
- expect(tool.inputSchema.type).toBe('object');
19
- });
20
- });
21
-
22
- test('工具名稱唯一性', () => {
23
- const tools = Object.values(TOOLS_CONFIG);
24
- const names = tools.map(tool => tool.name);
25
- const uniqueNames = [...new Set(names)];
26
-
27
- expect(names.length).toBe(uniqueNames.length);
28
- });
29
-
30
- test('所有工具都有對應的處理器', () => {
31
- const toolNames = Object.keys(TOOLS_CONFIG);
32
- const handlerNames = Object.keys(TOOL_HANDLERS);
33
-
34
- expect(toolNames.sort()).toEqual(handlerNames.sort());
35
- });
36
-
37
- test('所有工具都禁止額外屬性', () => {
38
- const tools = Object.values(TOOLS_CONFIG);
39
-
40
- tools.forEach(tool => {
41
- expect(tool.inputSchema.additionalProperties).toBe(false);
42
- });
43
- });
44
- });
45
-
46
- describe('工具處理器', () => {
47
- test('list_categories 處理器存在', () => {
48
- expect(TOOL_HANDLERS.list_categories).toBeDefined();
49
- expect(typeof TOOL_HANDLERS.list_categories).toBe('function');
50
- });
51
-
52
- test('auth_token 處理器參數驗證', async () => {
53
- // 測試缺少環境變數時的行為
54
- const originalUser = process.env.JUDICIAL_USER;
55
- const originalPassword = process.env.JUDICIAL_PASSWORD;
56
-
57
- delete process.env.JUDICIAL_USER;
58
- delete process.env.JUDICIAL_PASSWORD;
59
-
60
- await expect(TOOL_HANDLERS.auth_token({}))
61
- .rejects
62
- .toThrow('未提供使用者帳號或密碼');
63
-
64
- // 恢復環境變數
65
- if (originalUser) process.env.JUDICIAL_USER = originalUser;
66
- if (originalPassword) process.env.JUDICIAL_PASSWORD = originalPassword;
67
- });
68
- });
69
-
70
- describe('工具配置驗證', () => {
71
- test('auth_token 工具配置正確', () => {
72
- const tool = TOOLS_CONFIG.auth_token;
73
-
74
- expect(tool.name).toBe('auth_token');
75
- expect(tool.inputSchema.properties).toHaveProperty('user');
76
- expect(tool.inputSchema.properties).toHaveProperty('password');
77
- expect(tool.inputSchema.required).toBeUndefined(); // 因為有預設值
78
- });
79
-
80
- test('list_judgments 工具配置正確', () => {
81
- const tool = TOOLS_CONFIG.list_judgments;
82
-
83
- expect(tool.name).toBe('list_judgments');
84
- expect(tool.inputSchema.properties).toHaveProperty('token');
85
- expect(tool.inputSchema.required).toContain('token');
86
- });
87
-
88
- test('get_judgment 工具配置正確', () => {
89
- const tool = TOOLS_CONFIG.get_judgment;
90
-
91
- expect(tool.name).toBe('get_judgment');
92
- expect(tool.inputSchema.properties).toHaveProperty('token');
93
- expect(tool.inputSchema.properties).toHaveProperty('jid');
94
- expect(tool.inputSchema.required).toContain('token');
95
- expect(tool.inputSchema.required).toContain('jid');
96
- });
97
-
98
- test('download_file 工具配置正確', () => {
99
- const tool = TOOLS_CONFIG.download_file;
100
-
101
- expect(tool.name).toBe('download_file');
102
- expect(tool.inputSchema.properties).toHaveProperty('fileSetId');
103
- expect(tool.inputSchema.properties).toHaveProperty('top');
104
- expect(tool.inputSchema.properties).toHaveProperty('skip');
105
- expect(tool.inputSchema.properties).toHaveProperty('token');
106
- expect(tool.inputSchema.required).toEqual(['fileSetId', 'token']);
107
- expect(tool.inputSchema.properties.top.pattern).toBe('^[0-9]+$');
108
- expect(tool.inputSchema.properties.skip.pattern).toBe('^[0-9]+$');
109
- });
110
-
111
- test('list_categories 工具配置正確', () => {
112
- const tool = TOOLS_CONFIG.list_categories;
113
-
114
- expect(tool.name).toBe('list_categories');
115
- expect(tool.inputSchema.properties).toEqual({
116
- token: {
117
- type: 'string',
118
- description: '從 member_token 工具取得的會員授權 Token'
119
- }
120
- });
121
- expect(tool.inputSchema.required).toEqual(['token']);
122
- expect(tool.inputSchema.additionalProperties).toBe(false);
123
- });
124
-
125
- test('list_resources 工具配置正確', () => {
126
- const tool = TOOLS_CONFIG.list_resources;
127
-
128
- expect(tool.name).toBe('list_resources');
129
- expect(tool.inputSchema.properties).toHaveProperty('categoryNo');
130
- expect(tool.inputSchema.properties).toHaveProperty('token');
131
- expect(tool.inputSchema.required).toEqual(['categoryNo', 'token']);
132
- expect(tool.inputSchema.additionalProperties).toBe(false);
133
- });
134
-
135
- test('member_token 工具配置正確', () => {
136
- const tool = TOOLS_CONFIG.member_token;
137
-
138
- expect(tool.name).toBe('member_token');
139
- expect(tool.inputSchema.properties).toHaveProperty('user');
140
- expect(tool.inputSchema.properties).toHaveProperty('password');
141
- expect(tool.inputSchema.required).toBeUndefined(); // 因為有預設值
142
- expect(tool.inputSchema.additionalProperties).toBe(false);
143
- });
144
- });
145
- });