Skip to main content
Glama

search_law

Search Japanese laws and regulations by name, number, or keywords using the e-Gov Law API to find legal information and track revisions.

Instructions

法令名や法令番号で法令を検索します。キーワード検索に対応しています。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keywordYes検索キーワード(法令名の一部や法令番号)
categoryNo法令の種別(1:法律、2:政令、3:省令など)
limitNo取得する最大件数(デフォルト: 100)

Implementation Reference

  • The main handler function for the 'search_law' tool. It destructures arguments (keyword, category, limit), builds the e-Gov API search URL, fetches the data, truncates if too long, and returns a formatted text response.
    async searchLaw(args) {
      const { keyword, category, limit = 100 } = args;
      
      // 検索APIのURL構築
      const params = new URLSearchParams();
      params.append('keyword', keyword);
      if (category) {
        params.append('category', category);
      }
      
      const url = `${EGOV_API_BASE}/lawlists/1?${params.toString()}`;
      
      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: `法令検索結果(キーワード: "${keyword}"):\n\n${data.substring(0, 5000)}${data.length > 5000 ? '\n...(省略)' : ''}`,
            },
          ],
        };
      } catch (error) {
        throw new Error(`法令検索に失敗しました: ${error.message}`);
      }
    }
  • Input schema/JSON Schema for the 'search_law' tool defining properties: keyword (string, required), category (string enum), limit (number, default 100).
    inputSchema: {
      type: 'object',
      properties: {
        keyword: {
          type: 'string',
          description: '検索キーワード(法令名の一部や法令番号)',
        },
        category: {
          type: 'string',
          description: '法令の種別(1:法律、2:政令、3:省令など)',
          enum: ['1', '2', '3', '4', '5'],
        },
        limit: {
          type: 'number',
          description: '取得する最大件数(デフォルト: 100)',
          default: 100,
        },
      },
      required: ['keyword'],
    },
  • index.js:47-70 (registration)
    Tool registration in the ListToolsRequestSchema response: defines name 'search_law', description, and inputSchema.
    {
      name: 'search_law',
      description: '法令名や法令番号で法令を検索します。キーワード検索に対応しています。',
      inputSchema: {
        type: 'object',
        properties: {
          keyword: {
            type: 'string',
            description: '検索キーワード(法令名の一部や法令番号)',
          },
          category: {
            type: 'string',
            description: '法令の種別(1:法律、2:政令、3:省令など)',
            enum: ['1', '2', '3', '4', '5'],
          },
          limit: {
            type: 'number',
            description: '取得する最大件数(デフォルト: 100)',
            default: 100,
          },
        },
        required: ['keyword'],
      },
    },
  • index.js:108-109 (registration)
    Dispatch/registration in the CallToolRequestSchema switch statement: routes 'search_law' calls to the searchLaw handler.
    case 'search_law':
      return await this.searchLaw(args);

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/groundcobra009/hourei-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server