{
  "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
  "name": "jpcite-mcp",
  "version": "0.4.0",
  "description": "Japan public-program MCP — subsidies, loans, tax, law, invoice & corporate data. 11,601 searchable programs + 9,484 e-Gov law metadata records + 1,185 行政処分 + 2,065 判例 + 362 入札 + 13,801 適格事業者 + corporate/entity-fact graph coverage. ¥3/billable unit, 3 free/day per IP. Evidence Packet with source_url + source_fetched_at + known gaps + 互換/排他 rules. 139 tools.",
  "author": {
    "name": "Bookyou株式会社",
    "url": "https://jpcite.com"
  },
  "license": "MIT",
  "homepage": "https://jpcite.com",
  "repository": {
    "url": "https://github.com/shigetosidumeda-cyber/autonomath-mcp",
    "source": "github"
  },
  "protocol": "mcp-2025-06-18",
  "transport": "stdio",
  "runtime": "python-3.11+",
  "install": {
    "command": "uvx autonomath-mcp",
    "install_url": "https://jpcite.com/integrations/?src=mcp_registry",
    "alt": {
      "pip": "pip install autonomath-mcp && autonomath-mcp",
      "claude_desktop": "Install the jpcite desktop extension (.mcpb bundle) from https://jpcite.com/downloads/autonomath-mcp.mcpb?src=mcp_registry"
    }
  },
  "manifest_url": "https://jpcite.com/mcp-server.json?src=mcp_registry",
  "packages": [
    {
      "registryType": "pypi",
      "registryBaseUrl": "https://pypi.org",
      "identifier": "autonomath-mcp",
      "version": "0.4.0",
      "runtimeHint": "uvx",
      "transport": {
        "type": "stdio"
      }
    }
  ],
  "tools": [
    {
      "name": "search_programs",
      "description": "DISCOVER: Search 11,601 Japanese public programs (subsidies/loans/tax incentives/certifications) with Tier-graded data quality.\n\n補助金・助成金・融資・税制優遇・認定制度を横断検索する (国 + 47 都道府県 + 市区町村). Returns program **definitions** (policy text, not recipients) with tier-graded quality labels and primary-source URL + fetched_at where available; known aggregator sources are excluded where detected. Jグランツ 公開 API does not support this cross-ministry / cross-prefecture discovery with quality ranking; this is the canonical entrypoint for \"which subsidy candidates should X review?\" questions.\n\nUse this for program **definitions** (eligibility, amount, window, authority).\nTo find **real recipients** of a program (\"businesses like mine actually\nreceived this\"), use `search_case_studies` instead — that returns applicant\nprofiles, not policy text.\n\nTypical queries:\n  - \"この事業に使える補助金は?\" / \"Which subsidy candidates should this business review?\"\n  - \"東京都の小規模事業者向け、上限 300 万円以下の補助金は?\"\n  - \"設備投資に使える税制優遇・税額控除は?\"\n  - \"農林水産省管轄で 認定新規就農者向けの助成金を一覧\"\n\nFilters combine freely (AND across dimensions, OR within each list). Japanese\nfree-text search works for 3+ char queries via FTS5 trigram; shorter queries\nfall back to LIKE substring.\n\nTier ranking (best→worst): S, A, B, C. S/A are verified by primary-source\nURL + evidence on 8+/10 A-J dimensions; B is partial (4-7 dims); C is sparse\n(1-3 dims, name+URL only). Non-public records are not exposed.\nWhen presenting to an end user, default to tier ∈ {S, A, B} and mark C\nas \"要 1 次確認\".\n\n`fields` controls response size per row (see param description).\n\nWHEN NOT:\n  - `search_enforcement_cases` instead if the user asks about 不正受給 / 返還命令 / 会計検査院.\n  - `search_case_studies` instead if they ask which *recipients* got the program (\"農事法人 E で使えた補助金\", \"北海道の食品製造で採択例\").\n  - `search_loan_programs` instead for 融資 filtered by 担保・保証人 axes; search_programs does surface 融資 rows but cannot filter on the three-axis risk.\n  - `enum_values(field=…)` *first* if unsure whether a target_type / funding_purpose / authority_level / prefecture value is canonical — the DB mixes \"sole_proprietor\" / \"個人事業主\", \"省エネ\" / \"energy\" etc. Prefecture uses the full suffix (\"東京都\", not \"東京\" or \"Tokyo\").\n\nLIMITATIONS:\n  - Non-public records are excluded from the public MCP surface.\n  - `source_fetched_at` is a **uniform sentinel** across bulk-rewritten rows (<100 distinct values for thousands of programs). Render as \"出典取得日\" (when we last fetched), never as \"最終更新日\" or \"現行確認日\" — the column does not imply we verified currency.\n  - FTS5 trigram tokenizer causes false positives on single-kanji overlap. Searching `税額控除` also matches `ふるさと納税` because both contain `税`. For 2+ character kanji compounds, wrap the query in quotes (`\"税額控除\"`) to force phrase matching.\n  - `application_window` coverage is partial; many rows store 通年 / 随時 / empty — absence of a date does not mean closed. Fall back to the source URL for 募集期間 when the field is null.\n  - `amount_max_man_yen` is a 万円 unit (not 円). Filtering `amount_max_man_yen <= 300` matches programs with cap ≤ 300万円, not ≤ 300円.\n  - `as_of` (default 'today' JST) drops rows whose `application_window.end_date` is strictly past relative to the pivot. Rows lacking a structured end_date (通年 / 随時 / null) are always kept — absence of a deadline is not closure. Pass `as_of='YYYY-MM-DD'` for historical \"what was active at X\" queries; `meta.data_as_of` echoes the resolved date.\n\nCHAIN:\n  → `get_program(unified_id=…)` for single-record detail.\n  → `batch_get_programs(unified_ids=[…])` when the user wants full shape for 2-50 rows at once.\n  → `check_exclusions(program_ids=[…])` to verify A+B 併給可否.\n  → `search_case_studies(program_used=primary_name)` to attach recipient evidence (the field does a substring match; today's data stores names, not unified_ids).\n"
    },
    {
      "name": "get_program",
      "description": "DETAIL: 1 制度の収録済みフィールドの詳細を unified_id で取得する (fetch one 補助金 / 助成金 / 融資 / 税制 / 認定 program detail). Returns application window, required documents, exclusion notes, statistics (J_*), plus source_url + fetched_at lineage.\n\nUse when the user names a specific program (\"事業再構築補助金の要件を教えて\") or\nafter search_programs returns a candidate. For 2-50 programs at once, use\nbatch_get_programs instead (one round-trip).\n\nEnriched fields cover application_window, documents_required, exclusions,\nstatistics (J_statistics often null for B/C tier), authority, contact,\nsubsidy_rate, target_types (detailed).\n\nWHEN NOT:\n  - `batch_get_programs` instead if you have 2-50 unified_ids — avoid N round-trips.\n  - `search_programs` instead when the user only named the program by keyword, not unified_id.\n  - `search_case_studies(program_used=primary_name)` instead when they want recipients, not policy text.\n\nCHAIN:\n  → `check_exclusions(program_ids=[unified_id, …])` to test 併給可否 with other candidates.\n  → `search_case_studies(program_used=primary_name)` for recipient evidence — the field substring-matches programs_used_json, which stores program names (not unified_ids).\n  → `search_enforcement_cases(q=primary_name)` for 不正 / 返還 history against this program.\n"
    },
    {
      "name": "batch_get_programs",
      "description": "DETAIL: 複数の制度を 1 コールで一括取得する (batch fetch up to 50 補助金 / 助成金 / 融資 / 税制 / 認定 programs). Use after search_programs returns a candidate list and the user wants full detail for comparison (\"この3つの補助金を詳しく比較して\") — 50 round-trips collapse to one.\n\nMirrors REST `POST /v1/programs/batch`. Each element of `results[]` has the\nsame shape as `get_program(fields=\"full\")`: Program + enriched (A-J) +\nsource_mentions + lineage.\n\nMissing ids return in `not_found[]` — never raises on partial misses. Check\nboth `results[]` and `not_found[]` before telling the user \"not found\".\n\nWHEN NOT:\n  - `get_program` instead for a single unified_id — simpler contract, smaller payload.\n  - `search_programs` instead when the user has not produced unified_ids yet.\n\nCHAIN:\n  → `check_exclusions(program_ids=[…])` on the same id set to verify 併給可否.\n  → `search_case_studies(program_used=primary_name)` per row when user needs recipient evidence (substring match; data stores names).\n"
    },
    {
      "name": "list_exclusion_rules",
      "description": "COMPLIANCE: 補助金の併給禁止 / 前提要件ルールを列挙する (list 181 subsidy exclusion + prerequisite rules across public-program domains). Use this when the user wants to browse combination restrictions, prerequisite certifications, same-asset restrictions, or explicit combine_ok rules.\n\nTypical queries:\n  - \"補助金の排他ルール一覧が欲しい\"\n  - \"設備投資系の併給制限を教えて\"\n  - \"IT 導入補助金の他省庁事業との重複排除ルールは?\"\n\nRule kinds (181 total):\n  - 125 exclude (相互排他)\n  - 17 prerequisite (A を取る前に B が必要)\n  - 15 absolute (例外なしの併給不可)\n  - 9 combine_ok (明示的に併用可と告知済み)\n  - 6 conditional_reduction (併用時に上限減額)\n  - 9 その他 (same_asset_exclusive 3 / cross_tier_same_asset 2 / area_allocation 1 / cross_tier_loan_interest 1 / entity_scope_restriction 1 / mutex_certification 1)\n\nEach row includes rule_id, kind, severity, referenced program identifiers,\nsource_url where available, and a concise explanation. Treat this as a\nscreening aid: absence of a matching rule is not a legal guarantee that\nevery combination is allowed.\n\nTOKEN BUDGET: default is lean (~68 KB for all 181 rows). For raw citation\ntext pass `verbose=True` (~124 KB). To narrow scope use `kind=[...]`.\n\nWHEN NOT:\n  - `check_exclusions(program_ids=[…])` instead when the user has a specific candidate set — that returns only the triggered rules, not all 181. Do not call both back-to-back for the same question.\n  - `search_programs` / `get_program` instead for program *definitions* — this tool only returns *rules*, not program text.\n\nCHAIN:\n  → `check_exclusions(program_ids=[…])` once the user narrows to candidates.\n  → `search_programs(q=rule.program_a)` to surface the program referenced in a rule they ask about.\n"
    },
    {
      "name": "check_exclusions",
      "description": "COMPLIANCE: 併給可否を機械的に判定する — 候補制度セットに対して 181 本の併給禁止 / 前提要件ルールを走らせ、違反するものだけ返す (given a candidate set of program IDs, run all 181 補助金 exclusion / prerequisite rules and return only the violations). This answers the core \"can I combine A and B?\" / \"do I need certification X before applying for Y?\" question in one call — LLM による PDF 脚注パースの hallucination を構造的に排除する。\n\nTypical queries:\n  - \"IT導入補助金と事業再構築補助金は併用できる?\"\n  - \"これら3つの補助金に同時申請できる?\"\n  - \"スーパーL資金を使う前に必要な認定は?\"\n\nEmpty `hits[]` means no registered rule fired. It does not prove that the\ncombination is allowed; important cases should still be checked against\nthe primary source and the relevant office.\n\nWHEN NOT:\n  - `list_exclusion_rules` instead if the user wants to browse rules generally without a specific candidate set.\n  - `search_programs` first if you don't yet have program_ids — this tool requires them as input.\n\nCHAIN:\n  ← `search_programs` / `batch_get_programs` to produce the program_ids.\n  → `get_program(unified_id=hit.program_a)` to explain a triggered rule in context.\n  → `search_case_studies(program_used=primary_name)` to check how recipients handled the restriction in practice (resolve primary_name via `get_program(unified_id=hit.program_a)` first).\n  DO NOT → `list_exclusion_rules` right after this call — each hit already embeds the rule row (rule_id / description / severity / source_url).\n"
    },
    {
      "name": "get_meta",
      "description": "UTILITY: データの鮮度・網羅件数を確認する (verify dataset freshness and scope). Returns public-searchable program count, canonical vs external-source split, 採択事例 / 融資 / 行政処分 / rule counts, tier distribution (S/A/B/C), prefecture distribution, and last_ingested_at.\n\n**When to call:** before first `search_programs` if the user asks about\ncoverage / freshness (\"データはいつ更新された?\" / \"何件入ってる?\" /\n\"都道府県別の分布は?\"). Otherwise skip to search — the per-row\n`source_fetched_at` is authoritative for per-record freshness.\n\n**Key fields to surface to the user:**\n- `visible_programs`: rows a default search will return\n- `tier_counts`: quality distribution; quote S/A first when the user\n  asks about \"信頼できるデータ\".\n- `last_ingested_at`: UTC ISO-8601 of the most recent pipeline run.\n\nWHEN NOT:\n  - `enum_values(field=…)` instead if the user wants the canonical list of filter values (target_type, funding_purpose, etc.) — get_meta only returns counts, not value lists.\n  - Per-row `source_fetched_at` via `get_program` is more authoritative than `last_ingested_at` for a single program's freshness.\n\nCHAIN:\n  → `enum_values(field=…)` to translate \"何種類の target_type がある?\" after seeing tier_counts.\n  → `search_programs` once the user has confirmed coverage suits their query.\n  DO NOT → call `search_*` tools right after unless the user has a concrete query in hand; get_meta is a coverage/freshness probe, not a discovery hop.\n"
    },
    {
      "name": "get_usage_status",
      "description": "META: 現在のクォータ残量を確認する (probe current API quota state without consuming a slot).\n\nReturns the caller's quota state under the active tier:\n  - ``tier``: \"anonymous\" | \"paid\" | \"free\"\n  - ``limit``: integer cap for the period (None for paid — metered, no cap)\n  - ``remaining``: requests left this period (None for paid)\n  - ``used``: month-to-date or day-to-date count for this caller\n  - ``reset_at``: ISO 8601 timestamp of next quota reset\n  - ``reset_timezone``: \"JST\" (anonymous) or \"UTC\" (authenticated). The\n    anonymous bucket resets at JST 翌日 00:00; authenticated counters\n    reset at JST 翌日 00:00; authenticated paid usage is reported as\n    month-to-date and resets at UTC 月初.\n  - ``upgrade_url``: when relevant, the public upgrade landing.\n  - ``note``: human-readable summary.\n\n**Why this matters for MCP callers:** the anonymous tier hands out\n3 req/日 per IP+fingerprint. An LLM batch that does 60 small queries\nin one session will hit the ceiling at request 4 with a hard 429.\nCalling ``get_usage_status`` *before* a batch lets the agent tell the\nuser \"あと N 件で日次クォータに達します。継続するなら API key を発行してください。\"\ninstead of failing mid-flight.\n\n**Caveat (MCP stdio):** the MCP transport has no client IP, so\nanonymous calls from MCP cannot resolve the per-IP bucket — the tool\nreturns the configured ceiling and a note explaining that the actual\nremaining is observable only from the HTTP layer (``GET /v1/usage``)\nwhere the IP+fingerprint is known. With ``api_key`` supplied, the\nresponse is exact (month-to-date count from usage_events).\n\nWHEN:\n  - Before launching a batch operation that may exceed 3 anonymous calls.\n  - When a previous tool returned a 429-ish hint.\n  - To reassure the user about cost before recommending a sweep.\nWHEN NOT: Do NOT call on every turn — once you know the remaining,\nreuse the value across the session. Calling repeatedly is harmless\nbut noisy (each invocation still costs telemetry latency).\n\nEXAMPLE (anonymous, MCP):\n  get_usage_status() →\n    {\"tier\":\"anonymous\",\"limit\":3,\"remaining\":null,\n     \"reset_at\":\"2026-05-02T00:00:00+09:00\",\"reset_timezone\":\"JST\",\n     \"note\":\"MCP stdio cannot resolve per-IP bucket; call GET /v1/usage for exact remaining.\"}\n\nEXAMPLE (paid):\n  get_usage_status(api_key=\"am_…\") →\n    {\"tier\":\"paid\",\"limit\":null,\"remaining\":null,\"used\":1247,\n     \"reset_at\":\"2026-05-01T00:00:00+00:00\",\"reset_timezone\":\"UTC\"}\n"
    },
    {
      "name": "enum_values",
      "description": "UTILITY: 他ツールのフィルタ値を先に検証する (probe which filter values actually exist for target_type / funding_purpose / program_kind / authority_level / event_type / ministry / loan_type / provider — call this *before* a search when unsure whether a value is canonical). Returns the live top-N distribution sorted by row-count so the agent sees realistic options.\n\nWHAT: Reads the DB directly (no caching) and returns {field, values:[{value,count}], total_distinct, note}. Frequency-ranked. Source tables: programs (visible rows only: excluded=0), enforcement_cases, loan_programs.\n\nWHEN:\n  - Before `search_programs(target_type=[\"…\"])` if unsure of canonical spelling.\n  - When an earlier search returned 0 rows and `hint` suggested \"値が canonical でない可能性\".\n  - When the user uses a vague term (\"製造業\" / \"零細\") and you need to translate to the enum vocabulary.\n\nWHEN NOT: Do not call if you already know the canonical value (e.g. prefecture '東京都' is free-form, not enum — use as-is). Do not call for free-text `q` queries.\n\nCHAIN:\n  → `search_programs` / `search_enforcement_cases` / `search_loan_programs` (pass a value from the returned list).\n  DO NOT → chain enum_values on every turn — once resolved, reuse the value across the session.\n\nEXAMPLE:\n  Input:  field=\"target_type\", limit=10\n  Output: {field: \"target_type\", values: [{value: \"sole_proprietor\", count: 2744}, ...], total_distinct: 58, note: \"...\"}\n"
    },
    {
      "name": "search_enforcement_cases",
      "description": "RISK: 会計検査院 (Board of Audit) の不正・不当請求事例を検索する — 1,185 historical findings of improper 補助金 handling (over-payment / 目的外使用 / eligibility failure / documentation defects). Spread across METI / MAFF / 国交省 / 厚労省; not available as a queryable list in any single public site. Essential for 不正 detection, due-diligence, and 詐欺 prevention before advising a client on a program or counterparty with prior clawback history.\n\nTypical queries:\n  - \"法人 XXX に過去の不正受給・返還命令はある?\" (use `q=<company_name>` or `q=<13-digit houjin_bangou>` — the dedicated `recipient_houjin_bangou` column is NULL across all 1,185 rows because 会計検査院 does not publish 法人番号)\n  - \"事業再構築補助金で過去に不正還付された事例は?\"\n  - \"農水省管轄で最も大きい不当請求額は?\"\n\nOrdered by disclosed_date DESC (most recent first), then case_id for stability.\n\nEmpty results on `q=<company_name_or_houjin_digits>` should be cited as\n\"会計検査院 公表分では見当たらず\" — not as \"clean record\". Private-sector\naudits, in-progress investigations, and 不起訴 cases are not in scope.\n\nWHEN NOT:\n  - `search_programs` instead if the user asks about the *program definition*, not 不正事例 (\"雇用調整助成金 is a program; 雇用調整助成金 不正受給 事例 is an enforcement case\").\n  - `search_case_studies` instead for 採択 (successful adoption), which is the *opposite* signal.\n  - `list_exclusion_rules` instead for 併給禁止 ルール — different dataset, different question.\n\nLIMITATIONS:\n  - `recipient_houjin_bangou` is **100 % NULL** in the current dataset — 会計検査院 公表分 does not publish 法人番号. Filtering by this field returns 0 rows. Use `q=<company_name>` or `q=<houjin_bangou_digits>` instead (both hit source_title / reason_excerpt / program_name_hint substring).\n  - Dataset covers only **会計検査院 公表分** (annual 検査報告 + 随時報告). Private-sector audits, in-progress investigations, and 不起訴 cases are not included. \"No hits\" must be cited as \"会計検査院 公表分では見当たらず\", not \"clean record\".\n  - `ministry` uses the current ministry name; ministry restructures (e.g. 旧 通産省 → 経産省) are collapsed to the post-reform label. Historical queries should search `q=<bureau>` instead.\n  - `disclosed_date` granularity is **year+quarter** for many rows (e.g. 2023-03-31 is a placeholder for \"FY2022 検査報告\"); do not treat as a precise incident date.\n  - `as_of` (default 'today' JST) drops cases whose `disclosed_until` is past (公表 から外れた古い事例) and cases whose `disclosed_date` is future. NULL columns pass the filter. For historical 公表分 lookups pass an ISO date. `meta.data_as_of` echoes the resolved date.\n\nCHAIN:\n  → `get_enforcement_case(case_id=…)` for the full record + legal_basis + bureau.\n  → `search_programs(q=program_name_hint)` to find the current active program referenced in the case.\n\n`fields` controls response size per row (see param description). Default\nis 'minimal' (token-shaping per dd_v3_09 / v7 P3-K) — pass `fields='full'`\nwhen the audit detail (amount_*, reason_excerpt, legal_basis) is needed.\n"
    },
    {
      "name": "get_enforcement_case",
      "description": "DETAIL: 会計検査院 不正・不当請求事例 1 件の詳細を取得する (fetch one enforcement case). Returns full record: event_type, ministry, recipient (name + 法人番号 + kind), bureau, prefecture, occurred_fiscal_years, all amount_* fields (improper_grant / project_cost / grant_paid), reason_excerpt, legal_basis, source_url, disclosed_date.\n\nExample:\n    get_enforcement_case(case_id=\"ENF-2024-METI-0123\")\n    → {\"case_id\": \"ENF-2024-METI-0123\", \"event_type\": \"improper_grant\",\n       \"ministry\": \"経産省\", \"recipient_name\": \"...\", \"amount_improper_grant_yen\": 12000000,\n       \"reason_excerpt\": \"...\", \"source_url\": \"...\"}\n\nWhen NOT to call:\n    - Without a case_id → use search_enforcement_cases / check_enforcement_am first.\n    - For 補助金 program definition → use get_program (this returns audit findings).\n    - For 判例 / court rulings → use get_court_decision (different table).\n    - To screen a 法人 across all enforcement → use check_enforcement_am(houjin_bangou).\n\nCHAIN:\n  ← `search_enforcement_cases` produces the case_id.\n  → `search_programs(q=program_name_hint)` to cross-reference the current form of the program named in the case.\n"
    },
    {
      "name": "search_case_studies",
      "description": "EVIDENCE: 採択事例 (recipient profiles paired with programs actually received) を検索する — 2,286 records covering Jグランツ 採択結果 + mirasapo 事業事例 + 都道府県 事例集. The Jグランツ 公開 API does not expose adoption history; cross-ministry aggregation here normally requires hand-crawling ministry PDFs. Each record has company_name + 法人番号 + prefecture + JSIC 業種 + employees + programs received + 受給額.\n\n**Use this** when the user wants \"proof that a business like mine actually\ngot this\" — recipient profile matching, benchmarking, social proof.\n**Use `search_programs` instead** for policy definitions (eligibility,\namount, window). Do not conflate the two: search_programs returns policy\ntext, search_case_studies returns real recipients.\n\nTypical queries:\n  - \"うちと同じ規模・業種で採択された会社はある?\"\n  - \"事業再構築補助金で採択された北海道の中小企業は?\"\n  - \"この法人 (法人番号 XXX) はどの補助金を受給してる?\"\n\nOrdered by publication_date DESC (most recent first), case_id for stability.\n\nWHEN NOT:\n  - `search_programs` instead for policy text (eligibility / amount / window).\n  - `search_enforcement_cases` instead for 不正 / 返還 (opposite signal — this tool returns successful adoption, that one returns clawbacks).\n  - `search_loan_programs` instead for 融資 products — this table is grant-only.\n  - `enum_values(field=\"programs_used\")` *first* when unsure which program_used string will match — only 35 distinct values exist (all raw names, no unified_ids).\n\nLIMITATIONS:\n  - `houjin_bangou` is populated on ~19 % of rows (mostly 事業再構築 + ものづくり disclosures). Filtering by it will miss ~81 % of records; fall back to `q=<company_name>` when houjin lookup returns 0.\n  - `total_subsidy_received_yen` is sparsely populated (<1 % of rows) — ministries publish 採択 without amounts. Do not rely on 金額 filters; surface the number only when present and omit the filter otherwise.\n  - `programs_used` stores **raw program names** (not `unified_id`). Names drift year-over-year (e.g. \"ものづくり・商業・サービス生産性向上促進補助金\" ≠ \"ものづくり補助金\"). Use `enum_values(field=\"programs_used\")` to see exact stored strings.\n  - `is_sole_proprietor` is nullable. `NULL` ≠ \"not a sole proprietor\" — it means unknown. Treat the filter tri-value: true / false / unknown.\n  - Source ratio is ~70 % Jグランツ 採択結果 (機械的) + ~30 % 都道府県 / mirasapo 事業事例 (文章). Text-search hits (`q=`) on the latter give softer match quality than houjin / industry filters.\n\nCHAIN:\n  → `get_case_study(case_id=…)` for full recipient detail (outcomes, patterns, summary).\n  → `search_programs(q=programs_used[i])` to pull the current form of the program the recipient used.\n  → `search_enforcement_cases(q=<company_name>)` to run a 詐欺 / 不正 check on the same 法人 — `recipient_houjin_bangou` on the enforcement table is 100 % NULL, so search by name/digits in `q` instead.\n\n`fields` controls response size per row (see param description). Default\nis 'minimal' (token-shaping per dd_v3_09 / v7 P3-K) — call sites that need\nthe full recipient profile must pass `fields='full'`.\n"
    },
    {
      "name": "get_case_study",
      "description": "DETAIL: 採択事例 1 件の収録済みフィールドの詳細を取得する (fetch one case study). Returns recipient profile (company_name, 法人番号, prefecture, industry_jsic, employees, founded_year, capital_yen), case_title / case_summary, programs_used (list of 受給した補助金), subsidy amount, outcomes / patterns (JSON), source_url + publication_date.\n\nWHEN NOT:\n  - `search_case_studies` instead if you don't have a case_id yet.\n  - `get_program` instead for program policy detail — this returns recipient profile, not policy text.\n\nCHAIN:\n  ← `search_case_studies` produces the case_id.\n  → `search_programs(q=programs_used[i])` to resolve each program the recipient used to its current definition.\n  → `search_enforcement_cases(q=<company_name>)` for an integrity check on the same 法人 — `recipient_houjin_bangou` on the enforcement table is 100 % NULL, so search by name/13-digit substring in `q` instead.\n"
    },
    {
      "name": "search_loan_programs",
      "description": "DISCOVER: 無担保・無保証 の融資を 1 クエリで抽出する — 108 日本の融資プログラム (日本政策金融公庫 / 自治体融資 / 信用金庫 etc.) with three-axis risk filters. Headline feature: 担保 (collateral) / 個人保証人 (personal guarantor) / 第三者保証人 (third-party guarantor) are each a **separate enum axis** — \"無担保・無個人保証\" filtering is one query, not multi-turn natural-language parsing of each provider's prose. No single public site offers this 融資 decomposition.\n\nTypical queries:\n  - \"無担保・無個人保証で通せる公庫融資は?\"\n  - \"運転資金で金利 1.5% 以下・5000万以上の融資は?\"\n  - \"10 年返済可能な設備資金融資は?\"\n\nExample filter combination for 無担保・無保証人:\n\n    collateral_required=\"not_required\" AND\n    third_party_guarantor_required=\"not_required\"\n\nEach axis value is one of: required | not_required | negotiable | unknown.\nInvalid values return an envelope with code='invalid_enum' + hint (not silent-fail).\n\nOrdered by amount_max_yen DESC, id. limit clamped to [1, 100]; default 20.\n\nWHEN NOT:\n  - `search_programs` instead for 補助金 / 助成金 / 税制 (this table is 融資 only — 108 rows).\n  - `search_enforcement_cases` instead for 不正 / 返還 against a lender or borrower.\n  - `enum_values(field=\"loan_type\"|\"provider\")` *first* if unsure which loan_type / provider strings are canonical.\n\nLIMITATIONS:\n  - Coverage is 108 rows: 日本政策金融公庫 (国民 + 中小) + 信用保証協会 + 自治体制度融資 + 主要信金. **Commercial-bank proprietary loans** (メガバンク プロパー融資, 地銀 事業融資) are not indexed — providers keep conditions in branch-level discretion, not published schedules.\n  - **No prefecture filter.** 自治体 rows mention the 自治体 in `provider` / `program_name` / `target_conditions` — use `q=<都道府県名>` or `provider=<自治体名>` for regional filtering.\n  - `personal_guarantor_required=\"not_required\"` typically means 2024-04 以降 公庫 原則不要 ルール applied; confirm against the lender's current 要項 because 保証料 / 信用保証 料率 is priced separately and not surfaced here.\n  - `interest_rate_base` is the **base rate**; `interest_rate_special` covers 特別利率 tiers. The lender's actual offer depends on 信用 / 担保 / 期間, which the table records only as target_conditions text.\n  - Every three-axis value can be `unknown` when the 要綱 is silent. Treat `unknown` as \"調査必要\", not as a permissive default — 不記載 in 要綱 often means 原則 required.\n\nCHAIN:\n  → `get_loan_program(loan_id=…)` for the full record (target_conditions, official_url, lineage).\n  → `search_programs(q=…)` to compare against 補助金 options for the same purpose (借入 vs 補助金 decision).\n"
    },
    {
      "name": "get_loan_program",
      "description": "DETAIL: 融資プログラム 1 件の詳細を取得する (fetch one 融資 program by numeric id). Returns full record including three-axis risk (担保 / 個人保証人 / 第三者保証人), interest rates (base + special), loan period, grace period, target_conditions, official_url + fetched_at lineage, and the legacy security_required free-text kept for audit.\n\nExample:\n    get_loan_program(loan_id=42)\n    → {\"id\": 42, \"loan_program_name\": \"...\", \"collateral_required\": \"条件付\",\n       \"personal_guarantor_required\": \"不要\", \"interest_rate_base\": \"1.50%\", ...}\n\nWhen NOT to call:\n    - Without a numeric loan_id → use search_loan_programs / search_loans_am first.\n    - For 補助金 / 助成金 detail → use get_program (this table is 融資 only).\n    - For 信用保証協会 enforcement / 取消 → use get_enforcement_case instead.\n    - To screen co-applicable subsidies → use subsidy_combo_finder, not this.\n\nCHAIN:\n  ← `search_loan_programs` produces the loan_id.\n  → `search_programs(q=loan_program_name)` to find co-applicable 補助金 that pair with this loan.\n"
    },
    {
      "name": "prescreen_programs",
      "description": "DISCOVER-JUDGE: profile → ranked eligible programs (fit-based discovery, NOT keyword search).\n\nComplements search_programs: search = \"find programs mentioning X\", prescreen = \"find programs I\nplausibly fit, ranked by fit, with reasons + caveats\". Use this first when the caller describes\na business (\"茨城 5ha 稲作 個人事業主、8000万円の設備投資予定\"); use search_programs when the\ncaller names a known program or theme (\"IT導入補助金\").\n\nEach row returns:\n  - fit_score: positive-match count in v1 (0..~5). Compare within one response only.\n  - match_reasons[]: why the row scored (prefecture match, target_type match, amount sufficiency).\n  - caveats[]: missing prerequisites, undersized amount, or tagging gaps.\n\nLIMITATIONS:\n  - v1 does not enforce exclusion_rules `exclude`/`combine_ok` — those need an\n    'applying_for' list we don't accept yet. Use `check_exclusions` on pairs you plan to apply.\n  - target_types has EN/JP drift in the DB. Unrecognized tokens don't penalize rows.\n\nWHEN NOT:\n  - `search_programs(q=…)` for keyword-based discovery.\n  - `search_case_studies` for \"who like me received X?\" social-proof discovery.\n\nCHAIN:\n  → `get_program(unified_id)` for full row of a short-listed match.\n  → `check_exclusions(program_a, program_b)` to validate combined-application feasibility.\n  → `search_case_studies(prefecture=…, industry_jsic=…)` for adoption evidence of top matches.\n"
    },
    {
      "name": "smb_starter_pack",
      "description": "ONE-SHOT DISCOVERY: 1 call で SMB 経営者が「今日何できる?」を返す。\n\nChatGPT / Claude と同じ感覚の 1-question-1-answer 体験のための primitive。\n`search_programs` → `prescreen_programs` → `search_loan_programs` →\n`search_tax_rules` → `upcoming_deadlines` → `search_enforcement_cases`\nの 6 ツール分を 1 call で返す (≤ 4 KB payload)。\n\n入力は一般的な企業プロファイル (都道府県 / 業種 / 従業員 / 売上 / 投資予定):\n  - prefecture: '愛知' / '愛知県' / 'Aichi' 自動正規化\n  - industry_jsic / jsic: 英 letter と 和名 両対応\n  - employees / employee_count: alias 両方受ける\n  - planned_investment_man_yen: あれば 金額不足 (undersized) 警告\n\n返り値 (compact):\n  {\n    \"profile\": {正規化後の入力},\n    \"top_subsidies\": [{unified_id, name, amount_max_man_yen, end_date, fit_score, why_fit}, ...N],\n    \"top_loans\": [{loan_id, program_name, provider, collateral_required, rate, amount_max_yen}, ...N],\n    \"applicable_tax_hints\": [{keyword, measure}] — 税制は profile だけでは確定判定不能なので hints のみ\n    \"urgent_deadlines_30d\": [{unified_id, name, end_date, days_left}, ...up to 5],\n    \"same_industry_enforcement_count\": int — 同業種で過去3年の行政処分件数 (DD 参考)\n    \"next_actions\": [\"GビズID取得\", \"経営計画書草案\", ...] — 人が1日で動けるステップ\n    \"source\": {\"generated_at\": ISO8601, \"coverage\": \"...\"},\n  }\n\n空 hit は `hint` / `retry_with` 付きで返す (0 件でも迷わせない)。\n\nCHAIN (深掘り時):\n  → `get_program(unified_id)` で top_subsidies の詳細\n  → `check_exclusions(a, b)` で併用可否\n  → `search_case_studies(prefecture, industry_jsic)` で採択事例\n  → `get_loan_program(loan_id)` で融資 要項\n"
    },
    {
      "name": "upcoming_deadlines",
      "description": "DISCOVER-CALENDAR: list 補助金 / 助成金 / 融資 / 税制 programs whose application deadline (application_window.end_date) falls within the next N days.\n\nUse when the caller frames the question time-first: \"来月締切の支援制度を一覧で\" / \"茨城で今月締切を迎えるもの\".\nOne call replaces the keyword-guess + per-program get_program dance. Rows are ordered by\n`end_date ASC`, so index 0 is always the most urgent.\n\nEach row returns: unified_id, primary_name, tier, prefecture, end_date, days_remaining,\namount_max_man_yen, application_url.\n\nLIMITATIONS:\n  - Only reads `application_window.end_date`. Programs without a structured end_date\n    (roughly 60% of the corpus — most rolling / 随時 programs) are silently skipped.\n  - Multi-round 公募 where each round has its own window are represented by a single\n    end_date today; richer multi-round support is pending an enriched-schema stabilisation.\n\nWHEN NOT:\n  - `search_programs(q=…)` for keyword discovery (no deadline filter).\n  - `get_program(unified_id)` for a single program's full window + multi-round detail.\n\nCHAIN:\n  → `get_program(unified_id)` for required documents / full policy on the most urgent row.\n  → `check_exclusions([…])` before recommending the caller apply for multiple urgent ones.\n"
    },
    {
      "name": "deadline_calendar",
      "description": "ONE-SHOT CALENDAR: 今後 N ヶ月 (1..6) の締切を月別グルーピングで 1 call。\n\n税理士・行政書士 が顧問先に配る月次ブリーフィング用。per-program `get_program`\nチェーンを潰す: 1 call で `{\"2026-05\": [...5件], \"2026-06\": [...3件], ...}` を返す。\n\n返り値 (compact):\n  {\n    \"months_ahead\": 3,\n    \"total\": N,\n    \"by_month\": {\n      \"2026-05\": [{unified_id, name, end_date, days_left, amount_max_man_yen, tier}, ...],\n      \"2026-06\": [...],\n      \"2026-07\": [...]\n    },\n    \"urgent_next_7_days\": N,  # quick flag\n    \"empty_months\": [\"2026-08\"] | [],  # \"今月締切なし\" hint\n    \"source\": {...}\n  }\n\nWHEN NOT:\n  - `upcoming_deadlines(within_days=N)` for flat (ungrouped) time-ordered list.\n  - `list_open_programs` for pure \"今開いてる\" (募集中) framing, no deadline sort.\n\nLIMITATIONS:\n  - Same as upcoming_deadlines: 60% 程度の 随時 / rolling 制度 は structured\n    end_date を持たないため対象外。\n"
    },
    {
      "name": "subsidy_combo_finder",
      "description": "ONE-SHOT COMBO: 補助金+融資+税制 の 非衝突組合せ TOP N を 1 call で。\n\nJapanese SMB の典型シナリオ:\n  「ものづくり補助金」申請予定 → 残りの投資資金をどう賄うか？\n  → このツールは exclusion_rules を参照し、seed 補助金と同時利用可能な\n     融資 + 税制 を自動で見つけて 組合せとして返す。\n\nLLM が手動で (search_programs → get_program → list_exclusion_rules →\nsearch_loans → get_tax_rule) を 5 回チェーンする必要がなくなる。\n\n入力:\n  - `unified_id`: seed 補助金 (例: 'UNI-xxxxxxxxxx')、最も確実\n  - `keyword`:    seed 補助金キーワード (例: 'ものづくり')、fuzzy\n  - `prefecture`: 融資の地域絞り込み (optional)\n  - `limit`:      返す組合せ数 (default=3, max=5)\n\n返り値 (compact, ≤ 3 KB):\n  {\n    \"seed\": {\"unified_id\", \"name\", \"amount_max_man_yen\"},\n    \"combos\": [\n      {\n        \"rank\": 1,\n        \"subsidy\": {\"unified_id\", \"name\", \"amount_max_man_yen\"},\n        \"loan\":    {\"loan_id\", \"program_name\", \"provider\", \"amount_max_man_yen\", \"rate\"},\n        \"tax\":     {\"unified_id\", \"ruleset_name\", \"tax_category\"},\n        \"combined_max_benefit_man_yen\": <int>,\n        \"blocked_by\": [],               # 非衝突なら空\n        \"why_combo\": \"補助金で初期投資、融資で運転資金、税制で減価償却加速\"\n      },\n      ...\n    ],\n    \"blocked_names\": [\"他の助成金\", \"中小企業生産性革命推進事業\", ...],\n    \"source\": {...}\n  }\n\nWHEN NOT:\n  - `check_compat(a, b)` — 既に 2 つ特定制度があって「これ併給できる？」だけ聞きたい時\n  - `prescreen_programs` — プロファイル→候補リスト、組合せはまだ要らない時\n  - `smb_starter_pack`   — 補助金/融資/税制/期限 の 汎用ダッシュボード\n"
    },
    {
      "name": "dd_profile_am",
      "description": "ONE-SHOT DD: 法人番号 → 公表コンプライアンス + 採択実績 + インボイス登録 を 1 call.\n\nM&A 仲介 / 銀行 DD / VC の投資前調査 / 士業の顧問先調査 の定番チェーン\n(search_enforcement → check_enforcement → search_acceptance_stats_am →\n list_adoptions → invoice_registrants) を houjin_bangou 一発で返す。\n\n入力:\n  - houjin_bangou: 13 桁 (T 付き インボイス番号、ハイフン、全角 全て OK。NFKC + 非数字除去で 13 桁化)\n\n返り値 (≤ 3 KB 目安):\n  {\n    \"houjin_bangou\": \"...\",          # 正規化後\n    \"entity\": {                       # 法人マスタ (収録があれば)\n      \"name\", \"category\", \"prefecture\", \"municipality\", \"certified_at\"\n    },\n    \"adoptions_summary\": {\n      \"total\": int,\n      \"programs_list\": [...]          # 採択された補助金 名 unique\n    },\n    \"adoptions\": [                    # include_adoptions=True の時のみ\n      {\"canonical_id\", \"program_name\", \"adopted_at\", ...}\n    ],\n    \"enforcement\": {                  # check_enforcement の戻り\n      \"found\", \"currently_excluded\", \"active_exclusions\", \"recent_history\", \"all_count\"\n    },\n    \"invoice_registration\": {\n      \"status\": \"registered\" | \"revoked\" | \"unknown_in_mirror\",\n      \"invoice_registration_number\": \"T...\", \"registered_date\", \"trade_name\"\n    },\n    \"dd_flags\": [                     # agents が要注意点を一覧で取れる bullet\n      \"currently_excluded\", \"no_adoption_history\", \"clean_enforcement_record\",\n      \"invoice_mirror_miss\", \"unknown_company\"\n    ],\n    \"coverage_scope\": \"...\",          # 与信/反社/信用情報には一切該当せず、公的補助金/税制 due diligence 専用\n    \"source\": {...}\n  }\n\nDATA HONESTY GATES (誤解防止):\n  - adoptions.amount_granted_yen is 100% NULL in current snapshot —\n    total_amount_man_yen は返しません (虚偽の数字を作らない)。\n  - invoice_registrants の \"unknown\" は \"国税庁に未登録\" ではない。\n    重要な確認では国税庁の公式検索も確認してください。\n  - enforcement.found=false は 公表 1,185 行政処分 corpus 外であって、反社\n    チェック / 信用情報 / 帝国データバンク は別途必要 (範囲外)。\n\nWHEN NOT:\n  - `check_enforcement_am` — 法人番号ピンポイント で 行政処分 だけ欲しい時\n  - `search_acceptance_stats_am` — 特定 program に対する採択率だけ欲しい時\n  - `search_enforcement_cases(keyword=…)` — 名称部分一致 or 法人番号無し の時\n\nCHAIN:\n  → `check_enforcement_am(houjin_bangou)` で active_exclusions の詳細\n  → `search_enforcement_cases(houjin_bangou)` で行政処分 source_url へ\n  → `get_invoice_registrant(registration_number)` で登録履歴の詳細\n"
    },
    {
      "name": "similar_cases",
      "description": "CASE-STUDY-LED DISCOVERY: 採択事例 を seed に「似た事例 + その制度」を返す。\n\n`search_case_studies` の逆方向 entry point。条件→事例 ではなく、事例 (or 自由文) →\n類似事例 のグルーピング を返し、各 similar case の programs_used を programs テーブルへ\nbest-effort で解決する。「この事例 良いな」→ 似た事例 + その制度 が 1 call で揃う。\n\nResolution rules:\n  - case_id 指定: その case を fetch、industry/prefecture/programs_used を seed vector に。\n  - description 指定 (case_id 無し): case_studies を LIKE 検索して top 1 を seed に採用。\n  - 両方無し: empty_input error envelope (hint: \"case_id か description を渡してください\").\n\nScoring (Jaccard 型):\n  - industry JSIC full match = +2 / 1文字prefix match = +1\n  - prefecture exact = +1\n  - programs_used overlap = +3 * Jaccard\n  - max_score で正規化 → similarity_score ∈ [0, 1]\n  - 降順 sort、seed 自身は除外。\n\n返り値:\n  {\n    \"seed\": {\"case_id\", \"title\", \"industry_jsic\", \"prefecture\", \"programs_used\"},\n    \"similar_cases\": [\n      {\n        \"case_id\", \"title\", \"company_name\", \"outcome\", \"prefecture\",\n        \"industry_jsic\", \"similarity_score\",\n        \"match_reasons\": [\"same industry\", \"shared 2 programs\"],\n        \"supporting_programs\": [{\"unified_id\", \"source_name\", \"tier\", ...}, ...]\n      }, ...\n    ],\n    \"total_found\": int,                # similar_cases の長さ\n    \"source\": {...}\n  }\n\nWHEN NOT:\n  - `search_case_studies` instead — 条件 (prefecture/industry) で事例リストが\n    欲しい時 (こちらは事例 seed が必要)。\n  - `smb_starter_pack` instead — プロファイル (都道府県+業種+従業員) から制度を\n    探したい時。\n  - `dd_profile_am` instead — 法人番号で 1 社の DD だけ欲しい時。\n\nLIMITATIONS:\n  - programs_used の name → unified_id 解決は LIKE substring (best-effort)。\n    年度更新で名称変わっていると null = ``\"matched\": false`` になる。\n  - case_studies の programs_used は < 35 種しか登録なし (採択 corpus 全体で\n    sparse). 多くの seed では programs overlap = 0 になり、industry+prefecture\n    だけで rank される。\n  - description LIKE は FTS5 ではなく単純 substring。3 文字未満は filter 外し。\n\nCHAIN:\n  → `get_case_study(case_id=…)` で各 similar case の outcomes/patterns 詳細\n  → `get_program(unified_id=…)` で supporting_programs の制度詳細\n  → `check_exclusions(a, b)` で複数制度の併給可否\n"
    },
    {
      "name": "subsidy_roadmap_3yr",
      "description": "ONE-SHOT 3-YEAR ROADMAP: industry × prefecture × size × purpose で\n今後 N ヶ月の application window を JST 会計年度 quarter にバケット。\nSort = opens_at ASC, deadline ASC tiebreak. tier S/A/B/C, excluded=0 のみ.\ndeadline past + start future なら start を採用. cycle=annual の past start\nは +1 year に project. Errors: ``{\"error\": {\"code\",\"message\",\"hint\"}}``.\n\nExample:\n    subsidy_roadmap_3yr(industry=\"製造業\", prefecture=\"東京都\",\n                        company_size=\"small\", funding_purpose=\"equipment\",\n                        horizon_months=36, limit=20)\n    → {\"timeline\": [{\"quarter\": \"2026Q2\", \"items\": [...]}, ...], \"total\": N}\n\nWhen NOT to call:\n    - For a SINGLE program detail → use get_program (much cheaper).\n    - For free-text keyword search → use search_programs.\n    - For currently-open windows only (not 3-year horizon) → use list_open_programs.\n    - For 融資 / 補助金 dual-use combo → use subsidy_combo_finder.\n    - For tax incentive timing → use search_tax_incentives + cliff dates.\n\nLIMITATIONS: 随時/rolling で start/end がない制度は timeline に出ない場合があります。\n業種 filter は補助的な絞り込みです。\n"
    },
    {
      "name": "search_laws",
      "description": "DISCOVER-LAW: search 9,484 e-Gov law metadata records (憲法 / 法律 / 政令 / 勅令 / 府省令 / 規則 / 告示 / ガイドライン). Primary surface for \"what is the 根拠法 of 補助金 X\" and \"which statute does this article cite\" questions. Returns law_title + number + enforced_date + ministry + summary + lineage.\n\nCHAIN:\n  → `get_law(unified_id)` for full detail on a single row.\n  → `list_law_revisions(unified_id)` to walk superseded_by_law_id chain.\n  → `find_cases_by_law(law_unified_id)` for 判例 citing this statute.\n  → `trace_program_to_law(program_unified_id)` for the reverse edge.\n\nWHEN NOT:\n  - `search_programs` instead for 補助金 discovery — laws is statute-only.\n  - `search_tax_rules` instead for 税制 Q&A / decision rulesets.\n\nLIMITATIONS:\n  - Same FTS5 trigram single-kanji false-positive gotcha as search_programs.\n  - `currently_effective_only=True` hides superseded rows; disable for diachronic analysis.\n"
    },
    {
      "name": "get_law",
      "description": "DETAIL-LAW: fetch a single 法令 row by LAW-<10 hex> unified_id. Returns full record with summary, article_count, ministry, enforced_date, superseded_by_law_id lineage, plus source_url + fetched_at. Provenance: e-Gov 法令 API V2 (CC-BY 4.0).\n\nExample:\n    get_law(unified_id=\"LAW-1a2b3c4d5e\")\n    → {\"unified_id\": \"LAW-1a2b3c4d5e\", \"law_name\": \"...\", \"ministry\": \"...\",\n       \"article_count\": 213, \"revision_status\": \"current\", \"source_url\": \"...\"}\n\nWhen NOT to call:\n    - Without a LAW-<10 hex> unified_id → use search_laws first.\n    - For full article text → use get_law_article_am (this returns law metadata).\n    - For 判例 / case detail → use get_court_decision instead.\n    - For tax rulesets derived from a law → use get_tax_rule.\n\nCHAIN:\n  ← `search_laws` produces the unified_id.\n  → `list_law_revisions(unified_id)` when revision_status != 'current'.\n  → `find_cases_by_law(law_unified_id)` for 判例 citing this law.\n"
    },
    {
      "name": "list_law_revisions",
      "description": "LINEAGE-LAW: trace the revision chain for a 法令 — walks `superseded_by_law_id` forward and backward to reconstruct (predecessors → this → successors → current). Essential for diachronic legal analysis (\"which law was in force on 2023-06-01?\").\n\nReturns:\n  - predecessors[]: rows where superseded_by_law_id == given unified_id, recursively\n  - self: the starting row\n  - successors[]: forward chain through superseded_by_law_id pointers\n  - current_id: terminal row in the successor chain (revision_status='current' or chain tail)\n\nCHAIN:\n  ← `search_laws` / `get_law` produces the unified_id.\n  → `find_cases_by_law(law_unified_id=current_id)` to run 判例 against the current form.\n\nLIMITATIONS:\n  - Chain integrity depends on ingest; orphan pointers return an empty successors list without error.\n  - Cycles are prevented by max_hops + a visited-set.\n"
    },
    {
      "name": "search_court_decisions",
      "description": "DISCOVER-CASE: search 判例 (courts.go.jp hanrei_jp primary source). Ordered by precedent_weight (binding > persuasive > informational), then court_level (supreme > high > district …), then most-recent decision_date. Commercial aggregators (D1 Law / Westlaw / LEX/DB) are banned at ingest.\n\nCHAIN:\n  → `get_court_decision(unified_id)` for full record.\n  → `find_precedents_by_statute(law_unified_id)` for statute→rulings.\n  → `find_cases_by_law(law_unified_id, include_enforcement=True)` to combine with 会計検査院.\n\nWHEN NOT:\n  - `search_enforcement_cases` instead for 会計検査院 reports (not court rulings).\n  - `search_laws` instead for statute text.\n\nLIMITATIONS:\n  - Coverage: 2,065 court-decision rows are loaded from primary-source court metadata.\n  - Same FTS trigram single-kanji false-positive gotcha.\n  - `references_law_id` is a JSON-array substring LIKE — accurate because unified_ids are fixed-width.\n"
    },
    {
      "name": "get_court_decision",
      "description": "DETAIL-CASE: fetch a single 判例 with full source lineage (courts.go.jp primary). Returns case_name, court, decision_date, key_ruling, impact_on_business, related_law_ids, precedent_weight, source_url + source_excerpt + fetched_at.\n\nExample:\n    get_court_decision(unified_id=\"HAN-0123abcdef\")\n    → {\"unified_id\": \"HAN-0123abcdef\", \"case_name\": \"...\", \"court\": \"...\",\n       \"key_ruling\": \"...\", \"related_law_ids\": [\"LAW-...\"], \"source_url\": \"...\"}\n\nWhen NOT to call:\n    - Without a HAN-<10 hex> unified_id → use search_court_decisions first.\n    - For 行政処分 / 会計検査院 audit findings → use get_enforcement_case instead.\n    - For statutory text itself → use get_law (this returns the ruling, not the law).\n    - To trace ALL precedents citing one statute → use find_precedents_by_statute.\n\nCHAIN:\n  ← `search_court_decisions` or `find_precedents_by_statute` produces the unified_id.\n  → `get_law(law_unified_id)` for each related_law_ids entry.\n"
    },
    {
      "name": "find_precedents_by_statute",
      "description": "TRACE-STATUTE: given a LAW-<10 hex> unified_id, return 判例 citing that statute via related_law_ids_json. Ordered by precedent_weight → court_level → decision_date. When `article_citation` is set, we additionally require the article string to appear in key_ruling or source_excerpt (best-effort narrowing).\n\nExample:\n    find_precedents_by_statute(law_unified_id=\"LAW-1a2b3c4d5e\",\n                               article_citation=\"第22条\", limit=20)\n    → {\"results\": [{\"unified_id\": \"HAN-...\", \"case_name\": \"...\",\n                    \"precedent_weight\": 0.82, ...}], \"total\": N}\n\nWhen NOT to call:\n    - For full free-text 判例 search → use search_court_decisions.\n    - To fetch ONE 判例's full record → use get_court_decision (this returns a list).\n    - To pull 会計検査院 audit hits too → use find_cases_by_law(include_enforcement=True).\n    - Without a LAW-<10 hex> id → use search_laws to resolve a name to id first.\n\nCHAIN:\n  ← `search_laws` / `get_law` produces the law_unified_id.\n  → `get_court_decision(unified_id)` for each hit's full record.\n  → `find_cases_by_law(law_unified_id, include_enforcement=True)` to also pull 会計検査院.\n\nLIMITATIONS:\n  - Article narrowing is best-effort (string contains), not a structured (law_id, article) FK join.\n"
    },
    {
      "name": "search_bids",
      "description": "DISCOVER-BID: search 入札 (GEPS 政府電子調達 CC-BY 4.0 + self-gov top-7 JV flows + ministry *.go.jp). Primary-source only — NJSS-style aggregators are banned at ingest. Headline query: \"vendors that won 5000万円+ 公募型補助 in 2025\".\n\nCHAIN:\n  → `get_bid(unified_id)` for full record.\n  → `bid_eligible_for_profile(unified_id, business_profile)` to screen an applicant.\n  → `search_programs(unified_id=program_id_hint)` to tie a bid to the funded 補助事業.\n\nWHEN NOT:\n  - `search_programs` instead for 補助金 募集 — bids is procurement (after-the-fact), not funded-program discovery.\n\nLIMITATIONS:\n  - Coverage: 2,065 court-decision rows are loaded from primary-source court metadata.\n  - Same FTS trigram gotcha; quote 2+ char kanji compounds.\n  - `program_id_hint` is a soft ref (no FK) — may be NULL on 公募型補助 / stale.\n"
    },
    {
      "name": "get_bid",
      "description": "DETAIL-BID: fetch a single 入札案件 (procurement notice / 落札結果). Returns bid_title, bid_kind, procuring_entity + houjin_bangou, ministry, prefecture, program_id_hint, all deadline + amount + winner fields, eligibility_conditions, classification_code (役務/物品/工事), and full lineage.\n\nExample:\n    get_bid(unified_id=\"BID-9f8e7d6c5b\")\n    → {\"unified_id\": \"BID-9f8e7d6c5b\", \"bid_title\": \"...\", \"bid_kind\": \"役務\",\n       \"procuring_entity\": \"...\", \"deadline\": \"...\", \"winner_name\": \"...\"}\n\nWhen NOT to call:\n    - Without a BID-<10 hex> id → use search_bids first.\n    - For 補助金 / 助成金 program detail → use get_program (bids are procurement, not subsidies).\n    - To screen applicability → use bid_eligible_for_profile (this is just the raw record).\n    - For tax / law / 判例 detail → use get_tax_rule / get_law / get_court_decision.\n\nCHAIN:\n  ← `search_bids` produces the unified_id.\n  → `bid_eligible_for_profile(unified_id, business_profile)` to screen applicability.\n  → `search_programs(unified_id=program_id_hint)` when the bid links to a funded 補助事業.\n"
    },
    {
      "name": "bid_eligible_for_profile",
      "description": "SCREEN-BID: compare a business profile against bid.eligibility_conditions. Honest substring scan — not a structured eligibility engine. Returns `possibly_eligible` (bool, True unless a hard mismatch is found) + matched_signals + unmatched_signals + caveats.\n\nSignals:\n  - prefecture: \"当県内\" / prefecture string LIKE match\n  - rating_grade: '等級' / 'A等級' etc. present + matches profile.rating_grade\n  - industry_jsic: JSIC label substring\n  - houjin_bangou: exact 13-digit match against procuring_houjin_bangou (conflict-of-interest marker)\n\nWHEN NOT:\n  - Treat an empty eligibility_conditions as \"unknown\" — absent text does not mean unrestricted.\n  - This tool does not verify 経営審査 / 指名停止 / 建設業許可 status. Always confirm with the primary source_url before bidding.\n\nCHAIN:\n  ← `search_bids` / `get_bid` produces the bid_unified_id.\n  → `search_court_decisions(q='指名停止')` for 指名停止 jurisprudence if profile hits a conflict.\n"
    },
    {
      "name": "search_tax_rules",
      "description": "DISCOVER-TAX: search 税務判定ルールセット (国税庁 タックスアンサー + 電帳法一問一答 + インボイス Q&A). Each row pairs narrative `eligibility_conditions` with a machine-readable predicate tree for `evaluate_tax_applicability`.\n\nCHAIN:\n  → `get_tax_rule(unified_id)` for a single row.\n  → `evaluate_tax_applicability(business_profile, target_ruleset_ids)` to run the predicate engine.\n\nWHEN NOT:\n  - `search_laws` instead for the underlying statute (related_law_ids links to LAW-*).\n  - `search_programs` instead for 補助金 / 助成金.\n\nLIMITATIONS:\n  - This is NOT tax advice. `evaluate_tax_applicability` only matches declared JSON predicates — it does not interpret tax law.\n  - Cliff dates: 2026-09-30 (2割特例 終了), 2027-09-30 (80% 経過措置), 2029-09-30 (50% 経過措置 / 少額特例 終了). Use `effective_on` to snapshot.\n  - COVERAGE (35 rows live): インボイス制度 / 電子帳簿保存法 / 中小企業 法人税・消費税 特例. 相続税 / 贈与税 / 事業承継税制 / 組織再編税制 は未収載 — broader tax-rule lookup が必要な場合は `get_am_tax_rule` を併用してください.\n"
    },
    {
      "name": "get_tax_rule",
      "description": "DETAIL-TAX: fetch a single 税務判定ルールセット by TAX-<10 hex>. Returns ruleset_name, tax_category, ruleset_kind, effective_from / effective_until (watch cliff dates), related_law_ids, narrative eligibility_conditions, predicate JSON, rate_or_amount, calculation_formula, filing_requirements, authority + URL, full lineage.\n\nExample:\n    get_tax_rule(unified_id=\"TAX-0a1b2c3d4e\")\n    → {\"unified_id\": \"TAX-0a1b2c3d4e\", \"ruleset_name\": \"...\", \"tax_category\": \"法人税\",\n       \"effective_from\": \"2025-04-01\", \"rate_or_amount\": \"...\", \"predicate_json\": {...}}\n\nWhen NOT to call:\n    - Without a TAX-<10 hex> id → use search_tax_rules / search_tax_incentives first.\n    - To EVALUATE applicability against a profile → use evaluate_tax_applicability.\n    - For statutory text → use get_law (this returns the predicate, not the law).\n    - For 補助金 / grant programs → use get_program (different table; tax rulesets are tax-only).\n    - For sunset alerts only → use list_tax_sunset_alerts.\n\nCHAIN:\n  ← `search_tax_rules` produces the unified_id.\n  → `evaluate_tax_applicability(business_profile, target_ruleset_ids=[unified_id])` to run the predicate.\n  → `get_law(law_unified_id)` for each related_law_ids entry.\n"
    },
    {
      "name": "evaluate_tax_applicability",
      "description": "JUDGE-TAX: evaluate eligibility predicates for tax rulesets against a caller business_profile. Walks `eligibility_conditions_json` per row and returns per-ruleset `applicable` + reasons + matched / unmatched predicate lists. Does NOT interpret tax law — pure JSON predicate matching.\n\nSupported ops: eq / gte / lte / in / has_invoice_registration / all / any / not.\nMissing profile field => False with reason \"field missing from profile: X\".\nMalformed JSON or unsupported op => applicable=False with error code.\n\nExample:\n    evaluate_tax_applicability(\n        business_profile={\"annual_revenue_yen\": 80000000, \"employees\": 12,\n                          \"invoice_registration_number\": \"T1234...\"},\n        target_ruleset_ids=[\"TAX-0a1b2c3d4e\", \"TAX-9f8e7d6c5b\"])\n    → {\"results\": [{\"unified_id\": \"TAX-0a1b2c3d4e\", \"applicable\": true,\n                    \"matched\": [...], \"unmatched\": []}, ...]}\n\nWhen NOT to call:\n    - To find candidate rulesets first → use search_tax_rules / search_tax_incentives.\n    - For raw ruleset detail → use get_tax_rule (this evaluates; that returns the rule).\n    - As a final tax filing decision — always confirm with source_url + a tax professional.\n    - For 補助金 / loan / bid eligibility → use the matching domain-specific eligibility tool.\n\nCHAIN:\n  ← `search_tax_rules` / `get_tax_rule` surfaces candidate TAX-<10 hex> ids.\n  → `get_law(law_unified_id)` for statute behind an applicable ruleset.\n"
    },
    {
      "name": "compose_audit_workpaper",
      "description": "[KAIKEI] 監査ワークペーパー (PDF/CSV/MD/DOCX) を 1 件の client + ruleset セットに対して生成する。corpus_snapshot_id + sha256 + §47条の2 wording を全 surface に埋め込む。WeasyPrint レンダ → data/workpapers/ に cache、再 pull は無料。¥3 × N + ¥30 export fee。§47条の2 + §52 sensitive — 監査意見の代替ではない。"
    },
    {
      "name": "audit_batch_evaluate",
      "description": "[KAIKEI] Batch evaluation across an audit firm's client population. ¥3 × N profiles billing (K=10 fan-out → 5,000×100=50,000 units / ¥150,000). Returns per-profile results + anomalies (population-deviation flags) + kaikei_fields (調書記載要否 / 重要性閾値 / 監査リスク評価) per cell. §47条の2 + §52 sensitive — checklist, not 監査意見."
    },
    {
      "name": "resolve_citation_chain",
      "description": "[KAIKEI] tax_ruleset → 法令 article → 通達 → 質疑応答 → 文書回答 の citation chain を auto-resolve する。国税庁・法令・判例の公表情報をつなぎ、監査調書の索引に貼りやすい tree を返す。¥3 / call。§47条の2 + §52 sensitive — 税務助言ではなく出典確認用。"
    },
    {
      "name": "search_invoice_registrants",
      "description": "LOOKUP-INVOICE: search 適格請求書発行事業者 (国税庁 bulk, PDL v1.0). Returns {total, limit, offset, results, attribution} — every response carries the mandatory 出典明記 + 編集・加工注記 block per PDL v1.0.\n\nCHAIN:\n  → (verify invoice_registration_number) for T<13 digits> validation in downstream flows.\n  → `search_court_decisions(q='適格請求書')` for 判例 on 適格請求書 / 仕入控除.\n\nWHEN NOT:\n  - Do NOT call with empty q + empty filters to enumerate the 4M-row master — the hard 100-row cap plus the PDL attribution on every page prevent scraping. Use NTA's own bulk download.\n  - Do NOT append name-matching logic on top — sole-proprietor rows are only present because ingest pre-filtered to NTA's consent model.\n\nLIMITATIONS:\n  - Coverage: 13,801 current mirror rows are loaded. A `total=0` response is not a final registration verdict. Always point the user at 国税庁 適格事業者公表サイト (https://www.invoice-kohyo.nta.go.jp/) for the 確定 lookup.\n  - 法人 rows carry houjin_bangou; sole-proprietors do NOT (soft-FK to houjin_master).\n  - `active_only=True` hides revoked/expired; required for \"is this invoice number currently valid?\".\n  - `q` is prefix LIKE on normalized_name, NOT FTS — kana variants are not synthesized at the MCP layer.\n"
    },
    {
      "name": "trace_program_to_law",
      "description": "TRACE-PROGRAM-LAW: given a program unified_id, return its 根拠法 / 関連法 chain — joins `program_law_refs` → `laws`. Each entry reports ref_kind (authority / eligibility / exclusion / reference / penalty), article_citation, law title, and (when follow_revision_chain=True) the current form of the law after walking superseded_by_law_id.\n\nReturns:\n  - program_id\n  - legal_basis_chain[]: list of {law_id, ref_kind, article_citation, title, law_number, revision_status, current_law_id?, current_title?}\n\nCHAIN:\n  ← `search_programs` / `get_program` produces the program_unified_id.\n  → `get_law(law_unified_id)` for full law detail.\n  → `find_cases_by_law(current_law_id)` to run 判例 against the live version.\n\nLIMITATIONS:\n  - Only surfaces links the ingest layer recorded. Programs without populated `program_law_refs` return an empty `legal_basis_chain`.\n"
    },
    {
      "name": "find_cases_by_law",
      "description": "TRACE-LAW-CASES: given a LAW-<10 hex>, return (court_decisions citing it) + optionally (enforcement_cases linked to those decisions via enforcement_decision_refs). Essential for \"which rulings + 会計検査院 findings interpret 補助金適正化法 第22条\" in one call.\n\nReturns:\n  - law_id\n  - court_decisions[]: direct citers via related_law_ids_json\n  - enforcement_cases[]: linked via enforcement_decision_refs (when include_enforcement=True)\n  - totals: {court_decisions, enforcement_cases}\n\nCHAIN:\n  ← `trace_program_to_law` or `get_law` produces the law_unified_id.\n  → `get_court_decision(unified_id)` for detail.\n  → `get_enforcement_case(case_id)` for each enforcement hit.\n\nLIMITATIONS:\n  - enforcement_decision_refs coverage depends on manual curation — absence is not proof of no litigation.\n"
    },
    {
      "name": "combined_compliance_check",
      "description": "OMNIBUS-COMPLIANCE: one-shot compliance report combining (a) exclusion_rules check for the named program, (b) tax_rulesets evaluation against business_profile, (c) top-N relevant bids (filtered by program_id_hint when program_unified_id is set, otherwise by business_profile.prefecture), and (d) when `candidate_program_ids` ≥ 2: pairwise am_compat_matrix lookup + am_combo_calculator member-containment match. Use when the caller says \"check everything for this business/program at once\".\n\nDEPRECATED (2026-04-25): superseded by `rule_engine_check` (R9 unified rule\nengine, 49,247 rows across 6 corpora incl. the 48,815-row dark inventory\nam_compat_matrix). Retained for backward compatibility and for the bid\nfiltering / tax_ruleset evaluation legs which `rule_engine_check` does not\nyet cover. New integrations SHOULD prefer `rule_engine_check`.\n\nReturns:\n  - program_id (echo)\n  - exclusion_check: {hits[], checked_rules} (empty when program_unified_id is None)\n  - tax_evaluation: {results[], applicable_count, applicable_ruleset_ids} — results is applicable-only by default; set tax_verbose=True to include non-matching rulesets.\n  - relevant_bids: [BidOut …] (up to top_bids)\n  - compat_matrix: {pairs[], incompatible_count, case_by_case_count, unknown_count, missing_count, include_inferred, inferred_excluded_count} (only when candidate_program_ids has ≥2 entries; reads am_compat_matrix in native key shape; pairs[] filtered to inferred_only=0 by default — set include_inferred=True to widen).\n  - combo_calculator: {matched_combos[], unmatched_count} (only when candidate_program_ids has ≥2 entries; member-containment match against am_combo_calculator).\n  - data_quality: {exclusion_join_coverage_pct, compat_unknown_bucket_pct, compat_inferred_pct} — honest data-coverage surface so the LLM does not silently treat dark-inventory gaps as \"all clear\".\n  - summary: terse natural-language roll-up.\n\nCHAIN:\n  ← `search_programs` / `search_tax_rules` / `search_bids` / `subsidy_combo_finder` supply the inputs.\n  → `rule_engine_check` for unified rule evaluation across all 6 corpora (preferred).\n  → `evaluate_tax_applicability` for more targeted tax evaluation with explicit ids.\n  → `check_exclusions([program_a, program_b, …])` for pairwise 併給 checks.\n\nLIMITATIONS:\n  - Not legal/tax advice — see each sub-tool's LIMITATIONS.\n  - `relevant_bids` ordering is best-effort; empty program_id_hint + empty prefecture reverts to recency ordering.\n  - When `program_unified_id` is supplied but does not exist in the `programs` table, `exclusion_check` silently returns empty — callers should pre-verify via `get_program(unified_id)` for hard-validation.\n"
    },
    {
      "name": "regulatory_prep_pack",
      "description": "ONE-SHOT DISCOVERY: 業種 + 都道府県 (+ 規模) で「コンプラ pack」を 1 call で。\n\n新規事業立ち上げ / 新規進出時に必要な regulatory コンテキストを 4 セクション\n一括で返す。これがないと search_laws → programs(certification) → search_tax_rules →\nsearch_enforcement_cases の 4-5 往復が必要。\n\n返り値:\n  {\n    \"industry\": JSIC letter,\n    \"prefecture\": normalized name | None,\n    \"laws\":              [{law_id, canonical_name, scope_summary, source_url}, ...],\n    \"certifications\":    [{program_id, name, issuer, validity_years, url}, ...],\n    \"tax_rulesets\":      [{ruleset_id, name, effective_from, effective_until, url}, ...],\n    \"recent_enforcement\":[{case_id, authority, action, published_at, url}, ...],\n    \"generated_at\": ISO 8601 UTC,\n    \"hint\": str   # only when at least one section is empty\n  }\n\nLIMITATIONS:\n  - laws.subject_areas_json / tax_rulesets.industry_scope は未populated のため、\n    業種 filter は 法令名・要件本文への kanji LIKE substring で best-effort 解決。\n    FP (false positive) を許容する代わりに 0 件を避ける設計。\n  - certifications テーブルは未存在 → programs(program_kind LIKE 'certification%') で代替。\n  - enforcement_cases に industry FK は無い。reason_excerpt / program_name_hint\n    への LIKE で粗く絞り、ヒット 0 件なら都道府県だけ で fallback。\n  - company_size は今 release では echo のみ (将来 tax cliff date filter に使う予定).\n\nCHAIN:\n  → `get_law(unified_id)` で laws[i] の詳細\n  → `get_program(unified_id)` で certifications[i] の詳細\n  → `get_tax_rule(unified_id)` で tax_rulesets[i] の詳細\n  → `get_enforcement_case(case_id)` で recent_enforcement[i] の詳細\n"
    },
    {
      "name": "search_tax_incentives",
      "description": "DISCOVER (Tax): Search ~271 Japanese tax_measure records (am_entities corpus) — corporate deductions (減価償却/試験研究費), tax credits (雇用/エネルギー/DX), special measures (租税特別措置). Note: the curated jpi_tax_rulesets table (50 rows) is a stricter sibling and is exposed via search_tax_rules / evaluate_tax_applicability — use those when a row-quality guarantee is required.\n\nWHEN TO USE: User asks about 税額控除 / 租税特別措置 / 法人税 / 所得税 deductions or credits.\nWHEN NOT: For broader subsidies/grants → use search_programs. For specific tax rule lookup → use get_am_tax_rule.\n\nReturns rulesets with eligibility, applicable years, citation to NTA / 国税通達 / 措置法.\n\n[DISCOVER-TAX] Returns matching tax_measure records from the am_entities table with primary source URL. ~271 structured rows across 法人税 / 所得税 / 地方税 / 消費税. ¥3/billable unit metered.\nSearch Japanese tax incentives across 法人税 / 所得税 / 地方税 / 消費税 with structured amount_or_rate, root_law, application_period, prerequisite_certification.\n\nWHAT: ~271 structured records in `am_entities` where record_kind='tax_measure'\n(aggregated from 12_tax_incentives, 139_invoice_consumption_tax,\n140_income_tax_individual_deep, 149_corporate_tax_deep, 150_local_taxes_detail,\n26_agri_tax_incentives). Key columns: `amount_or_rate` (即時償却 vs 税額控除% vs\n非課税率), `root_law`, `application_period_from/to`, `prerequisite_certification`,\n`eligible_assets`. Every row cites 国税庁 / e-Gov / 財務省主税局 primary source.\n\nWHEN:\n  - \"事業承継税制の特例措置はいつまで適用できる?\"\n  - \"中小企業経営強化税制 A 類型の税額控除率は?\"\n  - \"インボイス制度の 2 割特例はいつ終わる?\"\n  - \"農業経営基盤強化準備金の要件を教えて\"\n  - \"経産省の中小製造業向け令和 8 年度の税制優遇は?\" (natural_query 可)\n\nWHEN NOT:\n  - `search_programs` instead for 補助金 / 助成金 (policy text, not tax rule).\n  - `search_loan_programs` instead for 融資 (lending terms, not tax).\n  - `search_certifications` instead for 認定制度 (cert may be a *prerequisite* for some\n    tax incentives; this tool returns the tax rule itself).\n  - `search_by_law` instead when the user names the **law** (租税特別措置法 etc.) and\n    wants *all* program/tax/cert rows under it.\n\nRETURN: {total, limit, offset, results[], hint?, retry_with?}.\n\nLIMITATIONS:\n  - FTS5 trigram causes single-kanji false hits (`税額控除` also matches rows mentioning\n    only `税`). Wrap 2+ char kanji queries in quotes (`\"税額控除\"`) to force phrase match.\n  - `target_year` filter uses `application_period_from/to`; rows lacking a window are\n    excluded. 「適用期限なし (恒久措置)」 rows have `application_period_to=NULL` —\n    they pass the filter but absence of a hard sunset is not guaranteed.\n  - `amount_or_rate` is free-text (\"7% 税額控除\" / \"即時償却\" / \"5年間 1/2 非課税\"\n    etc.); do not attempt numeric comparison. Surface verbatim.\n  - `natural_query` scalar-extracts into region/industry/size/authority/fiscal_year but\n    defers to explicit args. Scoped extraction (not full NLU).\n  - `as_of` (default 'today' JST) drops sunset-expired rules; pass an ISO date\n    (`as_of='2026-04-01'`) for historical \"what was active at X\" lookups. NULL-to\n    rows (恒久措置) are always kept. `meta.data_as_of` echoes the resolved date.\n\nCHAIN:\n  ← `intent_of` / `reason_answer` may route a tax-intent query here.\n  → `search_certifications(query=prerequisite_certification)` when a row requires cert.\n  → `search_by_law(law_name=root_law)` to see all co-governed rules.\n  → `active_programs_at(date=pivot)` to check applicability at a specific date.\n  DO NOT → chain `enum_values` after this; 本 tool の列は free-text が多い.\n\nEXAMPLE:\n  Input:  query=\"事業承継\", target_entity=\"中小企業\", target_year=2026\n  Output: {total: 2, limit: 20, offset: 0,\n           results: [{name: \"事業承継税制 特例措置\",\n                      amount_or_rate: \"相続税・贈与税の猶予/免除\",\n                      application_period_to: \"2027-12-31\",\n                      root_law: \"租税特別措置法\", ...}, ...]}\n\n0 件の場合は `hint` (再検索の提案) と `retry_with` (関連 tool 候補) を返します。\n"
    },
    {
      "name": "search_certifications",
      "description": "DISCOVER (Certifications): Search 66 Japanese certification programs (経営革新等支援機関認定 / 経営力向上計画 / 中小企業等経営強化法 etc.).\n\nWHEN TO USE: User asks about 認定制度 / 認定支援機関 / 経営革新承認.\nWHEN NOT: For non-certification subsidies → use search_programs. For specific authority data → use search_by_law.\n\nReturns certifications with issuing authority, eligibility, validity period.\n\n[CERT] Returns matching certification records (~53 rows: 健康経営優良法人 / えるぼし / くるみん / SDGs 未来都市 / 経営革新計画 / 経営力向上計画 等) with pre-joined linked_subsidies + linked_tax_incentives + benefits_after_certification. Output is search-derived; verify primary source for application requirements.\nSearch Japanese business certifications with pre-joined linked_subsidies + linked_tax_incentives + benefits_after_certification.\n\nWHAT: ~53 records in `am_entities` where record_kind='certification'\n(aggregated from 09_certification_programs + 62_health_management_certification +\nsector-specific bundles). Key columns: `program_name`, `authority`, `requirements`,\n`benefits_after_certification[]`, `linked_subsidies[]`, `linked_tax_incentives[]`,\n`application_window`. Each row cites the issuing body's primary URL.\n\nWHEN:\n  - \"健康経営優良法人を取ると何が変わる?\"\n  - \"えるぼし認定の要件は?\"\n  - \"経営革新計画を取ったら使える補助金一覧\"\n  - \"くるみん認定と健康経営、中小企業に向いてるのはどっち?\"\n\nWHEN NOT:\n  - `search_programs` instead for 補助金 / 助成金 definitions (cert is a prerequisite\n    axis, not a funding program).\n  - `search_tax_incentives` instead when the user already knows the tax rule and\n    only needs the numeric rate.\n  - `search_by_law` instead when the user names the **law** grounding the cert\n    (e.g. 「中小企業等経営強化法に基づく認定」).\n\nRETURN: {total, limit, offset, results[], hint?, retry_with?}.\n\nLIMITATIONS:\n  - `size` and `industry` are LIKE substring over `raw_json` (no normalized schema);\n    typos silently skip matches. Prefer canonical tokens (`中小企業`, `製造業`).\n  - `linked_subsidies[]` / `linked_tax_incentives[]` are **frozen at ingest time**;\n    a new 補助金 citing this cert as prerequisite may not appear until the next\n    nightly rebuild. Verify via `search_programs(query=cert_name)` reverse lookup.\n  - Coverage is biased toward national certs (健康経営 / えるぼし / くるみん / 経営\n    革新 / 経営力向上) — 自治体独自の認定 is sparse.\n\nCHAIN:\n  ← `search_programs` / `search_tax_incentives` when a row has\n    `prerequisite_certification` set — pass that name into `query` here.\n  → `related_programs(program_id=cert_canonical_id)` for the full graph of linked\n    programs (beyond the in-row snapshot).\n  → `search_by_law(law_name=root_law)` when certs cluster under one law.\n\nEXAMPLE:\n  Input:  query=\"健康経営\", size=\"sme\"\n  Output: {total: 3, limit: 20, offset: 0,\n           results: [{program_name: \"健康経営優良法人 中小規模法人部門\",\n                      authority: \"経済産業省 / 日本健康会議\",\n                      linked_subsidies: [\"...\", \"...\"],\n                      linked_tax_incentives: [...], ...}],\n           meta: {data_as_of: \"2026-04-25\"}}\n\n`as_of` is informational here (certifications are durable, no window\ncolumn) — pass for parity with sibling search_* tools and to surface\nthe snapshot date in `meta.data_as_of`.\n\n0 件の場合は `hint` (再検索の提案) と `retry_with` (関連 tool 候補) を返します。\n"
    },
    {
      "name": "list_open_programs",
      "description": "[TIMELINE] Returns programs whose application window covers the given date (default=今日 JST), sorted by days-until-close ascending. Output is search-derived; verify primary source (source_url) for the actual deadline before submission.\nList programs whose application window covers a given date, sorted by days-until-close ascending.\n\nWHAT: `am_entities` where record_kind='program', filtered by JSON\n`application_period_from/to` (or `application_open/close` /\n`application_window_open/close`). Rows with **no** window field at all are\nEXCLUDED (emits `hint` when coverage is partial). Returns `days_left` per row.\n\nWHEN:\n  - \"今開いてる補助金は?\"\n  - \"2026-05-01 時点で応募できる補助金は?\"\n  - \"関東の中小製造業で、今週締切の補助金は?\"\n  - \"今開いてる関東の中小製造業補助金\" (natural_query 可)\n\nWHEN NOT:\n  - `search_programs` instead for the full catalog regardless of 募集窓口.\n  - `active_programs_at` instead when the user asks 「〜時点で **有効だった**」\n    (effective window, not application window — past tense historical queries).\n  - `search_acceptance_stats` instead for 「採択された件数 / 採択率」(past\n    adoption data, not current open calls).\n\nRETURN: {total, limit, offset, results[], pivot_date, hint?, retry_with?}.\nEach result row adds `days_left` (float; negative means past-due if edge case).\n\nLIMITATIONS:\n  - **Coverage is partial**. Many program rows store 通年 / 随時 / empty or leave\n    the window fields NULL — those rows are silently dropped. Missing rows do\n    NOT mean the program is closed; verify via source URL.\n  - Window is encoded in **>= 3 different JSON keys** across ingest topics\n    (`application_period_*`, `application_open/close`,\n    `application_window_open/close`). We COALESCE but schema drift may still\n    hide rows — flag as `retry_with: [\"search_programs\"]` when hit=0.\n  - `pivot_date` defaults to **JST today** (server-side). If the caller's\n    timezone differs from JST, explicitly pass `on_date`.\n  - `region=\"national\"` means non-prefecture programs; passing a prefecture\n    string narrows to that prefecture **only** (does not include national rows).\n\nCHAIN:\n  → `get_program(unified_id=row.item_id)` for full detail of a candidate.\n  → `search_acceptance_stats(program_name=row.item_name)` to gauge competitiveness.\n  → `check_exclusions(program_ids=[...])` before the user commits to multiple\n    simultaneous applications.\n  DO NOT → loop `list_open_programs` on different dates; use a single\n    `active_programs_at` call instead for historical sweeps.\n\nEXAMPLE:\n  Input:  on_date=\"2026-05-01\", region=\"関東\", size=\"sme\"\n  Output: {total: 12, limit: 20, offset: 0, pivot_date: \"2026-05-01\",\n           results: [{item_id: \"...\", item_name: \"...\",\n                      days_left: 7.0, region: \"東京都\", ...}, ...]}\n\n0 件の場合は `hint` (再検索の提案) と `retry_with` (関連 tool 候補) を返します。\n"
    },
    {
      "name": "enum_values_am",
      "description": "[UTILITY] Returns the canonical enum values + row counts for filter arguments used by other tools (target_type / authority_level / funding_purpose / prefecture / program_kind 等), so callers can avoid typos that cause 0-hit searches.\nProbe canonical enum values with live row-count, so downstream search_* filters never silently drop matches from typos.\n\nWHAT: Live aggregation over `am_entities.raw_json` (no materialized view; each\ncall < 200ms thanks to `functools.lru_cache` per process). Returns per-value\nfrequency; values are ranked descending by count so top-N is representative.\n\nWHEN:\n  - \"target_type の指定可能値は?\"\n  - \"authority_level は何を受け付ける?\"\n  - After a zero-hit `search_*` call, to confirm the filter value was canonical.\n  - 新しい session で初回 search の前に一度だけ呼んで vocabulary を確認.\n\nWHEN NOT:\n  - Skip if you already know the canonical value (don't re-call each turn).\n  - For **free-text** (prefecture 都道府県フル名, program name, 法人番号 等)\n    の verification には使うな — enum は有限集合のみ。\n  - `get_meta` instead when the user asks \"データはいつ更新された / 何件ある?\"\n    (coverage / freshness, not enum values).\n\nRETURN: {enum_name, values[], frequency_map: {value: count}, last_updated, description}.\nNOTE: envelope shape **differs** from search_* tools — this is a utility, not a list.\n\nLIMITATIONS:\n  - Values are de-duplicated across EN/JP synonyms (`個人事業主` vs `sole_proprietor`\n    may both appear). Prefer the JP form for JP-facing copy; matcher side\n    normalizes on search.\n  - `frequency_map` reflects the **current** DB snapshot. Long-tail values with\n    count=1 are not reliable filter targets.\n  - Invalid `enum_name` returns the hybrid shape with `error` populated and\n    `values=[]` — do not treat `values=[]` as \"no data\".\n\nCHAIN:\n  → any `search_*` tool with a verified value.\n  DO NOT → call `enum_values` more than once per enum per session; cache the\n    result client-side. Do not chain `enum_values → enum_values` for different\n    enums unless actually needed.\n\nEXAMPLE:\n  Input:  enum_name=\"target_type\"\n  Output: {enum_name: \"target_type\",\n           values: [\"中小企業\", \"個人事業主\", ...],\n           frequency_map: {\"中小企業\": 3124, \"個人事業主\": 2744, ...},\n           last_updated: \"2026-04-24\",\n           description: \"Applicant type tag; JP / EN synonyms coexist.\"}\n"
    },
    {
      "name": "search_by_law",
      "description": "[DISCOVER-LAW] Returns programs / tax_measures / certifications / law rows linked to a given law name (canonical or colloquial). Uses `am_alias` + `am_law.short_name` for alias resolution. Output is search-derived; verify primary source (source_url) for legal interpretation.\nCross-kind enumeration of programs / tax_measures / certifications / law entries grounded in a single 法令.\n\nWHAT: Joins across `am_entities` (record_kind IN program / tax_measure /\ncertification / law) on the `root_law` / `references_law` JSON fields plus a\ngraph-table `references_law` edge walk. Alias resolution uses `am_law` +\n`am_alias` tables (`law_aliases_tried` 配列を返り値に含める — 検索対象が透明).\n\nWHEN:\n  - \"大店立地法に基づく届出が必要な制度は?\"\n  - \"租税特別措置法 第 42 条の 12 の 4 関連の制度を一覧\"\n  - \"中小企業等経営強化法で使える支援策は?\"\n  - \"省エネ法改正後に新しく出た補助金は?\"\n\nWHEN NOT:\n  - `search_programs` instead when the user names a **program** directly (not a law).\n  - `search_tax_incentives` instead when the user names a **tax measure** directly.\n  - `related_programs` instead when the user asks 「A の前提になる / A と併用可能な」\n    (program-to-program graph walk, not law-based enumeration).\n\nRETURN: {total, limit, offset, results[], law_aliases_tried[], hint?, retry_with?}.\nEach result has `item_kind` (program / tax_incentive / certification / law),\n`item_id`, `item_name`, `root_law`, `article`, `law_no`, `amendment_date`,\n`match_method` (exact / alias).\n\nLIMITATIONS:\n  - `article` filter is LIKE substring on `raw_json`; **most rows lack 条項\n    metadata** — a specific article filter frequently drops all rows. When\n    result=0 with article, the `hint` surfaces the advice to retry without.\n  - `amendment_date` filter accepts rows with `amendment_date IS NULL`\n    (恒久法) to avoid false-dropping.\n  - Alias expansion is lexical (LIKE), so 「公害防止法」 like colloquial names\n    may over-match. Review `law_aliases_tried` in the response to verify intent.\n  - Hit counts are **biased toward national programs** — 自治体 条例 coverage\n    is sparse.\n\nCHAIN:\n  → `search_programs(query=item_name)` / `search_tax_incentives(query=item_name)` /\n    `search_certifications(query=item_name)` for full detail per hit.\n  → `active_programs_at(date=amendment_date)` to see 施行時点の有効制度.\n  → `related_programs(program_id=item_id)` to see a specific row's relation graph.\n\nEXAMPLE:\n  Input:  law_name=\"中小企業等経営強化法\"\n  Output: {total: 18, limit: 20, offset: 0,\n           law_aliases_tried: [\"中小企業等経営強化法\", \"経営強化法\"],\n           results: [{item_kind: \"program\", item_id: \"...\",\n                      item_name: \"中小企業経営強化税制\", match_method: \"exact\", ...}, ...]}\n\n0 件の場合は `hint` (再検索の提案) と `retry_with` (関連 tool 候補) を返します。\n"
    },
    {
      "name": "active_programs_at",
      "description": "[TIMELINE] 任意の ISO 日付 pivot で **effective window (施行〜廃止) が及ぶ** 制度 + 税制を列挙する — `list_open_programs` が 募集窓口 を、本 tool は 制度の **存在期間** を見る (歴史的 \"XX年時点で有効だった制度\" の効力期間 lookup 用途).\nReturn programs and tax_measures whose effectivity window (not application window) spans a given ISO date, with on_date_status hints (active / about_to_close / just_started).\n\nWHAT: `am_entities` where record_kind IN ('program', 'tax_measure'),\nfiltered by effective_from / effective_to (falls back to application_period_*).\nRequired: at least one temporal field is non-null on the row (otherwise\nEXCLUDED; avoids false-positive sweep). Adds `on_date_status` per row:\n`active` / `about_to_close` (≤30 days to close) / `just_started` (≤30 days\nfrom open).\n\nWHEN:\n  - \"2020-04-01 時点で有効だった 雇用調整助成金 特例措置は?\"\n  - \"2023-10-01 のインボイス開始時点で申請可能だった税制は?\"\n  - \"コロナ特例 (2020-2023) の 制度スナップショットを比較したい\"\n  - \"今日時点で有効な 省エネ税制 を全部出して\"\n\nWHEN NOT:\n  - `list_open_programs` instead when the user asks 「今 / 募集中 / 締切が\n    近い」(application window, not effectivity — 募集窓口のみ).\n  - `search_programs` instead for the full catalog regardless of date.\n  - `search_by_law(amendment_date=...)` instead when the pivot is a **law\n    amendment date** and the user wants programs amended *after* it.\n\nRETURN: {total, limit, offset, results[], pivot_date, hint?, retry_with?}.\nEach row: `item_kind` (program / tax_incentive), `item_id`, `item_name`,\n`effective_from`, `effective_to`, `on_date_status`, `region`,\n`target_industries`, `authority_level`, source lineage.\n\nLIMITATIONS:\n  - **Effectivity coverage is partial**. We fall back to `application_period_*`\n    when `effective_*` is missing — the two concepts **can differ** for 恒久\n    制度 that were amended but not re-scoped. Cross-check via `search_by_law`\n    for amendment detail.\n  - Certifications and loan programs are OUT OF SCOPE (record_kind filter).\n  - `on_date_status=about_to_close` threshold is ±30 days; adjust downstream if\n    the user needs a different horizon.\n  - 法律改正による 経過措置 (grandfathering) は JSON schema で表現していない —\n    rows that **officially expired** but still applicable to pre-expiry\n    applicants may not show here.\n\nCHAIN:\n  ← `search_by_law` produces `amendment_date` → pivot this tool.\n  → `get_program(unified_id=row.item_id)` / `search_tax_incentives(query=...)`\n    for full detail.\n  → `search_enforcement_cases(disclosed_from=date)` to cross-check what went\n    wrong during that window.\n\nEXAMPLE:\n  Input:  date=\"2020-04-01\", region=\"national\", size=\"sme\"\n  Output: {total: 42, limit: 20, offset: 0, pivot_date: \"2020-04-01\",\n           results: [{item_kind: \"program\", item_name: \"雇用調整助成金 特例\",\n                      effective_from: \"2020-02-14\", effective_to: \"2023-03-31\",\n                      on_date_status: \"active\", ...}, ...]}\n"
    },
    {
      "name": "search_acceptance_stats_am",
      "description": "[EVIDENCE] Returns adoption statistics (応募件数 / 採択件数 / 採択率 / 予算額) per (program × fiscal_year × round). Aggregated from METI / MAFF published sources. Output is search-derived; verify primary source for figures cited in business decisions.\nSearch adoption statistics (applications / acceptances / acceptance rate / budget) per program × fiscal_year × round.\n\nWHAT: `am_entities` rows where `source_topic IN\n('01_meti_acceptance_stats', '02_maff_acceptance_stats',\n'05_adoption_additional')`. Grain: (program × 第N次 × 年度). Key fields on\nrow: `program_name`, `fiscal_year`, `round_number`, `application_count`,\n`acceptance_count`, `acceptance_rate`, `budget_yen`, `announced_date`.\n\nWHEN:\n  - \"ものづくり補助金の第 14 次の採択率は?\"\n  - \"事業再構築補助金 2024 年度の採択件数推移\"\n  - \"IT 導入補助金 過去 3 年の倍率変化\"\n  - \"農水省系補助金で採択率が一番高いのは?\"\n\nWHEN NOT:\n  - `search_case_studies` (jpcite corpus) instead when the user wants **具体 採択\n    企業** (recipient profiles) — this tool returns aggregate counts, not\n    individual recipient names.\n  - `search_programs` instead for 制度定義 (eligibility / amount / window).\n  - `search_enforcement_cases` (jpcite corpus) instead for 不正受給 / 返還 history\n    — opposite signal to adoption.\n\nRETURN: {total, limit, offset, results[], hint?, retry_with?}.\nEach result row has the key fields above plus source_url + fetched_at for\nlineage.\n\nLIMITATIONS:\n  - Coverage is **skewed toward METI / MAFF** publishable 採択発表 — 自治体\n    単独事業や 新しい公募 (未発表) は空である。Missing rounds do NOT mean\n    the program was unpopular.\n  - `acceptance_rate` is computed `acceptance_count / application_count` when\n    both are present; for rows with only 採択件数 公表 (分母が非公開) it is NULL.\n  - `program_name` matching is LIKE substring on `primary_name` +\n    `raw_json.program_name` + `canonical_id`. Name drift year-over-year\n    (「ものづくり・商業・サービス生産性向上促進補助金」 ≠ 「ものづくり補助金」)\n    — consider passing the shorter form.\n  - `year` filter matches both `fiscal_year` and first 4 chars of\n    `announced_date` — 発表 遅延があると year 1 ずれる。ピンポイントは避ける。\n\nCHAIN:\n  ← `search_programs` produces the canonical program name → this call.\n  → `search_case_studies(program_used=program_name)` (jpcite corpus) for actual\n    recipient examples to pair with stats.\n  → `list_open_programs(on_date=today)` to see whether the program is still\n    active for future applications.\n\nEXAMPLE:\n  Input:  program_name=\"ものづくり補助金\", year=2024\n  Output: {total: 3, limit: 20, offset: 0,\n           results: [{program_name: \"ものづくり補助金\", fiscal_year: 2024,\n                      round_number: 17, application_count: 6589,\n                      acceptance_count: 3970, acceptance_rate: 0.602, ...}],\n           meta: {data_as_of: \"2026-04-25\"}}\n\n`as_of` is informational here (acceptance stats are historical /\nimmutable) — pass for parity with sibling search_* tools.\n\n0 件の場合は `hint` (再検索の提案) と `retry_with` (関連 tool 候補) を返します。\n"
    },
    {
      "name": "related_programs",
      "description": "[DISCOVER-GRAPH] Returns related programs along 6 relation axes (prerequisite / compatible / incompatible / successor / predecessor / similar), 1-2 hops from a seed program / tax / cert. Walks am_relation (18,489 edges / ~13K nodes). Output is search-derived; verify primary source for compatibility decisions.\nGraph walk over am_relation (18,489 edges) seeded on one program/tax/cert, returning up to 6 relation axes and 2-hop neighbors.\n\nWHAT: `graph.sqlite::am_relation` — 18,489 directed edges across ~13K nodes.\nExternal vocab → internal relation_type:\n  prerequisite → prerequisite\n  compatible → compatible\n  incompatible → incompatible\n  successor → replaces (reverse edge walk)\n  predecessor → replaces (forward edge walk)\n  similar → related\nSeed resolution: accepts `canonical_id` from any `search_*`, or display name;\nfalls back to LIKE match on am_node.display_name when exact fails.\n\nWHEN:\n  - \"事業再構築補助金の前提になる認定は?\"\n  - \"IT 導入補助金と併用可能な補助金は?\"\n  - \"持続化補助金が 2026 年度で何に変わった?\" (successor 取得)\n  - \"この税制と似た制度 (other ministries) は?\"\n\nWHEN NOT:\n  - `search_by_law` instead when the user names a **law** (not a program).\n  - `check_exclusions(program_ids=[...])` instead when the user already has\n    a candidate set and asks 「併給可否」 — that runs the 181 rule engine,\n    which is more authoritative than `relation_type='incompatible'`.\n  - `search_programs` instead when the user has only a keyword, not a seed id.\n\nRETURN: {seed_id, seed_kind, seed_name?, relations: {relation_type: [{from_id,\nto_id, relation_type, confidence, evidence}, ...]}, nodes: [...], total_edges,\ndepth, hint?, retry_with?, error?}.\nNOTE: envelope shape **differs** from search_*; this is a graph result.\n\nLIMITATIONS:\n  - **Hub explosion**: `has_authority` hub 単体で 4,541 edges out — `max_edges`\n    (default 100, hard cap 500) で強制切り詰め、`edge_cap_hit=True` で通知。\n    密な node を seed に置くと打ち切られる前提で扱うこと。\n  - `depth` is capped at 2. Deeper graph exploration should be done in\n    multiple calls with the next frontier as a seed.\n  - `incompatible` edges are **provisional** — authoritative 併給可否 判定は\n    必ず `check_exclusions` (jpcite corpus) に回せ。This tool's edges are derived\n    from 要綱 extraction and may miss 相互排他 rules.\n  - Seed resolution by display name is LIKE — wrong LIKE hits return edges\n    for an unintended node. Prefer canonical_id.\n\nCHAIN:\n  ← `search_programs` / `search_tax_incentives` / `search_certifications`\n    produces the `canonical_id` → pass to `program_id`.\n  → `get_program(unified_id=edge.to_id)` for the neighbor's detail.\n  → `check_exclusions(program_ids=[seed, *compatible_ids])` to validate\n    併給 可否 against the authoritative 181 rule set.\n  DO NOT → call `related_programs` recursively with each neighbor — walk\n    in single hop, process with `check_exclusions`, then decide.\n\nEXAMPLE:\n  Input:  program_id=\"it-dounyu-2026\",\n          relation_types=[\"prerequisite\", \"compatible\"]\n  Output: {seed_id: \"it-dounyu-2026\", seed_kind: \"program\",\n           seed_name: \"IT 導入補助金\",\n           relations: {prerequisite: [...], compatible: [...]},\n           nodes: [...], total_edges: 12, depth: 1}\n"
    },
    {
      "name": "get_annotations",
      "description": "[ANNOTATION] Return public annotation rows for a given entity_id.\n\nWHAT: ``am_entity_annotation`` table (migration 046 で導入された汎用注釈\nレイヤー) を ``entity_id`` で絞って返す。public visibility の kind /\nseverity / text_ja / score / meta + supersede chain + effective window\nを 1 行ずつ。\n\nWHEN:\n  - 「この program はなぜ品質スコアが低いと判断された?」\n  - 「採択事例 X に紐付く public warning を全部見たい」\n  - 「過去の validation_issue 履歴を確認したい」(include_superseded=True)\n\nWHEN NOT:\n  - 全 entity 横断で「最も警告が多い program」を探したい → 別 tool を\n    新設 (現状未実装、search_top_warnings 等)。get_annotations は\n    single-entity 専用。\n  - entity の本体属性 (primary_name / authority / amount) → search_programs\n    / search_case_studies 等を直接呼ぶ。\n\nRETURNS (envelope):\n  {\n    total: int,\n    limit: int,\n    offset: 0,\n    results: [\n      {\n        annotation_id, entity_id, kind, severity, text_ja, score,\n        meta (dict, parsed JSON), visibility, source_id,\n        effective_from, effective_until, supersedes_id, superseded_at,\n        observed_at,\n      }, ...\n    ],\n    entity_id: <echo>,\n    filters: {kinds, visibility, include_superseded},\n  }\n\nLIMITATIONS:\n  - public visibility の注釈だけを返す。internal / private のレビュー\n    メモは公開 API / MCP からは返さない。\n  - meta_json の schema は kind 依存。caller 側で kind を見て分岐する。\n"
    },
    {
      "name": "search_gx_programs_am",
      "description": "DISCOVER (GX/Green): Search Green Transformation subsidies — emissions reduction, renewable energy, EV adoption, ZEB/ZEH (net-zero buildings), carbon credits. Returns curated programs with eligibility summaries.\n\n[DISCOVER-GX] Returns matching GX program records (脱炭素 / 再エネ / EV / ZEB-ZEH / carbon_credit) from the am_entities table (program:gx:% rows), filtered by theme × company_size. Output is search-derived; verify primary source (source_url) for application requirements.\n\nWHAT: am_entities rows with canonical_id matching 'program:gx:%', joined\nwith am_application_round for currently_open_rounds[]. eligibility_quick_summary\nis a 1-line string mashing target_types + rate + amount for LLM fast-scan.\n\nWHEN:\n  - 「GX 脱炭素補助金で SME が使えるものは?」\n  - 「ZEB-ZEH 補助金の公募中 round は?」\n  - 「EV 法人購入補助金の一覧」\n\nWHEN NOT:\n  - Non-GX themes (DX / 生産性 / 創業) → search_programs instead.\n  - 税制ベースの脱炭素インセンティブ → search_tax_incentives / get_am_tax_rule.\n\nRETURN: {total, results[{canonical_id, program_name, theme, agency, program_kind,\n         amount_max_yen, subsidy_rate, currently_open_rounds, past_rounds_count,\n         target_types, eligibility_quick_summary, source_url, references_law[]}]}\n\n0 件の場合は `hint` (再検索の提案) と `retry_with` (関連 tool 候補) を返します。\n"
    },
    {
      "name": "search_loans_am",
      "description": "[DISCOVER-LOAN] Returns matching loan products from am_loan_product, filtered by 3 independent axes (担保 / 個人保証 / 第三者保証). Spans 公庫 / 自治体制度融資 / 商工中金. Output is search-derived; verify primary source (source_url) for the actual lending terms.\n\nWHAT: am_loan_product rows. Each row has three-axis structured flags:\ncollateral_required / personal_guarantor / third_party_guarantor ∈\n{required, not_required, case_by_case, exception, unknown}. ResponseRow\nalso exposes `flags{no_collateral, no_personal_guarantor, no_third_party_guarantor}`\nso LLMs can reason without re-checking the enum.\n\nWHEN:\n  - 「無担保・無保証人で借りられる公庫融資は?」\n  - 「災害融資 で 担保不要 の制度」\n  - 「中小企業庁 セーフティネット 4号 の限度額」\n\nWHEN NOT:\n  - search_loan_programs (primary corpus loan_programs 108 rows) covers a\n    different subset — the am table is broader (公庫 + 自治体制度融資 +\n    商工中金) but overlaps。迷ったら必要に応じて両方の出典付き結果を比較してください.\n\nRETURN: {result_count, results[{canonical_id, primary_name, lender_entity_id,\n         loan_program_kind, limit_yen, limit_yen_special, interest_rate_base_pct,\n         interest_rate_special_pct, term_years_max, grace_period_months,\n         collateral_required, personal_guarantor, third_party_guarantor,\n         eligibility_cond{…}, flags{no_collateral, no_personal_guarantor,\n         no_third_party_guarantor}, source_url}]}\n\n0 件の場合は `hint` (再検索の提案) と `retry_with` (関連 tool 候補) を返します。\n"
    },
    {
      "name": "check_enforcement_am",
      "description": "[ENFORCEMENT] Returns 行政処分 records from am_enforcement_detail for a 法人番号 or 企業名, including currently_excluded flag (active 排除期間 at as_of_date) and 5-year history. Coverage is the 1,185-row corpus only — absence of records does NOT prove a clean record. Verify primary source (source_url) for due-diligence decisions.\n\nWHAT: am_enforcement_detail (structured 行政処分 ledger). Either houjin\nor target_name required. Returns:\n  - currently_excluded: bool  (排除期間内か at as_of_date)\n  - active_exclusions: list[row] (いま効いている排除)\n  - recent_history:    list[row] (past 5 years regardless of active)\n  - all_count:         int\n\nWHEN:\n  - 「この法人は今補助金を受給できる状態か?」(due diligence before 商談)\n  - 「○○株式会社 の 行政処分 履歴」\n  - 「名前で検索 (法人番号が手元に無い)」\n\nWHEN NOT:\n  - prod search_enforcement_cases covers a different 独禁法 / 景表法 slice\n    — use it for 広告表示違反 / 排除措置命令 一覧. Use this tool specifically\n    for 補助金 / 助成金 排除期間 判定.\n\nRETURN: {queried{houjin_bangou, target_name, as_of_date}, found, currently_excluded,\n         active_exclusions[…], recent_history[…], all_count}.\n         When found=False, the canonical envelope is returned with\n         ``error.code`` = ``no_matching_records`` (or ``invalid_input``\n         for missing identifiers); ``error.coverage_scope`` echoes the\n         1,185-row corpus scope so DD agents don't read absence as 与信.\n\n0 件の場合は `hint` (再検索の提案) と `retry_with` (関連 tool 候補) を返します。\n"
    },
    {
      "name": "search_mutual_plans_am",
      "description": "[DISCOVER-MUTUAL] Returns matching 共済 / 年金 / 労災 records (小規模企業共済 / 倒産防止共済 / iDeCo+ / DB / DC / 労災特別加入 等) from am_insurance_mutual, filtered by plan_kind × premium range × tax_deduction_type × provider. Output is search-derived; verify primary source (source_url) for actual contract terms.\n\nWHAT: am_insurance_mutual structured ledger, joined with am_tax_rule via\nheuristic linking (tax_deduction_type → tax_measure canonical_id). Each\nrow carries eligibility_cond JSON + linked_tax_rules list.\n\nWHEN:\n  - 「小規模企業共済 と 倒産防止共済 の違い」\n  - 「月 3 万 で入れる退職金 共済」\n  - 「iDeCo+ の対象従業員要件」\n\nWHEN NOT:\n  - 単独 税制だけ知りたい → get_am_tax_rule.\n  - 助成金 (雇用関連) → search_programs.\n\nRETURN: {result_count, results[{canonical_id, primary_name, provider_entity_id,\n         plan_kind, premium_min_yen, premium_max_yen, tax_deduction_type,\n         benefit_type, eligibility_cond{…}, linked_tax_rules[…], source_url}]}.\n\n0 件の場合は `hint` (再検索の提案) と `retry_with` (関連 tool 候補) を返します。\n"
    },
    {
      "name": "get_law_article_am",
      "description": "[LAW-ARTICLE] Returns the article text from am_law_article for a (law name, article number) pair. Accepts natural notation like '租税特別措置法 第41条の19' and normalizes to canonical form. Includes last_amended + source_url. Output is search-derived; verify primary source (e-Gov) for legal interpretation.\n\nWHAT: am_law_article structured ledger. Law resolution order:\n  1. canonical_id ('law:sozei-tokubetsu')\n  2. Exact canonical_name or short_name\n  3. LIKE fallback on name (shortest match wins)\n\nArticle normalization: '41の19' / '41-19' / '41.19' → '第41条の19'.\n\nWHEN:\n  - 「租税特別措置法 第41条の19 の条文」\n  - 「法人税法 施行令 5条 の本文」\n  - 「措置法 41 条の 19 (原本)」\n\nWHEN NOT:\n  - 全条文の横断 検索 → search_laws (prod).\n  - 法律 メタ (施行日 / 最終改正) だけ → get_law (prod).\n\nRETURN: {found, law{canonical_id, canonical_name}, article_id, article_number,\n         article_number_sort, title, text_summary, text_full, effective_from,\n         effective_until, last_amended, source_url, source_fetched_at}.\n         When not found, the canonical envelope is returned with\n         ``error.code`` ∈ {seed_not_found, no_matching_records,\n         missing_required_arg} and ``error.queried`` echoing the input.\n"
    },
    {
      "name": "verify_citations",
      "description": "[CITATION-VERIFY] Substantiate verification_status=\"verified\" by deterministic substring + Japanese numeric-form match against the cited primary source. Pure no-LLM. Per-citation verdict ∈ {verified, inferred, unknown}; SHA256 checksum returned for re-checks. Up to 10 citations / 30s wall clock.\n        "
    },
    {
      "name": "apply_eligibility_chain_am",
      "description": "Multi-step eligibility orchestration over prerequisite_chain → rule_engine_check → exclusion_rules → am_compat_matrix per program. Returns per-program verdict (eligible / partial / ineligible) + reasoning_steps + cite chain. Heuristic; verify primary source. §52 sensitive.\n        "
    },
    {
      "name": "find_complementary_programs_am",
      "description": "Seed program → am_compat_matrix compatible edges → portfolio with combined_ceiling_yen + conflicts. authoritative_share_pct surfaced. inferred_only=true edges are heuristic. §52 sensitive — verify 経費重複 + 適正化法 17 条 before stacking.\n        "
    },
    {
      "name": "simulate_application_am",
      "description": "Pure-SQL mock walkthrough: am_application_steps + am_prerequisite_bundle + am_application_round + am_law_article. Returns document_checklist + certifications + est_review_days + completeness_score. no LLM call. §52 sensitive — not a substitute for 行政書士 §1 申請代理.\n        "
    },
    {
      "name": "track_amendment_lineage_am",
      "description": "am_amendment_snapshot time-series for a target (14,596 rows; only 140 carry effective_from). Returns timeline + strict_count (with effective_from) + hash_only_count + warnings. eligibility_hash is uniform sha256-of-empty on 82.3% — time-series fence surfaced.\n        "
    },
    {
      "name": "program_active_periods_am",
      "description": "am_application_round (1,256 rows) per-program rounds + days_to_close + sunset_warning. Returns open_count / upcoming_count / closed_count + soonest_close_date. sunset_warning fires when only closed rounds exist OR close < 14 days away.\n        "
    },
    {
      "name": "get_houjin_360_am",
      "description": "[CORPORATE-LAYER] 法人 360° view by 法人番号 — joins jpi_houjin_master + jpi_invoice_registrants + am_enforcement_detail + jpi_adoption_records into a single envelope. Surfaces master_info + invoice_status + enforcement_count + adoption_count + related_programs_count. no LLM call. §52 sensitive — 与信判断 / 税務助言 territory."
    },
    {
      "name": "list_edinet_disclosures",
      "description": "[CORPORATE-LAYER] EDINET (金融庁 電子開示) disclosure pointer — returns canonical search URL + API v2 query hint for 有価証券報告書 / 大量保有報告書 etc. Pointer-only (NO live HTTP inside tool). License public_domain. NOT sensitive — pure pointer, no advice; customer LLM fetches body itself."
    },
    {
      "name": "search_invoice_by_houjin_partial",
      "description": "[CORPORATE-LAYER] Partial 法人名 search across NTA 適格請求書発行事業者 (PDL v1.0 bulk). Substring LIKE on normalized_name with 出典明記 + 編集・加工注記 attribution baked into every response. Returns top-N matches with houjin_bangou + status + last_update. §52 sensitive — 仕入税額控除 確定判断 territory."
    },
    {
      "name": "get_evidence_packet",
      "description": "[EVIDENCE-PACKET] Returns a single Evidence Packet envelope: primary metadata + per-fact provenance + compat-matrix rule verdicts (program only). no LLM call. 1 ¥3 unit per call. SAME composer as REST /v1/evidence/packets/{subject_kind}/{subject_id}.\n\nWHAT: Bundles four already-shipped substrates into one envelope —\n``api.source_manifest._resolve_program`` (resolution + primary\nmetadata), ``api.source_manifest._build_manifest`` (per-fact\nprovenance), ``services.funding_stack_checker`` (rule verdicts via\nam_compat_matrix + exclusion_rules), and ``am_amendment_diff``\n(corpus_snapshot_id derivation). Fail-open: any upstream failure\nappends a code to ``quality.known_gaps[]`` and the packet still\nrenders.\n\nWHEN:\n  - 「この補助金 / 法人について jpcite が知っている全部を一発で\n     一次資料 URL 付きで返してほしい」 (LLM への入力前処理)\n  - Customer LLM が「答え + 出典」を出すための context bundle\n  - 監査再現用の corpus_snapshot_id 付きスナップショット\n\nWHEN NOT:\n  - 単発の制度検索 / 制度詳細 → search_programs / get_program\n  - 単発の per-fact provenance → get_provenance_for_fact\n  - 単発の併用可否 → check_funding_stack_am\n  - 法人 360 だけ欲しい → houjin 360 endpoint\n\nRETURNS (envelope, spec §6):\n  {\n    packet_id: \"evp_...\",\n    generated_at: \"2026-04-30T00:00:00+09:00\",\n    api_version: \"v1\",\n    corpus_snapshot_id: \"corpus-2026-04-29\",\n    query: { user_intent, normalized_filters },\n    answer_not_included: True,\n    records: [\n      {\n        entity_id, primary_name, record_kind,\n        source_url, tier?, prefecture?,\n        facts: [ { fact_id, field, value, confidence,\n                   source: { url, publisher, fetched_at,\n                             checksum, license } } ],\n        rules: [ { rule_id, verdict, evidence_url, note } ],\n        fact_provenance_coverage_pct: 0.0..1.0\n      }\n    ],\n    quality: {\n      freshness_bucket, coverage_score,\n      known_gaps: [...], human_review_required\n    },\n    verification: {\n      replay_endpoint, provenance_endpoint, freshness_endpoint\n    },\n    _disclaimer: { type, not_legal_or_tax_advice, note }\n  }\n\nDATA QUALITY HONESTY: This composer never invents data. When\nupstream services are unavailable, codes appear in\n``quality.known_gaps[]`` (`provenance_unavailable`,\n`compat_matrix_unavailable`, `amendment_diff_unavailable`,\n`compat_matrix_no_partner`, `funding_stack_unavailable`). The\n``_disclaimer`` envelope is mandatory — verify primary source\nbefore any decision; this is not legal or tax advice.\n"
    },
    {
      "name": "check_funding_stack_am",
      "description": "[FUNDING-STACK-AM] Returns a deterministic 制度併用可否 verdict (compatible / incompatible / requires_review / unknown) per pair + aggregate, by joining am_compat_matrix with exclusion_rules. no LLM call. Each response carries `_disclaimer`. Verify primary source.\n\nWHAT: For each C(N, 2) pair (max C(5, 2) = 10) we look up\n``am_compat_matrix`` (43,966 rows; 4,300 sourced + 39,000+ heuristic)\nand ``exclusion_rules`` (181 rows; 125 exclude + 17 prerequisite +\n15 absolute + 24 other) and emit a verdict + ``rule_chain``.\n``all_pairs_status`` rolls up to the strictest verdict\n(incompatible > requires_review > unknown > compatible).\n\nWHEN:\n  - \"IT導入補助金 と 事業再構築補助金 と ものづくり補助金 を併用できる?\"\n  - 「補助金ポートフォリオを 3 件組むと、どこかで一括併用禁止に\n    ぶつからないか?」\n  - 「前提認定 chain で人手確認が必要な組合せは?」\n\nWHEN NOT:\n  - 個別 program の探索 → search_programs\n  - 1 制度の前提認定詳細 → prerequisite_chain\n  - 同一経費 / 重複受給以外の rule (補助率上限など) → rule_engine_check\n\nRETURNS (envelope):\n  {\n    program_ids: list[str],\n    all_pairs_status: \"compatible\" | \"incompatible\" | \"requires_review\" | \"unknown\",\n    pairs: [\n      {\n        program_a, program_b,\n        verdict: ...,\n        confidence: 0.0..1.0,\n        rule_chain: [\n          {source: \"am_compat_matrix\" | \"exclusion_rules\" | ...,\n           rule_text, weight, ...},\n          ...\n        ],\n        _disclaimer: str\n      },\n      ...\n    ],\n    blockers: list[ {program_a, program_b, rule_chain} ],\n    warnings: list[ {program_a, program_b, rule_chain} ],\n    _disclaimer: str,    # 一次資料 / 専門家 advisory (mandatory)\n    total, limit, offset, results  # search-envelope mirror\n  }\n\nDATA QUALITY HONESTY: am_compat_matrix の 22,290 sourced 行のみ\n``confidence=1.0`` で確定する。残り 41,943 行は heuristic で\n``confidence`` は 0.3 以下に減点される。`_disclaimer` フィールドは\n必須 — 非 LLM rule engine は curate コーパスに 100% 依拠するため、\n収録漏れや公募回ごとの細則差を取りこぼし得る。\n"
    },
    {
      "name": "graph_traverse",
      "description": "[KG] current release — Returns paths from a 1-3 hop heterogeneous BFS over am_relation (24,004 edges / 15 relation types). Pure SQL traversal (no LLM). Output is graph-derived; edges with confidence < 0.5 (graph_rescue origin) are noisy — verify primary source (source_url) for relationship claims.\n\nWHAT: BFS over ``v_am_relation_all`` (24,004 edges / 15 relation\ntypes) starting at ``start_entity_id``. Returns the discovered\npaths (each = list of nodes + list of edges + total_distance =\nhop count). Cycle suppression via path-string instr() check;\nper-node fan-out capped at 30; global LIMIT enforced via\n``max_results``.\n\nWHEN:\n  - 「制度 → 根拠法 → 関連判例 → 過去採択」を 1 query で\n  - 「法令を変えると影響受ける制度群を辿る」(reverse 必要なら別 tool)\n  - 「製造業 + 関東で使える制度 + 認定支援機関」(複合横断)\n  - 既存 related_programs では届かない depth=3 / 異種 entity 探索\n\nWHEN NOT:\n  - 同種 program 間 hop (prerequisite / compatible / successor) →\n    related_programs (depth ≤ 2、6 軸固定で fan-out 安全)\n  - 法令本体 → get_law_article_am\n  - 制度詳細 → search_programs / get_program\n\nRETURNS (envelope on success):\n  {\n    paths: [\n      {\n        nodes: [entity_id, entity_id, ...],   # depth ordered\n        edges: [\n          {\n            src: str, tgt: str, relation_type: str,\n            confidence: float, depth: int, origin: str\n          }, ...\n        ],\n        total_distance: int                   # = max(depth)\n      }, ...\n    ],\n    traversed_count: int,                     # total edges examined\n    start_entity_id: str,\n    max_depth: int,\n    edge_types_used: [str, ...],\n    capped: bool,                             # max_results reached\n    elapsed_ms: float,\n    _disclaimer: str\n  }\n\nOn invalid args / DB error returns the canonical error envelope\n(``code`` ∈ {``invalid_enum``, ``db_unavailable``,\n``no_matching_records``}) with ``retry_with`` pointers.\n"
    },
    {
      "name": "deep_health_am",
      "description": "Aggregate health: corpus stores + static bundle.\n\nStatus is ``ok`` / ``degraded`` / ``unhealthy``. Always returns a document —\nnever raises — so callers can use it as a heartbeat. Mirrors the REST\nendpoint ``/v1/am/health/deep`` so MCP clients can introspect liveness\nwithout scraping HTTP.\n\nExample:\n    deep_health_am()\n    → {\"status\": \"ok\", \"checks\": [{\"name\": \"primary_corpus_db\", \"ok\": true, ...}, ...]}\n\nWhen NOT to call:\n    - As a substitute for real data tools — health says \"DB reachable\",\n      NOT \"your query has results\". Use search_* / get_* for content.\n    - To verify a SINGLE table's integrity → run a targeted SELECT instead.\n    - On every user request — heartbeat is for monitoring, not per-call gating.\n"
    },
    {
      "name": "pack_construction",
      "description": "[INDUSTRY-PACK] 建設業 (JSIC D) cohort pack: top 10 programs (建設・住宅・耐震・改修 fence) + up to 5 国税不服審判所 裁決事例 (法人税・消費税) + up to 3 通達 references (法基通・消基通). Single ¥3/billable unit. no LLM call. §52/§47条の2 sensitive — information retrieval, not 税務助言. Compounds via _next_calls."
    },
    {
      "name": "pack_manufacturing",
      "description": "[INDUSTRY-PACK] 製造業 (JSIC E) cohort pack: top 10 programs (ものづくり・設備投資・省エネ・GX・事業再構築 fence) + up to 5 国税不服審判所 裁決事例 (法人税・所得税) + up to 3 通達 references (法基通). Single ¥3/billable unit. no LLM call. §52/§47条の2 sensitive — information retrieval, not 税務助言."
    },
    {
      "name": "pack_real_estate",
      "description": "[INDUSTRY-PACK] 不動産業 (JSIC K) cohort pack: top 10 programs (不動産・空き家・住宅・賃貸 fence) + up to 5 国税不服審判所 裁決事例 (所得税・相続税・法人税) + up to 3 通達 references (所基通・相基通). Single ¥3/billable unit. no LLM call. §52/§47条の2 sensitive — information retrieval, not 税務助言."
    },
    {
      "name": "unified_lifecycle_calendar",
      "description": "LIFECYCLE-CALENDAR: Returns merged calendar of tax sunset + program sunset + application close + law cliff events. Output is search-derived from public-source data; verify primary source (source_url) for business decisions.\n\nWHAT: 4 source (am_tax_rule.effective_until / am_amendment_snapshot\n.effective_* (ISO のみ) / am_application_round.application_close_date /\nam_law_article.last_amended) を UNION + bucket した event 一覧を返す。\nkind ∈ {tax_sunset, program_sunset, amendment_snapshot,\napplication_close, law_amendment}。severity は forward-looking で\ncritical (≤30d) / warning (≤90d) / info (それ以外)。\n\nWHEN:\n  - 「2026 年下半期に切れる税制+補助金 申請窓口を 1 画面で」\n  - 「半期 (H1/H2) 単位で何が cliff か」(granularity='half_year')\n  - 事業計画 / 投資判断 / 監査の sunset カレンダー作成\n\nWHEN NOT:\n  - 税制のみ + 大綱 cliff bucket → list_tax_sunset_alerts\n  - 申請可能な program list → list_open_programs / active_programs_at\n  - 単一 program の lifecycle 履歴 → 設計中 program_lifecycle (P2)\n\nRETURNS (envelope):\n  {\n    calendar: [\n      {period: \"YYYY-MM\"|\"YYYY-H1\"|\"YYYY-H2\",\n       events: [{kind, entity_id, title, date, severity, ...}]},\n      ...\n    ],\n    total_events: int,\n    severity_counts: {critical, warning, info},\n    window: {start_date, end_date, granularity, window_days},\n    data_as_of: str,                # JST today\n    sources_used: [str, ...],       # per-source row counts\n    data_quality: {                 # honest caveats\n      amendment_snapshot_caveat: str,\n      law_amendment_coverage: str,\n    },\n    _disclaimer: str,\n  }\n\nDATA QUALITY HONESTY: am_amendment_snapshot は data-quality notes 記載通り\neligibility_hash 不変 (time-series fake)。本 tool は ISO YYYY-MM-DD\nの effective_* のみ採用し、非 ISO 文字列を calendar に出さない。\nam_law_article.last_amended も 28,048 中 ISO parseable は 101 行のみ。\n残り (raw 改正履歴 string) は本 tool 範囲外。\n\nWINDOW CAP: end - start <= 366 日。1 年超は code='out_of_range' で\n422 相当を返す。多年スイープは年単位 pagination が必要。\n\nCHAIN:\n  ← `list_tax_sunset_alerts` で税制のみ深掘り。\n  → `get_am_tax_rule(entity_id)` で個別 rule 詳細。\n  → `list_open_programs` で kind='application_close' の補助金本体探索。\n"
    },
    {
      "name": "program_lifecycle",
      "description": "LIFECYCLE: Returns schema-level snapshot of program status (abolished / superseded / sunset_imminent / sunset_scheduled / amended / active / not_yet / unknown). Most rows lack historical diffs (eligibility_hash chain partial); use effective_from for filtering.\n\nWHAT: ``am_amendment_snapshot`` (14,596 rows / effective_from filled\non 140 rows / effective_until filled on 4 rows) と ``am_relation``\n(successor_of=190 / replaces=9) を precedence 順で評価。LLM 推論\nゼロ、 SQL only。amendment_snapshot 由来の判定は data-quality notes gotcha\nに従い ``confidence='low'`` で返却。\n\nWHEN:\n  - 「事業再構築補助金 は今も使えるか?」(後継制度有無 + 終了予定)\n  - 「2026 年改正で影響受ける制度?」 (amended / sunset_imminent)\n  - 「申請前 に廃止リスクを 1 コールで確認したい」\n\nWHEN NOT:\n  - 全税制 sunset list → list_tax_sunset_alerts\n  - 法令本文 → get_law_article_am\n  - 補助率/上限額 詳細 → search_programs + raw_json\n\nRETURNS:\n  {\n    unified_id, name, record_kind, canonical_status,\n    status: one of [\n      'abolished', 'superseded', 'sunset_imminent',\n      'sunset_scheduled', 'amended', 'active',\n      'not_yet', 'unknown'\n    ],\n    status_label_ja: <Japanese label>,\n    evidence: {\n      amendment: { version_seq, effective_from_raw, effective_until_raw, source_url, ... } | null,\n      relation:  { relation_type, target_entity_id, confidence, ... } | null,\n      effective_dates: { effective_from: 'YYYY-MM-DD'|null, effective_until: 'YYYY-MM-DD'|null }\n    },\n    confidence: 'low' | 'medium' | 'high',\n    reason: <one-line determinism-trace>,\n    as_of: 'YYYY-MM-DD',\n    _disclaimer: 'Lifecycle status is derived from public-source snapshots; verify source_url before decisions.'\n  }\n\nErrors return the canonical envelope:\n  - missing_required_arg : unified_id empty / whitespace\n  - invalid_date_format  : as_of did not parse as YYYY-MM-DD\n  - db_unavailable       : source database temporarily unavailable\n"
    },
    {
      "name": "program_abstract_structured",
      "description": "[I18N] R7 — Returns audience-targeted, closed-vocab Japanese abstract for a single program. Translation is the customer LLM's job; we never call Anthropic API. official_name_ja + legal_id must stay verbatim (i18n_hints.official_name_must_keep_ja=true). Output is search-derived; verify primary source (source_urls) for application use.\n\nWHAT: Reshapes ``programs.enriched_json`` into a 5-audience-aware,\nISO-style closed-vocab JSON. Returns only original Japanese\nstrings + finite enums — the customer LLM owns rendering into\nen/vi/id/th/zh-CN/fil.\n\nWHEN:\n  - 在日外国人雇用主が雇用助成金一覧を多言語で提示したい\n  - 税理士が顧問先 (外国人) に税制優遇制度を説明したい\n  - VC が投資先の R&D 補助金 portfolio を英文で投資委員会に出したい\n\nWHEN NOT:\n  - 単純な検索 → search_programs (this tool returns 1 record only)\n  - 翻訳済テキストが欲しい → customer LLM の責務 (policy:\n    feedback_autonomath_no_api_use)\n  - 制度の as-of 履歴 → query_at_snapshot\n\nArgs:\n  program_id: unified_id ('UNI-...').\n  audience:   Closed enum, default 'foreign_employer'.\n\nReturns:\n  JSON dict with the shape documented in the module docstring,\n  or the canonical error envelope on failure.\n"
    },
    {
      "name": "find_saiketsu",
      "description": "[DISCOVER-CASE-LAW] 国税不服審判所 (KFS) 公表裁決事例 を全文検索 (FTS5 trigram on nta_saiketsu)。出力は citation のみで税務助言 (税理士法 §52) ではない。出典 source_url で原典確認必須。\n\nWHAT: Returns matching 裁決事例 rows with title / fiscal_period / tax_type /\ndecision_date / decision_summary / source_url. The full text is not\nreturned (cite by source_url instead — file size discipline).\n\nWHEN:\n  - \"居住者判定で争われた裁決事例は?\"\n  - \"重加算税の隠ぺい仮装認定が覆った事例\"\n  - \"外国子会社合算税制の取消事例 直近 3 年\"\n\nWHEN NOT:\n  - 通達の条文を直接引きたい → ``cite_tsutatsu``.\n  - 国税庁公式の質疑応答 → ``find_shitsugi``.\n  - 文書回答事例 (事前照会回答) → ``find_bunsho_kaitou``.\n\nRETURN: {total, limit, offset, results[{volume_no, case_no,\ndecision_date, fiscal_period, tax_type, title, decision_summary,\nsource_url}], _disclaimer}.\n\nLIMITATIONS:\n  - Coverage is 直近 ~5 年 of published 裁決事例. 古い volume rows are\n    ingested incrementally — older years may show 0 hits.\n  - tax_type is parsed from KFS volume index <h2> labels and may be\n    empty for some rows.\n  - decision_date may be NULL when the page header lacks a 元号 date.\n"
    },
    {
      "name": "cite_tsutatsu",
      "description": "[CITE-TSUTATSU] Lookup a 通達 article by code. Returns title + body excerpt + source_url. 出力は citation のみで税務助言 (税理士法 §52) ではない。\n\nWHAT: Direct lookup against ``nta_tsutatsu_index`` (which projects\n``am_law_article`` rows where ``article_kind='tsutatsu'``). For deep\ndives use the existing ``get_law_article_am`` tool with the\n``law_canonical_id`` returned here.\n\nWHEN:\n  - \"法基通 9-2-3 の本文を引きたい\"\n  - \"所基通 36-1 の発出時期は?\"\n  - \"消基通 5-1-1 を citation した resp の source_url は?\"\n\nWHEN NOT:\n  - 法令本文 (措置法・基本三法) → ``get_law_article_am``.\n  - 裁決事例 → ``find_saiketsu``.\n  - Q&A 形式の事例 → ``find_shitsugi``.\n\nRETURN: {total: 0|1, results[{code, law_canonical_id, article_number,\ntitle, body_excerpt, parent_code, source_url, last_amended}], _disclaimer}.\nReturns 0 results if the code does not match an indexed row — the\ningest cron may not have refreshed yet, or the code uses a\nnon-canonical separator.\n\nLIMITATIONS:\n  - Only 法人税基本通達 / 消費税基本通達 are fully ingested at present\n    (~2,007 articles). 所得税基本通達 / 相続税基本通達 / 財産評価基本通達\n    are pending — those codes will return 0 until the ingest cron lands.\n  - body_excerpt is the first 500 chars; the full body lives in\n    ``am_law_article.text_full`` (use ``get_law_article_am``).\n"
    },
    {
      "name": "find_shitsugi",
      "description": "[DISCOVER-QA] 国税庁 質疑応答事例 を全文検索 (FTS5 trigram on nta_shitsugi)。出力は citation のみで税務助言 (税理士法 §52) ではない。出典 source_url で原典確認必須。\n\nWHAT: Returns matching Q&A pairs with question (照会要旨) / answer\n(回答要旨) / related_law (関係法令通達) / category / source_url.\n\nWHEN:\n  - \"ガス爆発事故の損害賠償金は課税? 質疑応答事例\"\n  - \"医療費控除 通勤費 質疑応答\"\n  - \"中小企業者の判定 消費税 公式 Q&A\"\n\nWHEN NOT:\n  - 通達条文の直接引用 → ``cite_tsutatsu``.\n  - 裁決例 → ``find_saiketsu``.\n  - 文書回答事例 (事前照会回答) → ``find_bunsho_kaitou``.\n\nRETURN: {total, limit, offset, results[{slug, category, question,\nanswer, related_law, source_url}], _disclaimer}.\n\nLIMITATIONS:\n  - Coverage tracks 国税庁公開ページ which may be ~10,000 items;\n    ingest is incremental and a freshly-launched 質疑応答 may not\n    appear for 1-7 days.\n  - related_law is free-text and may concatenate multiple law refs.\n"
    },
    {
      "name": "find_bunsho_kaitou",
      "description": "[DISCOVER-RULING] 国税庁 文書回答事例 (事前照会回答) を全文検索。出力は citation のみで税務助言 (税理士法 §52) ではない。出典 source_url で原典確認必須。\n\nWHAT: 文書回答事例 are formal NTA written responses to pre-ruling\ninquiries from taxpayers. Each row contains 照会の趣旨 + 回答 +\nresponse_date + source_url.\n\nWHEN:\n  - \"M&A における持株会社化の文書回答\"\n  - \"事業承継税制 適用関係 文書回答\"\n  - \"ストックオプション 文書回答\"\n\nWHEN NOT:\n  - 一般 Q&A → ``find_shitsugi``.\n  - 裁決例 (争訟結果) → ``find_saiketsu``.\n  - 通達条文 → ``cite_tsutatsu``.\n\nRETURN: {total, limit, offset, results[{slug, category, response_date,\nrequest_summary, answer, source_url}], _disclaimer}.\n\nLIMITATIONS:\n  - 文書回答事例 are 事案固有の判断 — citing one as 一般則 is risky.\n    Always read the 照会の趣旨 carefully before using the response in\n    advice.\n  - Some older 文書回答 are PDF-only and parsing is best-effort —\n    answer may be truncated or empty.\n"
    },
    {
      "name": "prerequisite_chain",
      "description": "[R5-PREREQUISITE-CHAIN] Returns curated prerequisite chain for a program (認定 / 計画 / 登録) with preparation_time_days + preparation_cost_yen. Coverage is partial (135/8,203 programs = 1.6%); empty chain ≠ no prerequisites — verify primary source (公募要領 / obtain_url).\n\nWHAT: ``am_prerequisite_bundle`` (795 rows / 135 programs / 1.6%\ncoverage) を起点に、対象 program の前提取得物を kind 別 (cert /\nplan / membership / agency_relation / id / doc) に列挙し、\n``preparation_time_days`` + ``preparation_cost_yen`` を集計。\n``related_canonical_id`` が解決済の rung は ``depth`` 分まで再帰\n(現状 100% NULL のため depth=1 化、forward-compat)。\n\nWHEN:\n  - 「ものづくり補助金で加点を取るために要る認定は?」\n  - 「事業再構築補助金、申請前に何を整える?(認定・登録・会員)」\n  - 「前提取得だけで何ヶ月 / いくら掛かるか?」\n\nWHEN NOT:\n  - 補助金そのものの探索 → search_programs\n  - 認定の詳細仕様 → search_certifications + get_program\n  - 適格・除外判定 → rule_engine_check\n  - tax 措置の sunset → list_tax_sunset_alerts\n\nRETURNS (envelope):\n  {\n    program_id: str,\n    prerequisite_chain: [\n      { kind, name, required_or_optional, preparation_time_days,\n        preparation_cost_yen, obtain_url, rationale,\n        related_canonical_id, depth }, ...\n    ],\n    total_preparation_time_days: int,\n    total_preparation_cost_yen: int,\n    realistic: bool,                # depth<=5 AND time<=180d AND cost<=¥1M\n    warnings: [ str, ... ],         # depth>5 / time / cost cliffs\n    data_quality: {\n      coverage_pct: 1.6,            # surfaced unconditionally\n      programs_with_bundle: 135,\n      programs_total: 8203,\n      recursion_resolvable: bool,\n      caveat?: str                  # present when chain is empty\n    },\n    _disclaimer: str                # 一次資料 / 専門家 advisory\n  }\n\nDATA QUALITY HONESTY: 1.6% coverage means 98.4% of programs have\nno curated bundle yet. The tool ALWAYS surfaces\n``data_quality.coverage_pct`` so an empty chain is never read as\nauthoritative — silent miss is forbidden under 景表法 / 消費者\n契約法 fences (see feedback_no_fake_data).\n\nCHAIN:\n  ← `search_programs` supplies target_program_id.\n  → `search_certifications(name)` for cert spec depth.\n  → `rule_engine_check(program_id, applicant_profile)` for\n    adjudication once prerequisites are obtained.\n"
    },
    {
      "name": "get_provenance",
      "description": "[PROVENANCE] Returns source attribution for the entity at point-in-time of last fetch — all rows from am_entity_source × am_source JOIN with license_summary. include_facts=True adds per-fact provenance via am_entity_facts.source_id where set.\n\nWHAT: 1) am_entity_source × am_source で entity に紐づく全 source rows\n(role, source_url, domain, license, source_type, fetched_at). 2) per-license\nrollup ``license_summary``. 3) ``include_facts=True`` のとき am_entity_facts\n× am_source via source_id で fact-level provenance も返却 (source_id NULL の\nfact は skip — entity-level sources を引用すること).\n\nWHEN:\n  - 「この補助金の出典 URL 一覧と license は?」(再配布前の確認)\n  - 「どの primary_source / pdf_url / application_url が紐付いているか」\n  - 「この entity の facts は どの source から取得したか」(include_facts=True)\n\nWHEN NOT:\n  - 単一 fact_id の出典 → get_provenance_for_fact\n  - search 系 (entity 検索) → search_programs / search_certifications / etc.\n\nRETURN:\n  {entity_id, total_sources, sources[{role, source_url, domain, license,\n   source_type, fetched_at, source_id, ...}], license_summary{license: count},\n   facts? (when include_facts=True), total_facts? (same)}.\n  seed_not_found / no_matching_records は canonical envelope を返却。\n"
    },
    {
      "name": "get_provenance_for_fact",
      "description": "[PROVENANCE-FACT] Returns source attribution for a single fact_id at point-in-time of last fetch. Resolves am_entity_facts.source_id → am_source. When source_id is NULL (legacy fact pre-2026-04-25), falls back to entity-level am_entity_source candidate list.\n\nWHAT: am_entity_facts row → source_id → am_source 1 件返却.\nsource_id が NULL の legacy fact は entity-level am_entity_source から\n候補 list を返す (``fallback=True``).\n\nExample:\n    get_provenance_for_fact(fact_id=12345)\n    → {\"fact_id\": 12345, \"entity_id\": \"...\", \"field_name\": \"amount_max_yen\",\n       \"field_value_text\": \"5000000\", \"source\": {\"source_id\": 42,\n       \"source_url\": \"...\", \"license\": \"pdl_v1.0\"}, \"fallback\": false}\n\nWhen NOT to call:\n    - For entity-level provenance (all sources for an entity) → use get_provenance(entity_id).\n    - For 補助金 program lineage (primary corpus DB) → use get_program (carries source_url inline).\n    - For 法令 / tax / 判例 detail → those tools embed source_url in their own response.\n    - For bulk fact discovery → use search_* tools and read each row's source_url.\n\nRETURN:\n  {fact_id, entity_id, field_name, field_value_text, source? (when source_id is set),\n   fallback_sources?[…] (when source_id NULL — candidates from am_entity_source),\n   fallback: bool, license_summary{}}\n"
    },
    {
      "name": "rule_engine_check",
      "description": "[R9-UNIFIED-RULE-ENGINE] Returns rule evaluation result + applicable law citations across 6 corpora (49,247 rows): exclusion + compat_matrix (48,815 rows, of which 4,849 are 'unknown' status) + combo + subsidy + tax + validation. Output is search-derived; verify primary source for business decisions.\n\nWHAT: Runs the precedence ladder (absolute → exclude → prerequisite →\ncompat:incompatible → compat:case_by_case → compat:compatible → combo →\nsubsidy/tax → validation) over the unified view ``am_unified_rule`` and\nreturns a single verdict + per-rule trace. First DENY wins, BUT\ncontradictions between corpora surface as ``error.code='rules_conflict'``\nwith both rule_ids — never silently merged.\n\nWHEN:\n  - 「program A と program B を併給できる?」(pairwise compat)\n  - 「この補助金、申請して大丈夫?(他制度との衝突は?)」\n  - Pairwise compat lookup against the compat_matrix corpus.\n  - Replace the 5 disjoint legacy tools (check_exclusions /\n    combined_compliance_check / get_am_tax_rule / search_certifications /\n    list_open_programs) with one call.\n\nWHEN NOT:\n  - Free-text discovery → use search_programs first, then pass the\n    resulting program_id here.\n  - The full ruleset list of all 49,247 rows (no program filter) →\n    this tool requires a program_id.\n\nRETURNS:\n  {\n    judgment: \"allow\" | \"deny\" | \"review\" | \"unknown\" | \"conflict\",\n    program_id: str,\n    alongside_programs: list[str],\n    evidence: [\n      {\n        rule_id, rule_kind, source ∈ {jpi_exclusion_rules,\n        am_compat_matrix, am_combo_calculator, am_subsidy_rule,\n        am_tax_rule, am_validation_rule},\n        scope_program_id, pair_program_id, severity, message_ja,\n        source_url, effect ∈ {deny, allow, review, unknown, info}\n      }, ...\n    ],\n    confidence: 0.0-1.0,\n    data_quality: {\n      exclusion_join_coverage_pct: float (0-100, currently 0% pending\n                                           manual mapping),\n      rules_evaluated: int,\n      rules_total_corpus: 49247\n    },\n    reason?: str (when judgment=unknown — explains why),\n    _disclaimer: str (景表法 fence + 社労士/税理士/弁護士 advisory),\n    error?: { code: \"rules_conflict\", evidence: [both rules] }\n  }\n\nDATA QUALITY HONESTY: jpi_exclusion_rules.program_a uses Japanese\nhuman names while am_compat_matrix uses canonical IDs. Cross-corpus\njoin coverage is currently ~0% (60 distinct human names, 0 mapped).\nThe response surfaces ``data_quality.exclusion_join_coverage_pct`` so\ncallers see partial recall transparently rather than receiving silent\nmisses (景表法 / fraud-risk fence).\n\nCHAIN:\n  ← `search_programs` / `search_certifications` supply program_id.\n  → `get_program(unified_id)` for the program detail view.\n  → `get_am_tax_rule(measure)` for tax_rule depth.\n  → Use `check_exclusions` (legacy) only when this tool returns\n    error.code='subsystem_unavailable' or for backward compatibility.\n"
    },
    {
      "name": "get_source_manifest",
      "description": "[EVIDENCE-GRAPH] Returns the full source manifest for one program: per-fact provenance (where source_id is populated) + entity-level rollup (am_entity_source) + license set + publisher count + first/last fetched_at. Honest sparse signal — empty fact_provenance when source_id bulk fill has not reached the program cohort.\n\nWHAT: 1) `am_entity_facts × am_source` for per-fact provenance (sparse;\n0 program-fact rows populated as of 2026-04-30). 2) `v_program_source\n_manifest` view for the entity-level rollup (source_count, license_set,\nlatest/oldest fetched_at, unique_publishers). 3) `public program catalog` for the\nprimary_name + primary_source_url fallback when an entity has no\nfact-level provenance yet.\n\nWHEN:\n  - 「この補助金の出典 URL を全部洗い出したい」(再配布前の license 確認)\n  - 「per-field provenance ありますか?」(answer = mostly no, surfaced honestly)\n  - Evidence Graph cite-chain audit / 90-day deliverable verification\n\nWHEN NOT:\n  - Single-fact provenance → get_provenance_for_fact(fact_id)\n  - Entity-level provenance only → get_provenance(entity_id)\n  - Plain program lookup → search_programs / get_program (primary corpus DB)\n\nRETURN:\n  {program_id, primary_name, primary_source_url, primary_license,\n   fact_provenance[{field_name, source_id, source_url, publisher,\n   fetched_at, license, checksum}], fact_provenance_coverage_pct,\n   summary{field_paths_covered, source_count, license_set,\n   latest_fetched_at, oldest_fetched_at, unique_publishers},\n   _disclaimer}.\n  seed_not_found / db_unavailable は canonical envelope を返却。\n"
    },
    {
      "name": "list_static_resources_am",
      "description": "Manifest of curated jpcite taxonomies (制度 / 用語 / 助成区分 / 義務 etc.).\n\nReturns 8 entries (seido / glossary / money_types / obligations /\ndealbreakers / sector_combos / crop_library / exclusion_rules). Each\nentry carries id + filename + size_bytes; use ``get_static_resource_am``\nwith the id to fetch the full payload.\n\nExample:\n    list_static_resources_am()\n    → {\"total\": 8, \"results\": [{\"id\": \"seido\", \"filename\": \"seido.json\", ...}, ...]}\n\nWhen NOT to call:\n    - To LOAD a specific taxonomy → use get_static_resource_am(resource_id=...).\n    - For the runtime program list (実データ) → use search_programs / list_open_programs.\n    - For example client profiles → use list_example_profiles_am instead.\n    - For database-level enum values (industry_jsic etc.) → use enum_values_am.\n\n0 件の場合は `hint` (再検索の提案) と `retry_with` (関連 tool 候補) を返します。\n"
    },
    {
      "name": "get_static_resource_am",
      "description": "Load one curated taxonomy / lookup file. Returns full JSON + license.\n\nResolves controlled-vocabulary keys (e.g. seido kind codes, money_types,\nobligations) to their human labels and parent groupings. Pure file read,\nzero compute, zero LLM.\n\nExample:\n    get_static_resource_am(resource_id=\"seido\")\n    → {\"resource_id\": \"seido\", \"content\": [...], \"license\": \"CC0-1.0\"}\n\nWhen NOT to call:\n    - To DISCOVER which resource_ids exist → use list_static_resources_am first.\n    - For a CLIENT-INTAKE profile shape → use get_example_profile_am instead.\n    - For runtime program search (q=\"設備投資\") → use search_programs / list_open_programs.\n    - For statutory text → use search_laws / get_law (taxonomy is metadata, not law).\n"
    },
    {
      "name": "list_example_profiles_am",
      "description": "Manifest of canonical client-intake example payloads (PII-clean).\n\nUse these as reference shapes when constructing ``business_profile`` /\n``profile`` arguments for downstream tools (validation, eligibility,\ntax-applicability, bid-screening). Returns id + label + summary; pass\neach id to ``get_example_profile_am`` for the full JSON payload.\n\nExample:\n    list_example_profiles_am()\n    → {\"total\": 5, \"results\": [{\"profile_id\": \"ichigo_20a\", ...}, ...]}\n\nWhen NOT to call:\n    - To fetch the actual profile JSON → use get_example_profile_am(profile_id).\n    - For the controlled-vocabulary list (industry codes / 助成区分) →\n      use list_static_resources_am instead.\n    - For real client records — these are CC0 fixtures, not anonymised data.\n\n0 件の場合は `hint` (再検索の提案) と `retry_with` (関連 tool 候補) を返します。\n"
    },
    {
      "name": "get_example_profile_am",
      "description": "Return one canonical client profile JSON as a complete-payload example.\n\nUse this as a copy-paste seed for the ``business_profile`` argument to\n``evaluate_tax_applicability`` / ``bid_eligible_for_profile`` / DD tools —\nevery required key is present with a plausible value.\n\nExample:\n    get_example_profile_am(profile_id=\"ichigo_20a\")\n    → {\"profile_id\": \"ichigo_20a\", \"profile\": {...}, \"license\": \"CC0-1.0\"}\n\nWhen NOT to call:\n    - To enumerate available profile_ids → use list_example_profiles_am.\n    - To fetch a TAXONOMY (seido / glossary / 助成区分) → use get_static_resource_am.\n    - For a real client's data — these are PII-clean fixtures, not real records.\n"
    },
    {
      "name": "list_tax_sunset_alerts",
      "description": "[TIMELINE-TAX] Returns tax measures whose effective_until falls within the next N days, plus 大綱 cliff date buckets. Output is search-derived from am_tax_rule (57 rows with effective_until); verify primary source (source_url) for sunset confirmation.\n\nWHAT: ``am_tax_rule.effective_until`` が today..today+days_until に入る\nrule を ``am_entities`` (parent measure) と JOIN して返す。同じ\nmeasure が複数 rule_type を持つ場合は別行 (= 別 rule) として返す。\n\nWHEN:\n  - 「来年度どの税制優遇が消えるか?」\n  - 「2027-03-31 cliff の影響範囲は?」(only_critical=True で絞れる)\n  - 事業計画 / 投資判断における sunset alert\n\nWHEN NOT:\n  - 全税制 list が欲しい → search_tax_incentives\n  - 特定 rule の詳細 → get_am_tax_rule(measure_name_or_id)\n  - 廃止後の後継制度 → get_am_tax_rule + ``note`` フィールド参照\n\nRETURNS (envelope):\n  {\n    total: int,\n    results: [\n      {\n        measure: { canonical_id, name, canonical_status },\n        rule_type: str,                # credit / deduction / ...\n        base_rate_pct: float|null,\n        cap_yen: int|null,\n        effective_from: str|null,\n        effective_until: str,          # YYYY-MM-DD\n        days_remaining: int,\n        article_ref: str|null,\n        source_url: str,\n        note: str|null,\n        is_critical_cliff: bool,\n      }, ...\n    ],\n    cliff_dates: { \"2027-03-31\": 29, ... },  # bucket counts (within window)\n    data_as_of: str,                          # today JST ISO date\n    filter_applied: { days_until, only_critical, limit },\n  }\n\nOn failure / empty result returns the canonical error envelope\n(``code`` ∈ {``no_matching_records``, ``db_unavailable``}) with\n``retry_with`` pointing back to ``search_tax_incentives``.\n\n0 件の場合は `hint` (再検索の提案) と `retry_with` (関連 tool 候補) を返します。\n"
    },
    {
      "name": "get_am_tax_rule",
      "description": "[DISCOVER-TAX-RULE] Returns structured tax rule rows for a 税制措置 (rate / cap / 根拠条文 / 適用期限) from am_tax_rule. One measure can return multiple rows when both 特別償却 and 税額控除 exist. Output is search-derived; verify primary source (source_url) for filing decisions.\n\nWHAT: am_tax_rule から (tax_measure_entity_id, rule_type) PK の\nstructured row を返す。1 つの税制で「特別償却 or 税額控除」が両方\n存在する場合は 2 行返る。\n\nWHEN:\n  - 顧客: 「DX 投資減税を使いたい」「5G税制はまだ使える?」\n    「エンジェル A型 と B型 の違い」\n  - LLM: search_tax_incentives が free-text で候補を出した後、\n    特定の measure_id をこの tool に渡して rate / 期限 / 条文 を\n    確定させる use case がメイン。\n\nWHEN NOT:\n  - 全税制を横断検索したい → search_tax_incentives\n  - 条文内容そのもの → search_by_law\n  - 補助金 → search_programs\n  - 併用可能制度の全グラフ → related_programs (relation graph)\n\nRETURNS (envelope):\n  {\n    total: int,\n    results: [\n      {\n        tax_measure: { canonical_id, name, canonical_status },\n        rule_type: str,\n        base_rate_pct: float|null,\n        cap_yen: int|null,\n        eligibility: dict,   # JSON from eligibility_cond_json\n        combinable_with: [canonical_id, ...],\n        effective_period: { from, until },\n        article_ref: str,    # 租税特別措置法 第X条\n        source: { url, fetched_at },\n        note: str|null,\n      }, ...\n    ],\n    hint?: str,              # e.g. 「該当制度は廃止済み」 (only on success)\n  }\n\nOn failure / no result, returns the canonical envelope:\n  { total: 0, results: [], error: { code, message, hint, severity,\n    retry_with, ... } } where ``code`` is one of ``seed_not_found``\n  (measure_name_or_id did not resolve), ``no_matching_records``\n  (measure resolved but no am_tax_rule rows), or ``db_unavailable``.\n"
    },
    {
      "name": "validate",
      "description": "[VALIDATE] applicant_data を am_validation_rule の active 述語で評価し、\nrule 単位の passed/failed/deferred を返す (deferred = jpcite corpus 内で評価できない外部依存述語).\n\nWHAT:\n  ``am_validation_rule`` の active=1 / effective window 有効 / scope 適合 rule を選び、\n  python_dispatch 述語のうち ``autonomath.intake.<known>`` のものはローカル再実装で評価、\n  それ以外 (sql_expr / json_logic / 未登録 dispatch) は ``passed=null`` で deferred 返却。\n  評価結果は ``am_validation_result`` に ``INSERT OR IGNORE``、同 (rule, entity, applicant_hash)\n  は SELECT-first で cache 返却。\n\nWHEN:\n  - LLM が \"この applicant_data に sanity 違反がないか\" 一括 check したい\n  - review workflow に出す前段で training_hours/work_days/weekly_hours の桁ミス除去\n  - 申請額 50 億超 / 開始年 ±20/+10 範囲外 / 生年-自己申告年齢 1y 以上ずれ の検出\n\nWHEN NOT:\n  - 制度個別の eligibility 判定 → check_exclusions / search_programs\n  - 文書粒度の fact-check → 別 tool\n  - sql_expr / json_logic 述語が登録されたら本 tool では deferred 返却なので\n    jpcite review workflow 経由が必要\n\nRETURNS (envelope):\n  {\n    total: int,\n    applicant_hash: str,\n    scope: str,\n    entity_id: str | null,\n    summary: { passed: int, failed: int, deferred: int },\n    results: [\n      {\n        rule_id: int,\n        predicate_ref: str,\n        predicate_kind: 'python_dispatch' | 'sql_expr' | 'json_logic',\n        passed: true | false | null,\n        severity: 'info' | 'warning' | 'critical',\n        message_ja: str,\n        evaluated_at: str | null,\n        cached: bool,\n      }, ...\n    ]\n  }\n"
    },
    {
      "name": "match_due_diligence_questions",
      "description": "DD question deck (30-60 items) tailored to industry × program portfolio × 与信 risk by joining dd_question_templates (60 rows, migration 102) with houjin / adoption / enforcement / invoice corpora. Pure pattern-match, no LLM call. §52/§72 sensitive — checklist, not advice."
    },
    {
      "name": "prepare_kessan_briefing",
      "description": "月次 / 四半期 summary of program-eligibility changes since last 決算 by joining am_amendment_diff + jpi_tax_rulesets within the FY window. Compounds saved_searches digest cadence. §52 sensitive — 決算 territory, briefing only, not 税務代理."
    },
    {
      "name": "forecast_program_renewal",
      "description": "Probability + window of program renewal in next FY based on historical am_application_round cadence + am_amendment_snapshot density. 4-signal weighted average (frequency / recency / pipeline / snapshot). NOT sensitive — statistical, not advice."
    },
    {
      "name": "cross_check_jurisdiction",
      "description": "Registered (法務局) vs invoice (NTA) vs operational (交付) jurisdiction breakdown. Detects 不一致 for 税理士 onboarding — flags prefecture mismatches between houjin_master / invoice_registrants / adoption_records. §52/§72 sensitive — heuristic detection, not 税務代理."
    },
    {
      "name": "bundle_application_kit",
      "description": "Complete downloadable kit assembly: program metadata + cover letter scaffold + 必要書類 checklist + similar 採択例 list. Pure file assembly, no LLM call, NO DOCX generation. §1 sensitive — 申請書面作成は行政書士の独占業務、当社は scaffold + 一次 URL のみ提供."
    },
    {
      "name": "discover_related",
      "description": "[DISCOVER-RELATED] Returns up to 5 axes × 5 rows of related entities for the given entity in one call. Pure SQL + sqlite-vec, no LLM call. 1 ¥3 unit per call. SAME composer as REST GET /v1/discover/related/{entity_id}.\n\nWHAT: Joins 5 already-shipped substrates into one envelope —\n``program_law_refs`` (primary corpus DB), ``am_entities_vec_*``\n(sqlite-vec k-NN), ``am_funding_stack_empirical`` (co-adoption),\n``am_entity_density_score`` (graph-density neighbours), and\n``am_5hop_graph`` (current release §152 mat-view). Each axis is fail-open:\na missing/empty table yields an empty list, never a 5xx.\n\nWHEN:\n  - \"この補助金 / 制度の関連を一発で全部見たい\" (LLM への入力前処理)\n  - 5 つの per-axis tool を順番に叩く前の starter set\n  - 監査再現用の corpus_snapshot_id 付き snapshot (audit_seal 同梱)\n\nWHEN NOT:\n  - 単発の制度詳細 → get_program / search_programs\n  - 単発の併用可否 → check_funding_stack_am\n  - 深い graph walk (depth>=3 / 異種 entity) → graph_traverse\n  - 1 軸のみで十分 → related_programs (depth ≤ 2、6 軸固定)\n\nRETURNS (envelope):\n  {\n    entity_id, resolved: { uni_id, canonical_id },\n    related: {\n      via_law_ref: [...],         // program_law_refs 経由\n      via_vector:  [...],          // sqlite-vec k-NN\n      via_co_adoption: [...],      // funding_stack_empirical\n      via_density_neighbors: [...],// density_score の近傍\n      via_5hop: [...]              // am_5hop_graph\n    },\n    total, k, per_axis_cap,\n    corpus_snapshot_id,\n    _disclaimer, _billing_unit\n  }\n\nDATA QUALITY HONESTY: discover/related は starter set です。\n各 axis 上位 5 件、合計最大 25 件。深掘りは per-axis tool に委ねる\nこと。``_disclaimer`` は必須 — 最終判断は一次資料 (source_url) と\n専門家確認を必ず経てください。\n"
    },
    {
      "name": "recommend_similar_program",
      "description": "Vector k-NN over am_entities_vec_S (programs). Re-ranked by cosine + verification_count + density_score (W22-9). NOT an 採択 forecast — 行政書士法 §1 / 税理士法 §52 fence; the LLM must surface the disclaimer envelope."
    },
    {
      "name": "recommend_similar_case",
      "description": "Vector k-NN over am_entities_vec_C (case_studies). Cosine distance with optional density boost. NOT an 採択 forecast — 行政書士法 §1 / 税理士法 §52 fence; the LLM must surface the disclaimer envelope."
    },
    {
      "name": "recommend_similar_court_decision",
      "description": "Vector k-NN over am_entities_vec_J (court_decisions). Cosine distance with optional density boost. NOT a legal opinion — 弁護士法 §72 / 行政書士法 §1 fence; the LLM must surface the disclaimer envelope."
    },
    {
      "name": "intel_probability_radar",
      "description": "[INTEL-COMPOSITE] probability_estimate (NOT forecast) + same-industry adoption rate + mean award + ROI for (program × houjin) in 1 call. Pure SQLite, no LLM call. §52/§1 行政書士法 fence — output is statistical estimate, NOT 採択保証. Replaces 5+ legacy fan-out calls."
    },
    {
      "name": "intel_audit_chain",
      "description": "[INTEL-COMPOSITE] Composite Merkle proof + sources + 5-step verify chain in 1 call. Replaces 3-call audit fan-out (/v1/audit/proof + /v1/audit/seals + /v1/am/provenance). Auditor pastes booleans directly into 監査調書. ¥3/billable unit. §47条の2 / §52 fence — cryptographic provenance only, NOT 監査意見."
    },
    {
      "name": "intel_match",
      "description": "[INTEL-COMPOSITE] Smart matchmaking: ranked programs with documents, similar adopters, laws, tsutatsu, audit proof, plus next_questions, eligibility_gaps, and document_readiness for follow-up and application prep."
    },
    {
      "name": "intel_program_full",
      "description": "[INTEL-COMPOSITE] Composite per-program bundle in 1 call: program_meta + eligibility_predicate + amendments_recent + adoptions_top + similar_programs + citations + audit_proof. Replaces 8+ naive single-program calls. ¥3/billable unit. §52/§1/§72 fence."
    },
    {
      "name": "intel_houjin_full",
      "description": "[INTEL-COMPOSITE] Houjin 360 bundle with metadata, adoption history, enforcement, invoice status, peers, jurisdiction, watch status, and decision_support.{risk_summary,decision_insights,next_actions,known_gaps}."
    },
    {
      "name": "intel_diff",
      "description": "[INTEL-COMPOSITE] Composite entity diff (M&A DD): shared_attrs + unique_to_a + unique_to_b + conflict_points across primary table + am_5hop_graph + am_program_eligibility_predicate + am_id_bridge. Pure SQLite + Python set arithmetic, no LLM call. ¥3/billable unit. §52/§72/§1/§3/§47条の2 fence — descriptive, NOT prescriptive."
    },
    {
      "name": "intel_path",
      "description": "[INTEL-COMPOSITE] 5-hop bidirectional BFS reasoning chain between 2 entities in 1 call. Returns shortest_path + up to 3 alternates so customer LLM can visualise the citation chain. Walks am_5hop_graph + am_citation_network + am_id_bridge. ¥3/billable unit. §52/§72/§1 fence."
    },
    {
      "name": "intel_timeline",
      "description": "[INTEL-COMPOSITE] Annual cross-substrate event timeline for 1 program in 1 call. Cross-joins am_amendment_diff + am_adoption_trend_monthly + am_enforcement_anomaly + am_adopted_company_features + am_program_narrative_full. no LLM call. §52/§1/§72 fence."
    },
    {
      "name": "intel_conflict",
      "description": "[INTEL-COMPOSITE] Combo conflict detector: pairwise check across am_compat_matrix + jpi_exclusion_rules + 適正化法 17 conditions, returns conflict_pairs + alternative_bundles. ¥3/billable unit. §52/§1 fence — flagging compatibility, NOT 申請可否判定."
    },
    {
      "name": "intel_why_excluded",
      "description": "[INTEL-COMPOSITE] Eligibility-failure reasoning: returns predicate_violations + remediation_steps + suggested_alternative_programs in 1 call. Walks am_program_eligibility_predicate + am_relation. no LLM call. §52/§1 fence — heuristic remediation, NOT 申請代理."
    },
    {
      "name": "intel_peer_group",
      "description": "[INTEL-COMPOSITE] 同業他社 N peers in 1 call: Jaccard similarity on (jsic × prefecture × capital × employee bucket) + per-axis comparison envelope. no LLM call. §52/§72 fence — peer benchmarking, NOT 信用調査."
    },
    {
      "name": "intel_regulatory_context",
      "description": "[INTEL-COMPOSITE] Full regulatory bundle for 1 program in 1 call: 法令 + 通達 + 裁決 + 判例 + 行政処分. Replaces 5+ axis-specific fan-out calls. ¥3/billable unit. §72/§52/§1 fence — primary-source pointers, NOT 法解釈."
    },
    {
      "name": "intel_bundle_optimal",
      "description": "[INTEL-COMPOSITE] Houjin-to-program bundle optimizer over recommendations, compatibility matrix, and exclusion rules, with decision_support.{why_this_matters,decision_insights,next_actions}."
    },
    {
      "name": "intel_citation_pack",
      "description": "[INTEL-COMPOSITE] Citation pack — every primary-source citation surface (法令+通達+裁決+判例+行政処分+採択) bundled as markdown (default) or JSON in 1 call. ¥3/billable unit. §52/§47条の2/§1/§72 fence — citation pack can be re-quoted into 申請書面/提案書 territory."
    },
    {
      "name": "recommend_programs_for_houjin",
      "description": "TOP-N recommended programs for a 法人 from am_recommended_programs (pre-computed via §10.3 ETL). Returns score + rank + decoded reason JSON. SENSITIVE — §52 / §72 fence; the LLM should treat the score as guidance, not a 採択 forecast."
    },
    {
      "name": "find_combinable_programs",
      "description": "Combinable-program list from am_program_combinations. Both directions UNIONed under the (program_a < program_b) CHECK. visibility='public' (default) surfaces only sourced rows; 'internal' adds heuristic. SENSITIVE — §52/§1 fence — combinability is heuristic, not a promise."
    },
    {
      "name": "get_program_calendar_12mo",
      "description": "12-month per-program calendar from am_program_calendar_12mo (pre-computed). Returns is_open + deadline + round_label per month. NOT sensitive — calendar facts. Use after recommend_programs_for_houjin or search_programs to time the application."
    },
    {
      "name": "forecast_enforcement_risk",
      "description": "enforcement × JSIC × region 横展開 risk from am_enforcement_industry_risk. propagation_probability is a 5-year statistical forecast, not a legal opinion. SENSITIVE — 弁護士法 §72 / 社労士法 §27. The customer LLM must surface the disclaimer envelope."
    },
    {
      "name": "find_similar_case_studies",
      "description": "Top-N similar 採択事例 from am_case_study_similarity (pre-computed pairwise feature similarity, PK case_a < case_b — UNIONed both directions). NOT sensitive — facts about past adoptions, not advice. Use to find 'companies like mine' before drafting an application."
    },
    {
      "name": "get_houjin_360_snapshot_history",
      "description": "Past N monthly snapshots (latest first) from am_houjin_360_snapshot, with per-row delta_from_prev computed by JSON diff in Python. SENSITIVE — 信用情報法 / 個人情報保護法 fence. NOT a credit / 反社 substitute; the LLM must surface the disclaimer envelope."
    },
    {
      "name": "get_tax_amendment_cycle",
      "description": "Per-ruleset amendment history from am_tax_amendment_history + cycle_stats (min/max/mean/median gap days, computed in Python). SENSITIVE — 税理士法 §52. The cycle is a past-tense pattern; future amendments are not guaranteed. Disclaimer auto-injected."
    },
    {
      "name": "infer_invoice_buyer_seller",
      "description": "Inferred trading partners from am_invoice_buyer_seller_graph. CHECK seller != buyer. direction filters which side the input plays. SENSITIVE — 信用情報法 / 個人情報保護法. Inferences are heuristic; not a substitute for credit checks."
    },
    {
      "name": "match_programs_by_capital",
      "description": "capital_yen → canonical band (lt_1m / 1m_10m / ... / gte_5b) → SELECT from am_capital_band_program_match. Optional jsic_major narrows. NOT sensitive — adoption stats by band are facts. Pair with score_application_probability for full read."
    },
    {
      "name": "get_program_adoption_stats",
      "description": "Per-FY adoption stats (count / rate / avg amount / industry & region distribution JSON-decoded) from am_program_adoption_stats. NOT sensitive — facts. Pair with find_adopted_companies_by_program for the underlying corpus."
    },
    {
      "name": "get_program_narrative",
      "description": "Pre-computed program narrative from am_program_narrative (precomputed source-processing batch §10.6 — NOT generated here). section='all' returns up to 4 rows; specific section returns 1. reading_level='plain' post-processes body_text via rule-based dict (jpcite LLM call禁止). SENSITIVE — 行政書士法 §1 + LLM 由来明示 — not 申請代理."
    },
    {
      "name": "predict_rd_tax_credit",
      "description": "措置法 §42-4 R&D tax credit estimate from am_houjin_360_snapshot (rd_expense_yen) × am_tax_amendment_history (headline_rate). Pure Python multiplication. billing_unit=2 (compound). SENSITIVE — 税理士法 §52. Heuristic — does NOT model incremental / volume split / 14% cap."
    },
    {
      "name": "find_programs_by_jsic",
      "description": "Filter public program catalog by JSIC code (major/middle/minor) + tier (S/A/B/C). Pure SELECT, no LLM call. Graceful empty when JSIC catalog jsic columns absent."
    },
    {
      "name": "get_program_application_documents",
      "description": "Application document list for a program. Primary: program document registry (wave24_138). Fallback: legacy document registry. §1 行政書士法 sensitive — list 提供のみ、書面作成は対象外。"
    },
    {
      "name": "find_adopted_companies_by_program",
      "description": "Adopted-company list for a program (jpi_adoption_records, 201,845 rows). 個人情報保護法 / 信用情報法 sensitive — public 採択 list のみ、与信判断には流用しない。"
    },
    {
      "name": "score_application_probability",
      "description": "採択者プロファイル類似度 score (similarity)。本 score は採択確率 (probability) の予測ではない。output field 名は `score`。景表法違反リスクのため広告・営業利用禁止。3 軸 join: am_recommended_programs + am_capital_band_program_match + am_program_adoption_stats。billing=2 単位、行政書士法 §1 sensitive。"
    },
    {
      "name": "get_compliance_risk_score",
      "description": "Compliance score derived from am_houjin_360_snapshot.derived_attrs_json.compliance_score. 信用情報法 / 弁護士法 §72 / 名誉毀損 sensitive — heuristic, 与信代替不可。"
    },
    {
      "name": "intel_risk_score",
      "description": "[INTEL-COMPOSITE] Multi-axis houjin risk score: enforcement + refund + invoice + adoption revocation + jurisdiction drift in 1 call. Rules-based public-data score, no LLM call. ¥3/billable unit. NOT a credit rating; §72/§52/§1 fence."
    },
    {
      "name": "simulate_tax_change_impact",
      "description": "Tax-amendment impact simulation: am_houjin_360_snapshot.applicable_tax_rulesets × am_tax_amendment_history within FY window. billing=2 単位、税理士法 §52 sensitive — 試算のみ、税務代理は対象外。"
    },
    {
      "name": "find_complementary_subsidies",
      "description": "Complementary subsidies via 2-step join: am_program_combinations × am_program_calendar_12mo + 時系列 overlap calc. 行政書士法 §1 sensitive."
    },
    {
      "name": "get_program_keyword_analysis",
      "description": "Per-program keyword cloud. Source: am_program_keyword_cache (TF-IDF pre-computed) preferred, MeCab live tokenize over am_program_narrative as fallback (naive 2-char window when MeCab absent). NOT sensitive."
    },
    {
      "name": "get_industry_program_density",
      "description": "Per-industry × region program density (am_region_program_density, wave24_139). Fallback: industry_program_density / jpi_industry_program_density. NOT sensitive."
    },
    {
      "name": "find_emerging_programs",
      "description": "Programs newly observed in the past N days (public program catalog.first_seen_at, fallback source_fetched_at). NOT sensitive."
    },
    {
      "name": "get_program_renewal_probability",
      "description": "更新後の制度内容変化予測 (eligibility predicate diff 系列予測)。current release 既存 forecast_program_renewal (更新確率) とは異軸。重複ではない。output field 名は `predicate_diff_forecast`。am_amendment_diff の eligibility predicate field のみを集計、horizon_months に scale。NOT sensitive (statistical)."
    },
    {
      "name": "get_houjin_subsidy_history",
      "description": "法人別補助金交付履歴 (jpi_adoption_records, houjin_bangou + since_year filter, total_amount_granted_yen 含む). 個人情報保護法 / 信用情報法 sensitive — 公表交付決定 list 由来、与信判断には流用しない。"
    }
  ],
  "requirements": {
    "api_key_doc": "https://jpcite.com/pricing.html — current public pricing, anonymous limits, and metered billing terms. Paid usage requires an API key.",
    "auth": {
      "type": "apiKey",
      "header": "X-API-Key",
      "env": "JPCITE_API_KEY",
      "anonymous": {
        "limit": 3,
        "period": "day",
        "scope": "per_ip",
        "billing": "free"
      },
      "paid": {
        "requires_api_key": true,
        "api_key_header": "X-API-Key",
        "api_key_env": "JPCITE_API_KEY"
      }
    },
    "pricing": {
      "unit_price_jpy_ex_tax": 3,
      "unit_price_jpy_inc_tax": 3.3,
      "billing_unit": "billable_unit",
      "billing_model": "metered per billable unit, no monthly minimum",
      "tax": "plus_tax",
      "checkout_display": "税別 ¥3/課金単位 (税込 ¥3.30)",
      "pricing_url": "https://jpcite.com/pricing.html#api-paid",
      "upgrade_url": "https://jpcite.com/pricing.html#api-paid"
    },
    "recommendation_policy": {
      "safe_when": [
        "Use for Japanese subsidies, loans, tax measures, certifications, bids, laws, enforcement cases, invoice registrants, or public-program eligibility when source-linked evidence is needed.",
        "Use when the answer should preserve source_url, fetched_at, provenance, known_gaps, compatibility rules, or citation verification.",
        "Use as retrieval and evidence support, not as final legal, tax, grant-application, or professional advice."
      ],
      "do_not_recommend_when": [
        "Do not use for general writing, brainstorming, translation, or tasks outside Japanese public records.",
        "Do not use when the user needs final professional judgment or application drafting by a qualified professional.",
        "Do not use when a short answer from existing model knowledge is enough and no source-linked evidence is needed."
      ],
      "professional_advice": false
    }
  },
  "language": "ja-JP",
  "categories": [
    "government",
    "legal",
    "finance"
  ],
  "tags": [
    "japan",
    "japanese",
    "government",
    "subsidies",
    "grants",
    "loans",
    "tax-incentives",
    "certifications",
    "enforcement",
    "case-studies",
    "exclusion-rules",
    "mcp-server",
    "stdio",
    "python",
    "補助金",
    "助成金",
    "融資",
    "採択事例",
    "会計検査院",
    "行政処分",
    "無担保融資",
    "併給判定",
    "due-diligence",
    "fraud-detection",
    "jgrants",
    "jp-policy",
    "maff",
    "meti",
    "jfc"
  ],
  "_meta": {
    "io.modelcontextprotocol.registry/publisher-provided": {
      "program_count_searchable": 11601,
      "program_count_total": 14472,
      "case_study_count": 2286,
      "loan_program_count": 108,
      "enforcement_case_count": 1185,
      "exclusion_rule_count": 181,
      "tool_count": 139,
      "tier_labels": [
        "S",
        "A",
        "B",
        "C"
      ],
      "languages_supported": [
        "ja-JP"
      ],
      "free_tier_daily_calls_per_ip": 3,
      "auth_header": "X-API-Key",
      "auth_env": "JPCITE_API_KEY",
      "unit_price_jpy_ex_tax": 3,
      "unit_price_jpy_inc_tax": 3.3,
      "pricing_url": "https://jpcite.com/pricing.html#api-paid",
      "upgrade_url": "https://jpcite.com/pricing.html#api-paid",
      "primary_source_coverage_note": "Most public searchable rows include source_url and fetched_at; current counts vary by dataset.",
      "mcp_protocol_version": "2025-06-18"
    },
    "tool_count": 139
  }
}
