Skip to main content
Glama
kkawailab

MLIT Data Platform MCP Server

by kkawailab

get_suggest

Generate keyword suggestions for data searches on Japan's MLIT Data Platform by entering partial terms, with options to filter by location, catalog, or dataset.

Instructions

キーワード検索の候補を表示する。

            使い方:
            - 入力中の文字列(term)から、上位のキーワード候補を返します。候補は `name`(候補語)と `cnt`(該当件数)を含みます。
            - 完全一致寄りにしたい場合は phrase_match=True を指定します。
            - カタログ/データセット等で範囲を絞って候補を出すことも可能です(search と同様に attributeFilter 相当を利用)。

            例:
            - 単純サジェスト(全データ対象):
            term="川", phrase_match=True
            → 上位候補(例: "川河川", "河川", ...)が name/cnt で返る。

            - 特定データセット内でのサジェスト:
            term="川", phrase_match=True, dataset_id="cals_construction"

            - カタログ単位でのサジェスト:
            term="橋", catalog_id="dimaps"

            注意:
            - term は必須です(空文字は不可)。
            - 本APIは GraphQL `suggest(term, phraseMatch, attributeFilter?)` を使用します。属性での絞り込みは
            本ツールの引数(catalog_id / dataset_id / prefecture_code / municipality_code / address)を
            内部で attributeFilter にマッピングして行います。
            - 返却される候補は name と cnt を含む配列です(例は公式サンプル参照)。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
termYes検索キーワードの一部。例: 'バス' → 'バス停', 'バスロケ' などを提案
phrase_matchNoフレーズマッチモード
prefecture_codeNo都道府県コードで絞り込み
municipality_codeNo市区町村コードで絞り込み
addressNo住所で絞り込み
catalog_idNoカタログIDで絞り込み
dataset_idNoデータセットIDで絞り込み
location_rectangle_top_left_latNo矩形範囲の左上緯度
location_rectangle_top_left_lonNo矩形範囲の左上経度
location_rectangle_bottom_right_latNo矩形範囲の右下緯度
location_rectangle_bottom_right_lonNo矩形範囲の右下経度

Implementation Reference

  • The `get_suggest` tool handler in `src/server.py` processes the request, normalizes arguments using `_auto_normalize_region_args`, and calls `client.suggest(p)`.
    elif name == "get_suggest":
        arguments = await _auto_normalize_region_args(arguments, client)
        p = SuggestInput.model_validate(arguments)
        data = await client.suggest(p)
  • The `MLITClient.suggest` method in `src/client.py` constructs the suggest query using helper methods and sends it to the GraphQL API via `post_query`.
    async def suggest(self, params: SuggestInput) -> Dict[str, Any]:
        attr_filter = self.make_attribute_filter_for_countdata(
            prefecture_code=params.prefecture_code,
            municipality_code=params.municipality_code,
            address=params.address,
            catalog_id=params.catalog_id,
            dataset_id=params.dataset_id,
        )
    
        loc_filter = None
        if all(v is not None for v in [
            params.location_rectangle_top_left_lat,
            params.location_rectangle_top_left_lon,
            params.location_rectangle_bottom_right_lat,
            params.location_rectangle_bottom_right_lon
        ]):
            loc_filter = self.make_rectangle_filter(
                float(params.location_rectangle_top_left_lat),   # type: ignore
                float(params.location_rectangle_top_left_lon),   # type: ignore
                float(params.location_rectangle_bottom_right_lat),  # type: ignore
                float(params.location_rectangle_bottom_right_lon),  # type: ignore
            )
    
        q = self.build_suggest(
            term=params.term,
            phrase_match=params.phrase_match,
            attribute_filter=attr_filter,
            location_filter=loc_filter,
        )
        return await self.post_query(q)
  • The `MLITClient.build_suggest` method in `src/client.py` constructs the raw GraphQL query string for the suggest API.
    def build_suggest(
        self,
        *,
        term: str,
        phrase_match: Optional[bool] = None,
        attribute_filter: Optional[str] = None,
        location_filter: Optional[str] = None,
    ) -> str:
        parts: List[str] = []
    
        def q(s: str) -> str:
            return '"' + s.replace('"', '\\"') + '"'
    
        parts.append(f"term: {q(term)}")
        if phrase_match is not None:
            parts.append(f'phraseMatch: {"true" if phrase_match else "false"}')
        if location_filter:
            parts.append(f"locationFilter: {location_filter}")
        if attribute_filter:
            parts.append(f"attributeFilter: {attribute_filter}")
    
        return f"""
        query {{
          suggest({", ".join(parts)}) {{
            totalNumber
            suggestions {{
              name
              cnt
            }}
          }}
        }}
        """.strip()
Behavior4/5

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

With no annotations provided, the description carries the full burden. It discloses the return format (array containing name and cnt fields), explains the internal GraphQL implementation ('GraphQL suggest(term, phraseMatch, attributeFilter?) を使用'), and notes critical constraints (term is required, empty strings invalid).

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

Conciseness5/5

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

Excellent structure with clear section headers (使い方, 例, 注意). Information is front-loaded with the core purpose, followed by usage patterns, concrete examples, and caveats. No redundant text; every sentence provides actionable guidance.

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

Completeness4/5

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

For an 11-parameter tool without an output schema, the description is comprehensive. It explains the return data structure (name/cnt array), provides multiple usage scenarios covering different parameter combinations, and documents the internal API mechanism. Missing only minor details like rate limits or auth requirements.

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

Parameters4/5

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

While the schema has 100% description coverage (baseline 3), the description adds significant semantic value by explaining that phrase_match adjusts matching toward exact matches, and clarifying that filtering parameters are internally mapped to an attributeFilter structure. This context aids proper parameter combination.

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

Purpose5/5

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

The description clearly states the tool 'キーワード検索の候補を表示する' (displays keyword search candidates/suggestions). It effectively distinguishes this from sibling search tools (search, search_by_attribute, etc.) by emphasizing autocomplete/suggestion functionality versus full record retrieval.

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

Usage Guidelines4/5

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

The '使い方' section provides clear guidance on when to use phrase_match for exact-match preferences and how to apply filters (catalog_id, dataset_id). It references the relationship to search operations ('search と同様に'), though it could more explicitly state when to choose this over the main search tools.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

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

curl -X GET 'https://glama.ai/api/mcp/v1/servers/kkawailab/kklab-mlit-dpf-mcp'

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