> For the complete documentation index, see [llms.txt](https://docs.maiagent.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.maiagent.ai/tech/maiagent-tech-ja/authorization-integration/zhi-shi-guan-li-quan-xian-query-metadata-cha-xun-yuan-zi-liao-zong-lan.md).

# ナレッジ管理権限（Query Metadata／クエリメタデータ）概要

## 機能説明

AI 対話システムを導入する際、ユーザーの権限や利用ニーズが異なるため、通常「ナレッジベース / AI アシスタント / 対話プラットフォーム」の利用可能範囲をきめ細かく制御する必要があります。

MaiAgent では、対話 / 身分のレベルごとに付加された Query Metadata を活用して、「この人 / この対話がどのコンテンツを参照できるか」を決定できます。

### Query Metadata /「クエリメタデータ」とは？

Query Metadata は、クエリ範囲を限定する一連の動的な条件であり、あるユーザーが特定の対話プラットフォーム上でクエリできる「ナレッジベース、FAQ、タグ条件に合致する文書」などのデータ内容を指定できます。

これは役割（Role）や連絡先（Contact）を置き換えるものではなく、これらの身分を「条件付きで機能させる」ものであり、対話レベルでの最小権限制御を実現します。

> **役割 / 連絡先 / 対話はコンテナであり、Query Metadata は可視範囲を実際に制御する条件制限の設定です**

{% hint style="info" %}
以下の記事の説明から、さらに詳しく学べます：

* [**連絡先 ( Contact ) の連携手順**](/tech/maiagent-tech-ja/authorization-integration/contacts.md)
* [**役割 ( Role ) と 連絡先 ( Contact ) の違い**](/tech/maiagent-tech-ja/authorization-integration/role-vs-contact.md)
  {% endhint %}

## 権限レベルの概念

サービスを構築する前に、Agent はさまざまなレベルの Query Metadata を通じて、その時点で参照可能なすべてのナレッジベースを確認します。権限レベルの参照順序は以下のとおりです：

```
AI 助理 > 對話平台 > 使用者 ( Ｍessage / Contact / Role ) > query_metadata > 查詢權限
```

各レベルにおいて、グラフィカルインターフェースまたは JSON 形式で権限を指定できます。

> 以下の文書を参照して操作してください：
>
> 1. [グラフィカルインターフェース操作ガイド(連絡先、社内 Q\&A 設定)](/tech/maiagent-tech-ja/authorization-integration/zhi-shi-guan-li-quan-xian-query-metadata-cha-xun-yuan-zi-liao-zong-lan/graphical-interface.md)
> 2. [JSON インターフェース設定ガイド(連絡先、Web chat 埋め込み設定)](/tech/maiagent-tech-ja/authorization-integration/zhi-shi-guan-li-quan-xian-query-metadata-cha-xun-yuan-zi-liao-zong-lan/json-interfaces.md)

```mermaid
flowchart TB
  subgraph 身分層
    Message --> Identity[身份資訊]
    Contact --> Identity
    Role --> Identity
  end

  subgraph 查詢條件層
    Identity --> QM[query_metadata 條件]
    QM --> KB[知識庫]
    QM --> Chatbot_file[檔案文件]
    QM --> FAQ[問答集]
    QM --> Label[標籤]

    KB --> Filter1[篩選可用知識庫]
    Chatbot_file --> Filter2[篩選可用檔案文件]
    FAQ --> Filter3[篩選可用 FAQ]
    Label --> Filter4[篩選標籤條件]
  end

  subgraph 回答層
    Filter1 --> Chatbot[AI 助理回答內容]
    Filter2 --> Chatbot
    Filter3 --> Chatbot
    Filter4 --> Chatbot
  end
```

* Contact / Role は身分のコンテナです
* Message に対応するのは、社内対話を行う際に、フィルタリングを通じて対話で使用されるナレッジベースを制御できるものです
* `query_metadata` は対話時に実際に実行される「フィルタリング条件の集合」です

### 文書フィルタリング条件の判定レベル

<figure><img src="/files/OwlndTah8hRVf5Z9VWkz" alt=""><figcaption><p>文書フィルタリング条件レベルの概念図</p></figcaption></figure>

公開されるフィルタリングロジックは以下のとおりです：

```mermaid
flowchart TB
    %% 知識庫層級
    KB["知識庫"]
    
    %% 文件層級
    Docs["知識庫下的文件"]
    
    %% 標籤篩選層級
    Tags["依標籤從已開放的文件篩選出開放的文件"]
    
    %% 最終結果
    Result["最終開放的文件"]
    
    %% 連接關係
    KB --> Docs
    Docs --> Tags
    Tags --> Result
    
    %% 樣式設定
    classDef kbBox fill:#e3f2fd,stroke:#1976d2,stroke-width:2px,color:#000000
    classDef docBox fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px,color:#000000
    classDef tagBox fill:#e8f5e8,stroke:#388e3c,stroke-width:2px,color:#000000
    classDef resultBox fill:#fff3e0,stroke:#f57c00,stroke-width:2px,color:#000000
    
    class KB kbBox
    class Docs docBox
    class Tags tagBox
    class Result resultBox
```

このように段階的に受け渡されることで、Query Metadata は AI 応答ロジックにおける実際の意思決定の根拠となります。

## 実際の活用シナリオ

<table><thead><tr><th width="162.5028076171875">身分</th><th>渡される条件（query_metadata）</th><th>応答結果</th></tr></thead><tbody><tr><td>訪問者</td><td>ナレッジベース：<code>一般</code><br>ファイル文書：なし<br>タグ：<code>訪問者</code><br>FAQ：<code>1</code>、<code>2</code></td><td><code>一般</code> ナレッジベース内の <code>訪問者</code> タグを含む文書および FAQ <code>1</code>、FAQ <code>2</code> を取得</td></tr><tr><td>一般メンバー</td><td>ナレッジベース：<code>一般</code><br>ファイル文書：<code>A</code>、<code>B</code>、<code>C</code><br>タグ：なし<br>FAQ：なし</td><td><code>一般</code> ナレッジベース内の <code>A</code>、<code>B</code>、<code>C</code> 文書とすべての FAQ を取得</td></tr><tr><td>カスタマーサポート担当者</td><td>ナレッジベース：<code>従業員</code><br>ファイル文書：なし<br>タグ：<code>カスタマーサポート</code><br>FAQ：なし</td><td><code>従業員</code> ナレッジベース内で <code>カスタマーサポート</code> タグが付与された文書とすべての FAQ を取得</td></tr><tr><td>社内従業員</td><td>ナレッジベース：<code>従業員</code><br>ファイル文書：<code>A</code>、<code>B</code><br>タグ：なし<br>FAQ：なし</td><td><code>従業員</code> ナレッジベース内の <code>A</code>、<code>B</code> 文書とすべての FAQ を取得</td></tr><tr><td>管理者</td><td>ナレッジベース：<code>従業員</code>、<code>一般</code><br>ファイル文書：なし<br>タグ：なし<br>FAQ：なし</td><td><code>従業員</code> と <code>一般</code> ナレッジベース内のすべての文書内容および FAQ を取得</td></tr></tbody></table>

***

## まとめ：企業が query\_metadata を利用する価値

🎯 **多次元の身分クロス制御**（役割＋地域＋製品ライン）

🎯 **リアルタイムなクエリ制御**：アシスタントを複製する必要はなく、条件を変更するだけでシーンの切り替えに対応できます

🎯 **大規模ナレッジベースの柔軟な管理**：タグとナレッジベースはシーンに応じて分割・権限付与が可能です

> **query\_metadata を製品アーキテクチャの中核に組み込むことを推奨します。これにより、企業は最小限の設定で最大限の権限の柔軟性を実現でき、**\
> **ナレッジの安全性を確保しつつ、対話体験と運用効率を同時に向上させます。**


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.maiagent.ai/tech/maiagent-tech-ja/authorization-integration/zhi-shi-guan-li-quan-xian-query-metadata-cha-xun-yuan-zi-liao-zong-lan.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
