Skip to main content
Glama
kkawailab

MLIT Data Platform MCP Server

by kkawailab

search_by_location_rectangle

Search MLIT Data Platform for infrastructure data within a specified rectangular geographic area, optionally combining with keyword terms to filter results.

Instructions

矩形範囲と交差するデータを検索する。

            使い方:
            - 指定した矩形範囲(北西緯度経度と南東緯度経度)に含まれるデータを検索します。
            - 検索語(term)を組み合わせて空間+キーワード検索も可能です。

            例:
            - 東京都内の橋梁を検索:
            term="橋梁",
            location_rectangle_top_left_lat=35.80,
            location_rectangle_top_left_lon=139.55,
            location_rectangle_bottom_right_lat=35.60,
            location_rectangle_bottom_right_lon=139.85

            - キーワードなしで矩形範囲のデータを取得:
            term="",
            location_rectangle_top_left_lat=35.7,
            location_rectangle_top_left_lon=139.6,
            location_rectangle_bottom_right_lat=35.6,
            location_rectangle_bottom_right_lon=139.7

            注意:
            - `location_rectangle_top_left_lat/lon` と `location_rectangle_bottom_right_lat/lon` の4点は必須。
            - 北西(top_left)は右下(bottom_right)よりも緯度が高く、経度が低くなるように指定。
            - termが空の場合でも矩形条件のみで検索可能。
            - phrase_match=Trueで完全一致検索。
            - size は 1回あたり最大10,000件(API制限あり)。
            - 座標は世界測地系(WGS84)を使用。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
termNo検索キーワード。位置のみで検索する場合は省略可能
firstNo検索結果の開始位置
sizeNo取得件数(最大500)
phrase_matchNoフレーズマッチモード
prefecture_codeNo都道府県コード (例: '13'=東京都, '27'=大阪府)。normalize_codesツールで正規化できます。位置検索と組み合わせて結果を絞り込めます
location_rectangle_top_left_latYes矩形範囲の左上緯度 (例: 35.6895 for 東京)
location_rectangle_top_left_lonYes矩形範囲の左上経度 (例: 139.6917 for 東京)
location_rectangle_bottom_right_latYes矩形範囲の右下緯度
location_rectangle_bottom_right_lonYes矩形範囲の右下経度

