# Getting Started—Using "Query Builder"

## Contact Query Metadata Configuration

You can use the "Query Builder" in MaiAgent service to create QueryMetadata graphically. Here's an example of creating Contact Query Metadata:

### Step 1: Access the Contacts Area in MaiAgent Backend Service

<figure><img src="https://github.com/Playma-Co-Ltd/maiagent-tech-gitbook/blob/main/en/zh-tw/.gitbook/assets/%E8%9E%A2%E5%B9%95%E6%93%B7%E5%8F%96%E7%95%AB%E9%9D%A2%202025-08-07%20165727.png" alt=""><figcaption><p>Contacts Area Entry</p></figcaption></figure>

### Step 2: Configure Settings for the Desired Contact

1. Find the contact you want to configure and click edit

<figure><img src="https://github.com/Playma-Co-Ltd/maiagent-tech-gitbook/blob/main/en/zh-tw/.gitbook/assets/%E8%9E%A2%E5%B9%95%E6%93%B7%E5%8F%96%E7%95%AB%E9%9D%A2%202025-08-07%20165859.png" alt=""><figcaption><p>Contact Edit Entry</p></figcaption></figure>

2. The following screen will appear after clicking

<figure><img src="https://github.com/Playma-Co-Ltd/maiagent-tech-gitbook/blob/main/en/zh-tw/.gitbook/assets/query%20metadata%20maker.png" alt=""><figcaption><p>Query Builder Entry</p></figcaption></figure>

Click directly on Query Builder to enter the graphical interface

### Step 3: Select Desired Permissions

1. Select the knowledge bases you want to grant access to, and optionally select specific documents within those knowledge bases

<figure><img src="https://github.com/Playma-Co-Ltd/maiagent-tech-gitbook/blob/main/en/zh-tw/.gitbook/assets/%E8%9E%A2%E5%B9%95%E6%93%B7%E5%8F%96%E7%95%AB%E9%9D%A2%202025-08-07%20170306.png" alt=""><figcaption><p>Select Knowledge Base and Documents</p></figcaption></figure>

2. If you want to grant access to documents with specific tags, click "Show Tag Filter" to open the tag settings area

<figure><img src="https://github.com/Playma-Co-Ltd/maiagent-tech-gitbook/blob/main/en/zh-tw/.gitbook/assets/%E8%9E%A2%E5%B9%95%E6%93%B7%E5%8F%96%E7%95%AB%E9%9D%A2%202025-08-07%20170306-1.png" alt=""><figcaption><p>Tag Filter Settings</p></figcaption></figure>

You can choose the conditions you want to create, selecting either `"OR"` (matches any condition) or `"AND"` (matches all conditions) as the access criteria for documents in the enabled knowledge bases

## Message Settings

You can also use the right-side menu shown below to select the knowledge permissions to grant:

<figure><img src="https://github.com/Playma-Co-Ltd/maiagent-tech-gitbook/blob/main/en/zh-tw/.gitbook/assets/%E8%9E%A2%E5%B9%95%E6%93%B7%E5%8F%96%E7%95%AB%E9%9D%A2%202025-08-08%20095028.png" alt=""><figcaption><p>Internal Chat: Select Available Knowledge Permissions</p></figcaption></figure>

You can also use "Show Tag Filter" to set tag filtering conditions

{% hint style="info" %}
You can adjust permissions on the right before sending each different message to manage knowledge access
{% endhint %}

<figure><img src="https://github.com/Playma-Co-Ltd/maiagent-tech-gitbook/blob/main/en/zh-tw/.gitbook/assets/%E8%9E%A2%E5%B9%95%E6%93%B7%E5%8F%96%E7%95%AB%E9%9D%A2%202025-08-08%20124143.png" alt=""><figcaption><p>Available Documents List</p></figcaption></figure>

<figure><img src="https://github.com/Playma-Co-Ltd/maiagent-tech-gitbook/blob/main/en/zh-tw/.gitbook/assets/%E8%9E%A2%E5%B9%95%E6%93%B7%E5%8F%96%E7%95%AB%E9%9D%A2%202025-08-08%20124344.png" alt=""><figcaption><p>Selected Documents Status</p></figcaption></figure>

Currently able to reference three files: CV, SOP, and Survey

After unchecking CV in the next message and sending again:

<figure><img src="https://github.com/Playma-Co-Ltd/maiagent-tech-gitbook/blob/main/en/zh-tw/.gitbook/assets/%E8%9E%A2%E5%B9%95%E6%93%B7%E5%8F%96%E7%95%AB%E9%9D%A2%202025-08-08%20124830.png" alt=""><figcaption><p>Example of Unchecking Document</p></figcaption></figure>

The Agent can no longer use the CV file, and the reference library no longer shows CV references:

<figure><img src="https://github.com/Playma-Co-Ltd/maiagent-tech-gitbook/blob/main/en/zh-tw/.gitbook/assets/%E8%9E%A2%E5%B9%95%E6%93%B7%E5%8F%96%E7%95%AB%E9%9D%A2%202025-08-08%20124958.png" alt=""><figcaption><p>Reference Library Change: After Removing CV</p></figcaption></figure>

Permissions can be adjusted before sending each message, affecting what content can be referenced in that round of responses.
