get_law_data
Retrieve detailed Japanese legal information by specifying a law number, enabling access to complete law data and revision history from the e-Gov Law API.
Instructions
法令番号を指定して法令の詳細データを取得します。
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lawNum | Yes | 法令番号(例: 平成十七年法律第百十七号) |
Implementation Reference
- index.js:164-188 (handler)The main handler function for the 'get_law_data' tool. It takes 'lawNum' argument, constructs the e-Gov API URL, fetches the law data, truncates if longer than 10000 chars, and returns it formatted as MCP content.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 definition for the 'get_law_data' tool, requiring a 'lawNum' string parameter.inputSchema: { type: 'object', properties: { lawNum: { type: 'string', description: '法令番号(例: 平成十七年法律第百十七号)', }, }, required: ['lawNum'], },
- index.js:71-84 (registration)Registration of the 'get_law_data' tool in the ListTools response, including name, description, and input schema.{ name: 'get_law_data', description: '法令番号を指定して法令の詳細データを取得します。', inputSchema: { type: 'object', properties: { lawNum: { type: 'string', description: '法令番号(例: 平成十七年法律第百十七号)', }, }, required: ['lawNum'], }, },