Implementation Reference

  • The handler for the 'search_by_location_rectangle' tool in 'src/server.py'. It validates input using 'SearchByRect', then invokes 'client.search_by_rectangle'.
    elif name == "search_by_location_rectangle":
        p = SearchByRect.model_validate({
            "term": arguments.get("term"),
            "first": arguments.get("first", 0),
            "size": arguments.get("size", 50),
            "phrase_match": arguments.get("phrase_match", True),
            "prefecture_code": arguments.get("prefecture_code"),
            "rectangle": {
                "top_left_lat": arguments["location_rectangle_top_left_lat"],
                "top_left_lon": arguments["location_rectangle_top_left_lon"],
                "bottom_right_lat": arguments["location_rectangle_bottom_right_lat"],
                "bottom_right_lon": arguments["location_rectangle_bottom_right_lon"],
            }
        })
        data = await client.search_by_rectangle(
            p.rectangle.top_left_lat, p.rectangle.top_left_lon,
            p.rectangle.bottom_right_lat, p.rectangle.bottom_right_lon,
            term=p.term or "",
            first=p.first,
            size=p.size,
            phrase_match=p.phrase_match,
        )
  • The 'search_by_rectangle' method in 'src/client.py' which builds the location filter and executes the GraphQL search query.
    async def search_by_rectangle(
        self, tl_lat: float, tl_lon: float, br_lat: float, br_lon: float, **kw
    ) -> Dict[str, Any]:
        loc = self.make_rectangle_filter(tl_lat, tl_lon, br_lat, br_lon)
        q = self.build_search(location_filter=loc, **kw)
        return await self.post_query(q)
  • The tool registration and schema definition for 'search_by_location_rectangle'.
    name="search_by_location_rectangle",
    description="""矩形範囲と交差するデータを検索する。
    
        使い方:
        - 指定した矩形範囲(北西緯度経度と南東緯度経度)に含まれるデータを検索します。
        - 検索語(term)を組み合わせて空間+キーワード検索も可能です。
    
        例:
        - 東京都内の橋梁を検索:
        term="橋梁",
        location_rectangle_top_left_lat=35.80,
        location_rectangle_top_left_lon=139.55,
        location_rectangle_bottom_right_lat=35.60,
        location_rectangle_bottom_right_lon=139.85
    
        - キーワードなしで矩形範囲のデータを取得:
        term="",
        location_rectangle_top_left_lat=35.7,
        location_rectangle_top_left_lon=139.6,
        location_rectangle_bottom_right_lat=35.6,
        location_rectangle_bottom_right_lon=139.7
    
        注意:
        - `location_rectangle_top_left_lat/lon` と `location_rectangle_bottom_right_lat/lon` の4点は必須。
        - 北西(top_left)は右下(bottom_right)よりも緯度が高く、経度が低くなるように指定。
        - termが空の場合でも矩形条件のみで検索可能。
        - phrase_match=Trueで完全一致検索。
        - size は 1回あたり最大10,000件(API制限あり)。
        - 座標は世界測地系(WGS84)を使用。""",
    inputSchema={
        "type": "object",
        "properties": {
            "term": {
                "type": "string",
                "description": "検索キーワード。位置のみで検索する場合は省略可能"
            },
            "first": {
                "type": "integer",
                "default": 0,
                "description": "検索結果の開始位置"
            },
            "size": {
                "type": "integer",
                "default": 50,
                "description": "取得件数(最大500)"
            },
            "phrase_match": {
                "type": "boolean",
                "default": True,
                "description": "フレーズマッチモード"
            },
            "prefecture_code": {
                "type": "string",
                "description": "都道府県コード (例: '13'=東京都, '27'=大阪府)。normalize_codesツールで正規化できます。位置検索と組み合わせて結果を絞り込めます"
            },
            "location_rectangle_top_left_lat": {
                "type": "number",
                "description": "矩形範囲の左上緯度 (例: 35.6895 for 東京)"
            },
            "location_rectangle_top_left_lon": {
                "type": "number",
                "description": "矩形範囲の左上経度 (例: 139.6917 for 東京)"
            },
            "location_rectangle_bottom_right_lat": {
                "type": "number",
                "description": "矩形範囲の右下緯度"
            },
            "location_rectangle_bottom_right_lon": {
                "type": "number",
                "description": "矩形範囲の右下経度"
            },
        },
        "required": [
            "location_rectangle_top_left_lat",
            "location_rectangle_top_left_lon",
            "location_rectangle_bottom_right_lat",
            "location_rectangle_bottom_right_lon",
        ],
    },
Behavior4/5

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

With no annotations provided, the description carries full behavioral disclosure burden effectively. It specifies the coordinate system (WGS84), clarifies intersection logic (交差/intersecting vs containing), notes rate limits (10,000 items), and explains coordinate ordering constraints (NW must have higher latitude than SE).

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

Conciseness4/5

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

Well-structured with clear visual hierarchy: purpose statement → usage guide → concrete examples → notes/cautions. The examples, while lengthy, provide essential concrete values. The warning about coordinate ordering is appropriately prominent. Slightly verbose but justified by the 9-parameter complexity.

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?

Given 9 parameters, no annotations, and no output schema, the description provides comprehensive coverage of input requirements, constraints, and usage patterns. It lacks description of return values, but without an output schema provided in the system, this is acceptable. The cross-reference to normalize_codes demonstrates awareness of the broader tool ecosystem.

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

Parameters3/5

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

Schema coverage is 100% so baseline is 3. The description adds concrete example values (35.80, 139.55) and coordinate ordering constraints not in the schema. However, it contradicts the schema regarding the 'size' parameter limit (description states max 10,000; schema states max 500), creating potential confusion for the agent.

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 searches for data intersecting with a rectangular range ('矩形範囲と交差するデータを検索する'). It uses a specific verb (検索/search) and resource (data by rectangle), and distinguishes itself from siblings like search_by_location_point_distance (radius) and search_by_attribute through its focus on bounding box coordinates.

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?

Provides explicit usage patterns under '使い方' with concrete examples showing both spatial+keyword and spatial-only searches. Notably references sibling tool normalize_codes for prefecture_code normalization ('normalize_codesツールで正規化できます'), giving clear cross-tool guidance. Would score 5 if it explicitly contrasted when to use radius search (search_by_location_point_distance) versus this rectangle search.

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