Skip to main content
Glama
kkawailab

MLIT Data Platform MCP Server

by kkawailab

get_file_download_urls

Generate time-limited download URLs for files from Japan's MLIT Data Platform, either by specifying file IDs directly or by providing dataset and data IDs for bulk URL creation.

Instructions

ファイルのダウンロード用URLを取得する。取得したURLがhttps://www.mlit-data.jp/download/で始まる場合、URLの有効期限は60秒。

            使い方:
            - 事前に search / data API で対象データの `files`(id, original_path)を取得してから、本APIでダウンロードURLを生成します。
            - 本ツールは2通りに対応:
            (A) `files=[{id, original_path}, ...]` を直接渡す
            (B) `dataset_id` と `data_id` を渡す(ツール側で対象データの `files` を読み取り、一括でURL化)

            例:
            - 単一ファイルのURLを取得(直接指定):
            files=[{ id:"<filesのid>", original_path:"INDEX_C.XML" }]

            - データIDから付属ファイルのURL一覧を取得(簡易):
            dataset_id="cals_construction", data_id="<searchで取得したid>"

            注意:
            - `id` と `original_path` は、まず search / data のレスポンスに含まれる `DataClass.files` から取得してください。
            - 取得したURLが `https://www.mlit-data.jp/download/` で始まる場合、**60秒以内にダウンロード開始**が必要です(期限切れに注意)。
            - 連携元サイトで直接ダウンロードできる場合は、メタデータ `DPF:downloadURLs` / `DPF:dataURLs` も併用してください。
            - `original_path` を省略すると、付属ファイルの元ファイル名・パスが用いられます(files.original_pathを参照)。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filesNoダウンロードするファイルの配列。dataset_id+data_idを指定する場合は省略可能
dataset_idNoデータセットID。filesを省略する場合は必須
data_idNoデータID。filesを省略する場合は必須

Implementation Reference

  • Tool handler logic in server.py calling client.file_download_urls or client.file_download_urls_from_data.
    elif name == "get_file_download_urls":
        p = FileDownloadURLsInput.model_validate(arguments)
        if p.files:
            files = [FileRef(id=f.id, original_path=f.original_path) for f in p.files]
            data = await client.file_download_urls(files=files)
        else:
            data = await client.file_download_urls_from_data(
                dataset_id=str(p.dataset_id), data_id=str(p.data_id)  # type: ignore
            )
  • High-level client methods to retrieve file download URLs, including fetching files from data ID.
    async def file_download_urls(self, *, files: List[FileRef]) -> Dict[str, Any]:
        if not files:
            return {"fileDownloadURLs": []}
        q = self.build_file_download_urls(files=files)
        return await self.post_query(q)
    
    async def file_download_urls_from_data(self, *, dataset_id: str, data_id: str) -> Dict[str, Any]:
        files = await self.get_data_files(dataset_id=dataset_id, data_id=data_id)
        if not files:
            return {"fileDownloadURLs": []}
        return await self.file_download_urls(files=files)
  • Helper method to build the GraphQL query for file download URLs.
    # ----- FILE DOWNLOAD URLs -----
    def build_file_download_urls(self, *, files: List[FileRef]) -> str:
        def q(s: str) -> str:
            return '"' + s.replace('"', '\\"') + '"'
        items = ", ".join(
            "{ id: " + q(f.id) + ", original_path: " + q(f.original_path) + " }" for f in files
        )
        return f"""
        query {{
          fileDownloadURLs(files: [{items}]) {{
            ID
            URL
          }}
        }}
        """.strip()
Behavior4/5

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

No annotations provided, so description carries full burden. Discloses critical behavioral trait: URLs starting with specific domain have 60-second expiration ('60秒以内にダウンロード開始が必要'). Explains default behavior when original_path is omitted. Missing: error handling details, auth requirements, and exact return structure (though no output schema exists).

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 patterns → examples → warnings. Front-loaded with core function. Lengthy but justified by complexity (two usage modes, time constraints, prerequisites). Minor deduction for slightly verbose Japanese prose style, but 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?

Comprehensive coverage of prerequisites, temporal constraints (60s expiration), and parameter interactions for a 3-parameter tool with complex conditional logic. Lacks description of return value structure (expected since no output schema provided) and error scenarios. Sufficient for safe invocation but could note rate limiting or failure modes.

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?

Schema has 100% coverage (baseline 3). Description adds substantial value: concrete JSON syntax examples for files parameter, explanation of the XOR relationship between files vs dataset_id/data_id, and data lineage guidance ('search / data のレスポンスに含まれる DataClass.files から取得'). Compensates for schema's lack of conditional validation.

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?

Opens with specific verb-resource pair 'ファイルのダウンロード用URLを取得する' (Get file download URLs). The description clearly distinguishes this from sibling get_zipfile_download_url through its focus on individual file arrays versus zip archives, and explains the dual input patterns (direct files array vs dataset/data_id lookup).

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

Usage Guidelines5/5

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

Contains explicit '使い方' (Usage) section stating prerequisites ('事前に search / data API で...取得してから'), describes two mutually exclusive usage patterns (A) and (B), and notes alternatives ('連携元サイトで直接ダウンロードできる場合は...DPF:downloadURLs...を併用'). Clearly defines when to use each parameter combination.

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