search
Search Japan's MLIT Data Platform using keywords with options for phrase matching, result sorting, pagination, and field selection.
Instructions
キーワードを使って検索する。検索結果の並べ替えや取得件数を設定することも可能。
使い方:
- キーワード検索(同義語も対象): term="橋梁"
- 完全一致で絞り込み: term="橋梁", phrase_match=True
- ページング取得: first=0, size=50 ※APIの上限は一度に最大10,000件
- 並べ替え: sort_attribute_name="DPF:updated_at", sort_order="dsc"(降順)/ "asc"(昇順)
- 軽量レスポンス: minimal=True(主要フィールドのみ取得)
例:
- バス停を検索: term="バス停"
- 橋梁を新しい更新順で取得: term="橋梁", sort_attribute_name="DPF:updated_at", sort_order="dsc"
- ページ2相当を取得: term="道路", first=50, size=50
注意:
- API仕様上、term=""(空文字)でも検索は可能ですが、空間条件(矩形/円)やメタデータ条件を使った絞り込みは本ツールでは扱いません。
空間検索は「search_by_location_rectangle / search_by_location_point_distance」、
メタデータ検索は「search_by_attribute」を利用してください。
- sort_order は "asc" または "dsc" を指定してください。
- 大量件数を扱う場合はページング(first/size)を利用してください。Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| term | No | 検索キーワード。属性フィルタ(prefecture_code等)のみで検索する場合は空文字列""を設定してください | |
| first | No | 検索結果の開始位置(オフセット)。ページネーションに使用 | |
| size | No | 取得件数(最大500)。大量データの場合はget_all_dataを使用してください | |
| sort_attribute_name | No | ソート属性名 (例: 'DPF:year', 'DPF:title') | |
| sort_order | No | ソート順序: 'asc'(昇順) または 'dsc'(降順) | |
| phrase_match | No | フレーズマッチ。true=完全一致優先, false=部分一致 | |
| minimal | No | 最小限のフィールドのみ返す(id, title, lat, lon, dataset_id) |
Implementation Reference
- src/server.py:1234-1244 (handler)The "search" tool handler logic, which validates input parameters and calls `client.search_keyword`.
if name == "search": p = SearchBase.model_validate(arguments) data = await client.search_keyword( term=p.term or "", first=p.first, size=p.size, phrase_match=p.phrase_match, sort_attribute_name=p.sort_attribute_name, sort_order=p.sort_order, fields=client._fields_min() if p.minimal else client._fields_basic(), ) - src/server.py:51-110 (registration)The definition and registration of the "search" tool in the `handle_list_tools` function.
types.Tool( name="search", description="""キーワードを使って検索する。検索結果の並べ替えや取得件数を設定することも可能。 使い方: - キーワード検索(同義語も対象): term="橋梁" - 完全一致で絞り込み: term="橋梁", phrase_match=True - ページング取得: first=0, size=50 ※APIの上限は一度に最大10,000件 - 並べ替え: sort_attribute_name="DPF:updated_at", sort_order="dsc"(降順)/ "asc"(昇順) - 軽量レスポンス: minimal=True(主要フィールドのみ取得) 例: - バス停を検索: term="バス停" - 橋梁を新しい更新順で取得: term="橋梁", sort_attribute_name="DPF:updated_at", sort_order="dsc" - ページ2相当を取得: term="道路", first=50, size=50 注意: - API仕様上、term=""(空文字)でも検索は可能ですが、空間条件(矩形/円)やメタデータ条件を使った絞り込みは本ツールでは扱いません。 空間検索は「search_by_location_rectangle / search_by_location_point_distance」、 メタデータ検索は「search_by_attribute」を利用してください。 - sort_order は "asc" または "dsc" を指定してください。 - 大量件数を扱う場合はページング(first/size)を利用してください。""", inputSchema={ "type": "object", "properties": { "term": { "type": "string", "description": "検索キーワード。属性フィルタ(prefecture_code等)のみで検索する場合は空文字列\"\"を設定してください" }, "first": { "type": "integer", "default": 0, "description": "検索結果の開始位置(オフセット)。ページネーションに使用" }, "size": { "type": "integer", "default": 50, "description": "取得件数(最大500)。大量データの場合はget_all_dataを使用してください" }, "sort_attribute_name": { "type": "string", "description": "ソート属性名 (例: 'DPF:year', 'DPF:title')" }, "sort_order": { "type": "string", "description": "ソート順序: 'asc'(昇順) または 'dsc'(降順)" }, "phrase_match": { "type": "boolean", "default": True, "description": "フレーズマッチ。true=完全一致優先, false=部分一致" }, "minimal": { "type": "boolean", "default": False, "description": "最小限のフィールドのみ返す(id, title, lat, lon, dataset_id)" }, }, }, ),