Skip to main content
Glama
kkawailab

MLIT Data Platform MCP Server

by kkawailab

search_by_attribute

Search MLIT Data Platform metadata using specific attributes like catalog name, dataset ID, prefecture code, or municipality to find relevant datasets with optional keyword refinement.

Instructions

メタデータ項目を用いて検索する。例えば、カタログ名、データセット名、都道府県、市区町村等を設定して検索することが可能。 属性フィルタで検索(GraphQL公式形のみ): attributeFilter { attributeName: "DPF:...", is: }。operatorは常に is。

            使い方:
            - 属性(attribute_name)と値(attribute_value)を指定してメタデータ検索を行う。
            - キーワード(term)を併用して、より細かい条件指定も可能。

            例:
            - 特定データセット内の検索:
            attribute_name="DPF:dataset_id", attribute_value="mlit-001", term="橋梁"

            - 東京都に属するデータ:
            attribute_name="DPF:prefecture_code", attribute_value="13"

            - データカタログ単位で検索:
            attribute_name="DPF:catalog_id", attribute_value="mlit-cat-001", term=""

            注意:
            - attribute_name には DPF:prefix を含む正式属性名を指定してください(例: "DPF:dataset_id")。
            - attribute_value の型は文字列または数値。operator は常に "is" 固定。
            - term="" の場合でも属性条件のみで検索可能。
            - minimal=True を指定すると軽量レスポンスになります。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
termNo検索キーワード。属性のみで検索する場合は空文字列""または省略可能
firstNo検索結果の開始位置
sizeNo取得件数(最大500)
phrase_matchNoフレーズマッチモード
attribute_nameYes属性名(必須)。ネームスペースプレフィックス付き。 例: - DPF:dataset_id (データセットID) - DPF:prefecture_code (都道府県コード) - DPF:municipality_code (市区町村コード) - DPF:year (年度) - DPF:catalog_id (カタログID) - RSDB:tenken.nendo (点検年度 - 道路施設) - PLATEAU:... (PLATEAU関連属性) プレフィックスがない場合、一般的な属性には自動的にDPF:が追加されます
attribute_valueYes属性値(必須)。'is'オペレータで完全一致検索します。 例: - dataset_id: 'mlit-plateau-2023' - prefecture_code: '13' (東京都) - year: '2023' - municipality_code: '13101' (千代田区) 数値コードの場合、normalize_codesで正規化してから使用することを推奨
minimalNo最小限のフィールドのみ返す

Implementation Reference

  • The raw implementation of searching by attribute, which builds a GraphQL query with an attribute filter.
    async def search_by_attribute_raw(
        self,
        *,
        term: Optional[str] = None,
        first: int = 0,
        size: int = 20,
        phrase_match: bool = True,
        attribute_name: str,
        attribute_value: Any,
        fields: Optional[str] = None,
    ) -> Dict[str, Any]:
        af = self.make_single_attribute_filter(attribute_name, attribute_value)
        effective_term = term if term is not None else "" 
        q = self.build_search(
            term=effective_term,
            first=first,
            size=size,
            phrase_match=phrase_match,
            attribute_filter=af,
            fields=fields or self._fields_basic(),
        )
        return await self.post_query(q)
  • Registration/handler logic for the search_by_attribute tool within the server's call_tool function.
    elif name == "search_by_attribute":
        # GraphQL (attribute_name + attribute_value; operator is)
        p = SearchByAttr.model_validate(arguments)
        fields = None if not p.minimal else client._fields_min()
        data = await client.search_by_attribute_raw(
            term=p.term,
            first=p.first,
            size=p.size,
            phrase_match=p.phrase_match,
            attribute_name=p.attribute_name,
            attribute_value=p.attribute_value,
            fields=fields,
        )
  • Tool definition and input schema for search_by_attribute, including descriptions and usage examples.
    name="search_by_attribute",
    description="""メタデータ項目を用いて検索する。例えば、カタログ名、データセット名、都道府県、市区町村等を設定して検索することが可能。
        属性フィルタで検索(GraphQL公式形のみ): attributeFilter { attributeName: "DPF:...", is: <value> }。operatorは常に is。
    
        使い方:
        - 属性(attribute_name)と値(attribute_value)を指定してメタデータ検索を行う。
        - キーワード(term)を併用して、より細かい条件指定も可能。
    
        例:
        - 特定データセット内の検索:
        attribute_name="DPF:dataset_id", attribute_value="mlit-001", term="橋梁"
    
        - 東京都に属するデータ:
        attribute_name="DPF:prefecture_code", attribute_value="13"
    
        - データカタログ単位で検索:
        attribute_name="DPF:catalog_id", attribute_value="mlit-cat-001", term=""
    
        注意:
        - attribute_name には DPF:prefix を含む正式属性名を指定してください(例: "DPF:dataset_id")。
        - attribute_value の型は文字列または数値。operator は常に "is" 固定。
        - term="" の場合でも属性条件のみで検索可能。
        - minimal=True を指定すると軽量レスポンスになります。""",
Behavior3/5

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

No annotations provided, so description carries full burden. Discloses that operator is always 'is' (fixed), term can be empty for attribute-only search, and minimal=True produces lightweight responses. However, missing safety profile (read-only nature), rate limits, error conditions, or return value structure details expected for a search tool without annotation hints.

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-organized with clear sections: overview, GraphQL syntax note, usage guidelines, examples, and cautions. Japanese text is appropriately detailed for the complexity of DPF namespace requirements. Minor verbosity in example formatting is acceptable for clarity. No redundant sentences.

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

Completeness3/5

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

With 7 parameters and no output schema, the description comprehensively covers input requirements and usage patterns but omits description of return values, result structure, or pagination behavior (beyond schema definitions of first/size). For a search tool lacking both annotations and output schema, it should describe what gets returned to achieve higher completeness.

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 schema has 100% coverage with detailed descriptions, the description adds valuable semantic context including concrete examples ('mlit-001', '13' for Tokyo, '13101' for Chiyoda) and explicit usage patterns for attribute_name/value pairs. This helps agents understand valid value formats beyond schema syntax.

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?

Description clearly states the tool searches using metadata items (catalog names, dataset names, prefectures, municipalities) with specific examples. It effectively distinguishes from siblings like generic 'search' and location-based tools by emphasizing structured attribute filtering (DPF: prefixes) rather than keywords or 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?

Contains explicit '使い方' (Usage) section explaining to specify attribute_name/value pairs and that term keyword can be combined for finer conditions. Provides three concrete use-case examples (dataset-specific, prefecture-specific, catalog-specific). Lacks explicit 'when not to use' comparisons to sibling tools, but positive guidance is comprehensive.

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