get_law_revision
Retrieve revision history for Japanese laws to track legislative changes and amendments over time using the e-Gov Law API.
Instructions
法令の改正履歴を取得します。
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lawNum | Yes | 法令番号(例: 平成十七年法律第百十七号) |
Implementation Reference
- index.js:190-214 (handler)The main handler function that implements the 'get_law_revision' tool by fetching the amendment history for a specified law number from the e-Gov API and returning it as text content.async getLawRevision(args) { const { lawNum } = args; const url = `${EGOV_API_BASE}/lawrevisions/${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}`, }, ], }; } catch (error) { throw new Error(`改正履歴の取得に失敗しました: ${error.message}`); } }
- index.js:85-98 (registration)The tool registration entry that defines the name, description, and input schema for 'get_law_revision' in the list of available tools.{ name: 'get_law_revision', description: '法令の改正履歴を取得します。', inputSchema: { type: 'object', properties: { lawNum: { type: 'string', description: '法令番号(例: 平成十七年法律第百十七号)', }, }, required: ['lawNum'], }, },
- index.js:88-97 (schema)The input schema defining the required 'lawNum' parameter as a string for the 'get_law_revision' tool.inputSchema: { type: 'object', properties: { lawNum: { type: 'string', description: '法令番号(例: 平成十七年法律第百十七号)', }, }, required: ['lawNum'], },
- index.js:112-113 (handler)The dispatcher case in the CallToolRequestHandler that routes calls to 'get_law_revision' to the getLawRevision method.case 'get_law_revision': return await this.getLawRevision(args);