Skip to main content
Glama

get_law

Retrieve specific articles from Japanese labor laws using the e-Gov API. Supports full names and abbreviations to access legal texts for compliance and reference.

Instructions

日本の法令から特定の条文を取得する。e-Gov法令API v2を使用。略称にも対応(労基法→労働基準法、安衛法→労働安全衛生法 等)。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
law_nameYes法令名または略称。例: "労働基準法", "労働安全衛生法", "雇用保険法", "健康保険法", "労基法", "安衛法", "派遣法", "育介法"
articleNo条文番号(format="toc"の場合は省略可)。例: "32", "36", "32の2", "第36条"
paragraphNo項番号(省略時は条文全体)。例: 1, 2
itemNo号番号(省略時は項全体)。例: 1, 2
formatNo出力形式。"markdown"=条文全文(デフォルト), "toc"=目次のみ(トークン節約)

Implementation Reference

  • The handler logic for the 'get_law' tool, which orchestrates calls to law service functions based on arguments.
    async (args) => {
      try {
        if (args.format === 'toc') {
          const result = await getLawToc({ lawName: args.law_name });
          return {
            content: [{
              type: 'text' as const,
              text: `# ${result.lawTitle} — 目次\n\n${result.toc}\n\n---\n出典:e-Gov法令検索(デジタル庁)\nURL: ${result.egovUrl}`,
            }],
          };
        }
    
        if (!args.article) {
          return {
            content: [{
              type: 'text' as const,
              text: 'エラー: 条文番号(article)を指定してください。目次を取得する場合は format="toc" を指定してください。',
            }],
            isError: true,
          };
        }
    
        const result = await getLawArticle({
          lawName: args.law_name,
          article: args.article,
          paragraph: args.paragraph,
          item: args.item,
        });
    
        // 条文番号の表示を正規化(「第XX条」形式にする。入力が既に含む場合は二重付与しない)
        const rawArticle = args.article.replace(/_/g, 'の');
        const articleDisplay = /^第/.test(rawArticle) ? rawArticle : `第${rawArticle}条`;
        const paraDisplay = args.paragraph ? `第${args.paragraph}項` : '';
        const itemDisplay = args.item ? `第${args.item}号` : '';
    
        return {
          content: [{
            type: 'text' as const,
            text: `# ${result.lawTitle} ${articleDisplay}${paraDisplay}${itemDisplay}\n${result.articleCaption ? `(${result.articleCaption})\n` : ''}\n${result.text}\n\n---\n出典:e-Gov法令検索(デジタル庁)\nURL: ${result.egovUrl}`,
          }],
        };
      } catch (error) {
        return {
          content: [{
            type: 'text' as const,
            text: `エラー: ${error instanceof Error ? error.message : String(error)}`,
          }],
          isError: true,
        };
      }
    }
  • Zod schema definition for 'get_law' tool inputs, including law_name, article, paragraph, item, and format.
    {
      law_name: z.string().describe(
        '法令名または略称。例: "労働基準法", "労働安全衛生法", "雇用保険法", "健康保険法", "労基法", "安衛法", "派遣法", "育介法"'
      ),
      article: z.string().optional().describe(
        '条文番号(format="toc"の場合は省略可)。例: "32", "36", "32の2", "第36条"'
      ),
      paragraph: z.number().optional().describe(
        '項番号(省略時は条文全体)。例: 1, 2'
      ),
      item: z.number().optional().describe(
        '号番号(省略時は項全体)。例: 1, 2'
      ),
      format: z.enum(['markdown', 'toc']).optional().describe(
        '出力形式。"markdown"=条文全文(デフォルト), "toc"=目次のみ(トークン節約)'
      ),
    },
  • Registration function for the 'get_law' tool, connecting the schema and handler to the MCP server.
    export function registerGetLawTool(server: McpServer) {
      server.tool(
        'get_law',
        '日本の法令から特定の条文を取得する。e-Gov法令API v2を使用。略称にも対応(労基法→労働基準法、安衛法→労働安全衛生法 等)。',
        {
          law_name: z.string().describe(
            '法令名または略称。例: "労働基準法", "労働安全衛生法", "雇用保険法", "健康保険法", "労基法", "安衛法", "派遣法", "育介法"'
          ),
          article: z.string().optional().describe(
            '条文番号(format="toc"の場合は省略可)。例: "32", "36", "32の2", "第36条"'
          ),
          paragraph: z.number().optional().describe(
            '項番号(省略時は条文全体)。例: 1, 2'
          ),
          item: z.number().optional().describe(
            '号番号(省略時は項全体)。例: 1, 2'
          ),
          format: z.enum(['markdown', 'toc']).optional().describe(
            '出力形式。"markdown"=条文全文(デフォルト), "toc"=目次のみ(トークン節約)'
          ),
        },
        async (args) => {
          try {
            if (args.format === 'toc') {
              const result = await getLawToc({ lawName: args.law_name });
              return {
                content: [{
                  type: 'text' as const,
                  text: `# ${result.lawTitle} — 目次\n\n${result.toc}\n\n---\n出典:e-Gov法令検索(デジタル庁)\nURL: ${result.egovUrl}`,
                }],
              };
            }
    
            if (!args.article) {
              return {
                content: [{
                  type: 'text' as const,
                  text: 'エラー: 条文番号(article)を指定してください。目次を取得する場合は format="toc" を指定してください。',
                }],
                isError: true,
              };
            }
    
            const result = await getLawArticle({
              lawName: args.law_name,
              article: args.article,
              paragraph: args.paragraph,
              item: args.item,
            });
    
            // 条文番号の表示を正規化(「第XX条」形式にする。入力が既に含む場合は二重付与しない)
            const rawArticle = args.article.replace(/_/g, 'の');
            const articleDisplay = /^第/.test(rawArticle) ? rawArticle : `第${rawArticle}条`;
            const paraDisplay = args.paragraph ? `第${args.paragraph}項` : '';
            const itemDisplay = args.item ? `第${args.item}号` : '';
    
            return {
              content: [{
                type: 'text' as const,
                text: `# ${result.lawTitle} ${articleDisplay}${paraDisplay}${itemDisplay}\n${result.articleCaption ? `(${result.articleCaption})\n` : ''}\n${result.text}\n\n---\n出典:e-Gov法令検索(デジタル庁)\nURL: ${result.egovUrl}`,
              }],
            };
          } catch (error) {
            return {
              content: [{
                type: 'text' as const,
                text: `エラー: ${error instanceof Error ? error.message : String(error)}`,
              }],
              isError: true,
            };
          }
        }
      );
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions the API source (e-Gov法令API v2) and abbreviation support, but doesn't describe error conditions, rate limits, authentication requirements, or what happens when parameters are omitted. For a tool with 5 parameters and no annotation coverage, this is insufficient behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise with just two sentences that each serve clear purposes: stating the core functionality and providing important implementation context. There's zero wasted text, and the information is front-loaded with the primary purpose stated first.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 5 parameters, no annotations, and no output schema, the description is somewhat incomplete. While it states the purpose clearly and mentions the API source, it doesn't address behavioral aspects like error handling, response format, or practical usage constraints that would help an agent invoke it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description adds minimal value beyond the schema - it mentions abbreviation support which relates to the law_name parameter, but doesn't provide additional semantic context about parameter interactions or usage patterns beyond what's in the schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('取得する' - retrieve/obtain) and resource ('日本の法令から特定の条文' - specific articles from Japanese laws/regulations). It distinguishes from sibling tools by specifying it retrieves specific articles rather than searching (like search_law) or getting different document types (like get_jaish_tsutatsu).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context by mentioning the e-Gov API and abbreviation support, but doesn't explicitly state when to use this tool versus alternatives like search_law. It doesn't provide exclusion criteria or clear differentiation from sibling tools beyond the basic purpose.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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/kentaroajisaka/labor-law-mcp'

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