> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dify.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 外部データツール

> このドキュメントは AI によって自動翻訳されています。不正確な部分がある場合は、[英語版](/en/cloud/use-dify/workspace/api-extension/external-data-tool-api-extension) を参照してください。

AI アプリケーションを作成する際、開発者は [カスタム API](/ja/cloud/use-dify/workspace/api-extension/api-extension) を通じて外部ツールを使用して追加データを取得し、それを Prompt に組み込んで LLM の追加情報として使用できます。

## 拡張ポイント

`app.external_data_tool.query`：アプリケーション外部データツールクエリ拡張ポイント。

この拡張ポイントは、エンドユーザーが入力したアプリケーション変数の内容と会話入力内容（会話型アプリケーションの固定パラメータ）をパラメータとして API に渡します。

開発者は対応するツールのクエリロジックを実装し、文字列型のクエリ結果を返す必要があります。

### Request Body

```
{
    "point": "app.external_data_tool.query", // 拡張ポイントタイプ、ここでは app.external_data_tool.query に固定
    "params": {
        "app_id": string,  // アプリケーション ID
        "tool_variable": string,  // 外部データツール変数名、対応する変数ツール呼び出しのソースを示す
        "inputs": {  // エンドユーザーが渡した変数値、key は変数名、value は変数値
            "var_1": "value_1",
            "var_2": "value_2",
            ...
        },
        "query": string | null  // エンドユーザーの現在の会話入力内容、会話型アプリケーションの固定パラメータ。
    }
}
```

**例**：

```
{
    "point": "app.external_data_tool.query",
    "params": {
        "app_id": "61248ab4-1125-45be-ae32-0ce91334d021",
        "tool_variable": "weather_retrieve",
        "inputs": {
            "location": "London"
        },
        "query": "How's the weather today?"
    }
}
```

### API レスポンス

```
{
    "result": string
}
```

**例**：

```
{
    "result": "City: London\nTemperature: 10°C\nRealFeel®: 8°C\nAir Quality: Poor\nWind Direction: ENE\nWind Speed: 8 km/h\nWind Gusts: 14 km/h\nPrecipitation: Light rain"
}
```
