get_law_data
Retrieve detailed Japanese legal information by specifying a law number, enabling access to official legal data from the e-Gov Law API for research or compliance purposes.
Instructions
法令番号を指定して法令の詳細データを取得します。
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lawNum | Yes | 法令番号(例: 平成十七年法律第百十七号) |
Implementation Reference
- index.js:164-188 (handler)The handler function that implements the get_law_data tool. It takes lawNum, fetches data from the EGOV API, truncates if too long, and returns formatted text response.async getLawData(args) { const { lawNum } = args; const url = `${EGOV_API_BASE}/lawdata/${encodeURIComponent(lawNum)}`; try { const response = await fetch(url); if (!response.ok) { throw new Error(`API request failed: ${response.status}`); } const data = await response.text(); return { content: [ { type: 'text', text: `法令データ(法令番号: ${lawNum}):\n\n${data.substring(0, 10000)}${data.length > 10000 ? '\n...(省略)' : ''}`, }, ], }; } catch (error) { throw new Error(`法令データの取得に失敗しました: ${error.message}`); } }
- index.js:74-83 (schema)Input schema for the get_law_data tool, defining the required 'lawNum' parameter as a string.inputSchema: { type: 'object', properties: { lawNum: { type: 'string', description: '法令番号(例: 平成十七年法律第百十七号)', }, }, required: ['lawNum'], },
- index.js:71-84 (registration)Registration of the get_law_data tool in the setTools call, including name, description, and schema.{ name: 'get_law_data', description: '法令番号を指定して法令の詳細データを取得します。', inputSchema: { type: 'object', properties: { lawNum: { type: 'string', description: '法令番号(例: 平成十七年法律第百十七号)', }, }, required: ['lawNum'], }, },
- index.js:110-111 (registration)Dispatch/registration in the switch statement that routes calls to the getLawData handler.case 'get_law_data': return await this.getLawData(args);