# 工具與連接器

### 建立工具 <a href="#undefined" id="undefined"></a>

POST `/api/tools/`

#### 請求內容

**請求參數**

| 欄位                  | 類型           | 必填 | 說明                                                                    |
| ------------------- | ------------ | -- | --------------------------------------------------------------------- |
| name                | string       | 否  | 工具名稱只能包含英文字母、數字、底線(\_)和連字符(-)。MCP 類型工具不需要此欄位，此欄位將用於 API 類型工具給 LLM 使用。 |
| displayName         | string       | 是  | 可包含任何字符的名稱，供使用者設定使用和管理。                                               |
| description         | string       | 否  | 給用戶展示的工具描述。MCP 類型工具不需要此欄位。                                            |
| prompt              | string       | 否  | 給 LLM 使用的工具描述/提示詞。若為空，系統將使用 description 欄位。MCP 類型工具不需要此欄位。            |
| toolType            | object       | 否  |                                                                       |
| apiUrl              | string (uri) | 否  |                                                                       |
| httpMethod          | object       | 否  |                                                                       |
| rawHeaders          | object       | 否  |                                                                       |
| rawParametersSchema | object       | 否  |                                                                       |
| functionCode        | string       | 否  |                                                                       |
| mcpUrl              | string       | 否  |                                                                       |
| mcpAllowedTools     | object       | 否  |                                                                       |
| rawMcpHeader        | object       | 否  | 當 Contact 沒有對應的 MCP Credential 時，將使用此預設標頭                             |

**請求結構範例**

```typescript
{
  "name"?: string // 工具名稱只能包含英文字母、數字、底線(_)和連字符(-)。MCP 類型工具不需要此欄位，此欄位將用於 API 類型工具給 LLM 使用。 (非必填)
  "displayName": string // 可包含任何字符的名稱，供使用者設定使用和管理。
  "description"?: string // 給用戶展示的工具描述。MCP 類型工具不需要此欄位。 (非必填)
  "prompt"?: string // 給 LLM 使用的工具描述/提示詞。若為空，系統將使用 description 欄位。MCP 類型工具不需要此欄位。 (非必填)
  "toolType"?:  // 非必填
  {
  }
  "apiUrl"?: string (uri) // 非必填
  "httpMethod"?: // 可能有不同的類型 (非必填)
  string (enum: get, post, put, delete, patch) // 非必填
  "rawHeaders"?: object // 非必填
  "rawParametersSchema"?: object // 非必填
  "functionCode"?: string // 非必填
  "mcpUrl"?: string // 非必填
  "mcpAllowedTools"?: object // 非必填
  "rawMcpHeader"?: object // 當 Contact 沒有對應的 MCP Credential 時，將使用此預設標頭 (非必填)
}
```

**請求範例值**

```json
{
  "name": "範例名稱",
  "displayName": "範例字串",
  "description": "範例字串",
  "prompt": "範例字串",
  "toolType": {},
  "apiUrl": "https://example.com/file.jpg",
  "httpMethod": null,
  "rawHeaders": null,
  "rawParametersSchema": null,
  "functionCode": "範例字串",
  "mcpUrl": "範例字串",
  "mcpAllowedTools": null,
  "rawMcpHeader": null
}
```

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X POST "https://api.maiagent.ai/api/tools/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "範例名稱",
    "displayName": "範例字串",
    "description": "範例字串",
    "prompt": "範例字串",
    "toolType": {},
    "apiUrl": "https://example.com/file.jpg",
    "httpMethod": null,
    "rawHeaders": null,
    "rawParametersSchema": null,
    "functionCode": "範例字串",
    "mcpUrl": "範例字串",
    "mcpAllowedTools": null,
    "rawMcpHeader": null
  }'

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
};

// 請求內容 (payload)
const data = {
    "name": "範例名稱",
    "displayName": "範例字串",
    "description": "範例字串",
    "prompt": "範例字串",
    "toolType": {},
    "apiUrl": "https://example.com/file.jpg",
    "httpMethod": null,
    "rawHeaders": null,
    "rawParametersSchema": null,
    "functionCode": "範例字串",
    "mcpUrl": "範例字串",
    "mcpAllowedTools": null,
    "rawMcpHeader": null
  };

axios.post("https://api.maiagent.ai/api/tools/", data, config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/tools/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY",
    "Content-Type": "application/json"
}

# 請求內容 (payload)
data = {
      "name": "範例名稱",
      "displayName": "範例字串",
      "description": "範例字串",
      "prompt": "範例字串",
      "toolType": {},
      "apiUrl": "https://example.com/file.jpg",
      "httpMethod": null,
      "rawHeaders": null,
      "rawParametersSchema": null,
      "functionCode": "範例字串",
      "mcpUrl": "範例字串",
      "mcpAllowedTools": null,
      "rawMcpHeader": null
    }

response = requests.post(url, json=data, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->post("https://api.maiagent.ai/api/tools/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY',
            'Content-Type' => 'application/json'
        ],
        'json' => {
            "name": "範例名稱",
            "displayName": "範例字串",
            "description": "範例字串",
            "prompt": "範例字串",
            "toolType": {},
            "apiUrl": "https://example.com/file.jpg",
            "httpMethod": null,
            "rawHeaders": null,
            "rawParametersSchema": null,
            "functionCode": "範例字串",
            "mcpUrl": "範例字串",
            "mcpAllowedTools": null,
            "rawMcpHeader": null
        }
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

**狀態碼: 201**

**回應結構範例**

```typescript
{
  "id": string (uuid)
  "name"?: string // 工具名稱只能包含英文字母、數字、底線(_)和連字符(-)。MCP 類型工具不需要此欄位，此欄位將用於 API 類型工具給 LLM 使用。 (非必填)
  "displayName": string // 可包含任何字符的名稱，供使用者設定使用和管理。
  "description"?: string // 給用戶展示的工具描述。MCP 類型工具不需要此欄位。 (非必填)
  "prompt"?: string // 給 LLM 使用的工具描述/提示詞。若為空，系統將使用 description 欄位。MCP 類型工具不需要此欄位。 (非必填)
  "toolType"?:  // 非必填
  {
  }
  "apiUrl"?: string (uri) // 非必填
  "httpMethod"?: // 可能有不同的類型 (非必填)
  string (enum: get, post, put, delete, patch) // 非必填
  "rawHeaders"?: object // 非必填
  "rawParametersSchema"?: object // 非必填
  "functionCode"?: string // 非必填
  "organization": string (uuid)
  "createdBy": string (uuid)
  "isGlobal": boolean // If set as global tool, all organizations can use this tool
  "mcpUrl"?: string // 非必填
  "mcpAllowedTools"?: object // 非必填
  "rawMcpHeader"?: object // 當 Contact 沒有對應的 MCP Credential 時，將使用此預設標頭 (非必填)
  "createdAt": string (timestamp)
  "updatedAt": string (timestamp)
}
```

**回應範例值**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "回應字串",
  "displayName": "回應字串",
  "description": "回應字串",
  "prompt": "回應字串",
  "toolType": {},
  "apiUrl": "https://example.com/file.jpg",
  "httpMethod": "get",
  "rawHeaders": null,
  "rawParametersSchema": null,
  "functionCode": "回應字串",
  "organization": "550e8400-e29b-41d4-a716-446655440000",
  "createdBy": "550e8400-e29b-41d4-a716-446655440000",
  "isGlobal": false,
  "mcpUrl": "回應字串",
  "mcpAllowedTools": null,
  "rawMcpHeader": null,
  "createdAt": "回應字串",
  "updatedAt": "回應字串"
}
```

***

### 建立工具 <a href="#undefined" id="undefined"></a>

POST `/api/v1/tools/`

#### 請求內容

**請求參數**

| 欄位                  | 類型           | 必填 | 說明                                                                    |
| ------------------- | ------------ | -- | --------------------------------------------------------------------- |
| name                | string       | 否  | 工具名稱只能包含英文字母、數字、底線(\_)和連字符(-)。MCP 類型工具不需要此欄位，此欄位將用於 API 類型工具給 LLM 使用。 |
| displayName         | string       | 是  | 可包含任何字符的名稱，供使用者設定使用和管理。                                               |
| description         | string       | 否  | 給用戶展示的工具描述。MCP 類型工具不需要此欄位。                                            |
| prompt              | string       | 否  | 給 LLM 使用的工具描述/提示詞。若為空，系統將使用 description 欄位。MCP 類型工具不需要此欄位。            |
| toolType            | object       | 否  |                                                                       |
| apiUrl              | string (uri) | 否  |                                                                       |
| httpMethod          | object       | 否  |                                                                       |
| rawHeaders          | object       | 否  |                                                                       |
| rawParametersSchema | object       | 否  |                                                                       |
| functionCode        | string       | 否  |                                                                       |
| mcpUrl              | string       | 否  |                                                                       |
| mcpAllowedTools     | object       | 否  |                                                                       |
| rawMcpHeader        | object       | 否  | 當 Contact 沒有對應的 MCP Credential 時，將使用此預設標頭                             |

**請求結構範例**

```typescript
{
  "name"?: string // 工具名稱只能包含英文字母、數字、底線(_)和連字符(-)。MCP 類型工具不需要此欄位，此欄位將用於 API 類型工具給 LLM 使用。 (非必填)
  "displayName": string // 可包含任何字符的名稱，供使用者設定使用和管理。
  "description"?: string // 給用戶展示的工具描述。MCP 類型工具不需要此欄位。 (非必填)
  "prompt"?: string // 給 LLM 使用的工具描述/提示詞。若為空，系統將使用 description 欄位。MCP 類型工具不需要此欄位。 (非必填)
  "toolType"?:  // 非必填
  {
  }
  "apiUrl"?: string (uri) // 非必填
  "httpMethod"?: // 可能有不同的類型 (非必填)
  string (enum: get, post, put, delete, patch) // 非必填
  "rawHeaders"?: object // 非必填
  "rawParametersSchema"?: object // 非必填
  "functionCode"?: string // 非必填
  "mcpUrl"?: string // 非必填
  "mcpAllowedTools"?: object // 非必填
  "rawMcpHeader"?: object // 當 Contact 沒有對應的 MCP Credential 時，將使用此預設標頭 (非必填)
}
```

**請求範例值**

```json
{
  "name": "範例名稱",
  "displayName": "範例字串",
  "description": "範例字串",
  "prompt": "範例字串",
  "toolType": {},
  "apiUrl": "https://example.com/file.jpg",
  "httpMethod": null,
  "rawHeaders": null,
  "rawParametersSchema": null,
  "functionCode": "範例字串",
  "mcpUrl": "範例字串",
  "mcpAllowedTools": null,
  "rawMcpHeader": null
}
```

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X POST "https://api.maiagent.ai/api/v1/tools/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "範例名稱",
    "displayName": "範例字串",
    "description": "範例字串",
    "prompt": "範例字串",
    "toolType": {},
    "apiUrl": "https://example.com/file.jpg",
    "httpMethod": null,
    "rawHeaders": null,
    "rawParametersSchema": null,
    "functionCode": "範例字串",
    "mcpUrl": "範例字串",
    "mcpAllowedTools": null,
    "rawMcpHeader": null
  }'

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
};

// 請求內容 (payload)
const data = {
    "name": "範例名稱",
    "displayName": "範例字串",
    "description": "範例字串",
    "prompt": "範例字串",
    "toolType": {},
    "apiUrl": "https://example.com/file.jpg",
    "httpMethod": null,
    "rawHeaders": null,
    "rawParametersSchema": null,
    "functionCode": "範例字串",
    "mcpUrl": "範例字串",
    "mcpAllowedTools": null,
    "rawMcpHeader": null
  };

axios.post("https://api.maiagent.ai/api/v1/tools/", data, config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/tools/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY",
    "Content-Type": "application/json"
}

# 請求內容 (payload)
data = {
      "name": "範例名稱",
      "displayName": "範例字串",
      "description": "範例字串",
      "prompt": "範例字串",
      "toolType": {},
      "apiUrl": "https://example.com/file.jpg",
      "httpMethod": null,
      "rawHeaders": null,
      "rawParametersSchema": null,
      "functionCode": "範例字串",
      "mcpUrl": "範例字串",
      "mcpAllowedTools": null,
      "rawMcpHeader": null
    }

response = requests.post(url, json=data, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->post("https://api.maiagent.ai/api/v1/tools/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY',
            'Content-Type' => 'application/json'
        ],
        'json' => {
            "name": "範例名稱",
            "displayName": "範例字串",
            "description": "範例字串",
            "prompt": "範例字串",
            "toolType": {},
            "apiUrl": "https://example.com/file.jpg",
            "httpMethod": null,
            "rawHeaders": null,
            "rawParametersSchema": null,
            "functionCode": "範例字串",
            "mcpUrl": "範例字串",
            "mcpAllowedTools": null,
            "rawMcpHeader": null
        }
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

**狀態碼: 201**

**回應結構範例**

```typescript
{
  "id": string (uuid)
  "name"?: string // 工具名稱只能包含英文字母、數字、底線(_)和連字符(-)。MCP 類型工具不需要此欄位，此欄位將用於 API 類型工具給 LLM 使用。 (非必填)
  "displayName": string // 可包含任何字符的名稱，供使用者設定使用和管理。
  "description"?: string // 給用戶展示的工具描述。MCP 類型工具不需要此欄位。 (非必填)
  "prompt"?: string // 給 LLM 使用的工具描述/提示詞。若為空，系統將使用 description 欄位。MCP 類型工具不需要此欄位。 (非必填)
  "toolType"?:  // 非必填
  {
  }
  "apiUrl"?: string (uri) // 非必填
  "httpMethod"?: // 可能有不同的類型 (非必填)
  string (enum: get, post, put, delete, patch) // 非必填
  "rawHeaders"?: object // 非必填
  "rawParametersSchema"?: object // 非必填
  "functionCode"?: string // 非必填
  "organization": string (uuid)
  "createdBy": string (uuid)
  "isGlobal": boolean // If set as global tool, all organizations can use this tool
  "mcpUrl"?: string // 非必填
  "mcpAllowedTools"?: object // 非必填
  "rawMcpHeader"?: object // 當 Contact 沒有對應的 MCP Credential 時，將使用此預設標頭 (非必填)
  "createdAt": string (timestamp)
  "updatedAt": string (timestamp)
}
```

**回應範例值**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "回應字串",
  "displayName": "回應字串",
  "description": "回應字串",
  "prompt": "回應字串",
  "toolType": {},
  "apiUrl": "https://example.com/file.jpg",
  "httpMethod": "get",
  "rawHeaders": null,
  "rawParametersSchema": null,
  "functionCode": "回應字串",
  "organization": "550e8400-e29b-41d4-a716-446655440000",
  "createdBy": "550e8400-e29b-41d4-a716-446655440000",
  "isGlobal": false,
  "mcpUrl": "回應字串",
  "mcpAllowedTools": null,
  "rawMcpHeader": null,
  "createdAt": "回應字串",
  "updatedAt": "回應字串"
}
```

***

### 列出工具 <a href="#undefined" id="undefined"></a>

GET `/api/tools/`

#### 參數

| 參數名稱       | 必填 | 類型      | 說明                                             |
| ---------- | -- | ------- | ---------------------------------------------- |
| `isGlobal` | ❌  | boolean | 設定為 "true" 以獲取全域工具，否則獲取組織工具                    |
| `page`     | ❌  | integer | A page number within the paginated result set. |
| `pageSize` | ❌  | integer | Number of results to return per page.          |
| `toolType` | ❌  | string  | 過濾工具類型：api, function, mcp                      |

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X GET "https://api.maiagent.ai/api/tools/?isGlobal=true&page=1&pageSize=1&toolType=api" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/tools/?isGlobal=true&page=1&pageSize=1&toolType=api", config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/tools/?isGlobal=true&page=1&pageSize=1&toolType=api"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/tools/?isGlobal=true&page=1&pageSize=1&toolType=api", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

**狀態碼: 200**

**回應結構範例**

```typescript
{
  "count": integer
  "next"?: string (uri) // 非必填
  "previous"?: string (uri) // 非必填
  "results": [
    {
      "id": string (uuid)
      "name"?: string // 工具名稱只能包含英文字母、數字、底線(_)和連字符(-)。MCP 類型工具不需要此欄位，此欄位將用於 API 類型工具給 LLM 使用。 (非必填)
      "displayName": string // 可包含任何字符的名稱，供使用者設定使用和管理。
      "description"?: string // 給用戶展示的工具描述。MCP 類型工具不需要此欄位。 (非必填)
      "prompt"?: string // 給 LLM 使用的工具描述/提示詞。若為空，系統將使用 description 欄位。MCP 類型工具不需要此欄位。 (非必填)
      "toolType"?:  // 非必填
      {
      }
      "apiUrl"?: string (uri) // 非必填
      "httpMethod"?: // 可能有不同的類型 (非必填)
      string (enum: get, post, put, delete, patch) // 非必填
      "rawHeaders"?: object // 非必填
      "rawParametersSchema"?: object // 非必填
      "functionCode"?: string // 非必填
      "organization": string (uuid)
      "createdBy": string (uuid)
      "isGlobal": boolean // If set as global tool, all organizations can use this tool
      "mcpUrl"?: string // 非必填
      "mcpAllowedTools"?: object // 非必填
      "rawMcpHeader"?: object // 當 Contact 沒有對應的 MCP Credential 時，將使用此預設標頭 (非必填)
      "createdAt": string (timestamp)
      "updatedAt": string (timestamp)
    }
  ]
}
```

**回應範例值**

```json
{
  "count": 123,
  "next": "http://api.example.org/accounts/?page=4",
  "previous": "http://api.example.org/accounts/?page=2",
  "results": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "name": "回應字串",
      "displayName": "回應字串",
      "description": "回應字串",
      "prompt": "回應字串",
      "toolType": {},
      "apiUrl": "https://example.com/file.jpg",
      "httpMethod": "get",
      "rawHeaders": null,
      "rawParametersSchema": null,
      "functionCode": "回應字串",
      "organization": "550e8400-e29b-41d4-a716-446655440000",
      "createdBy": "550e8400-e29b-41d4-a716-446655440000",
      "isGlobal": false,
      "mcpUrl": "回應字串",
      "mcpAllowedTools": null,
      "rawMcpHeader": null,
      "createdAt": "回應字串",
      "updatedAt": "回應字串"
    }
  ]
}
```

***

### 列出工具 <a href="#undefined" id="undefined"></a>

GET `/api/v1/tools/`

#### 參數

| 參數名稱       | 必填 | 類型      | 說明                                             |
| ---------- | -- | ------- | ---------------------------------------------- |
| `isGlobal` | ❌  | boolean | 設定為 "true" 以獲取全域工具，否則獲取組織工具                    |
| `page`     | ❌  | integer | A page number within the paginated result set. |
| `pageSize` | ❌  | integer | Number of results to return per page.          |
| `toolType` | ❌  | string  | 過濾工具類型：api, function, mcp                      |

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X GET "https://api.maiagent.ai/api/v1/tools/?isGlobal=true&page=1&pageSize=1&toolType=api" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/v1/tools/?isGlobal=true&page=1&pageSize=1&toolType=api", config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/tools/?isGlobal=true&page=1&pageSize=1&toolType=api"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/v1/tools/?isGlobal=true&page=1&pageSize=1&toolType=api", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

**狀態碼: 200**

**回應結構範例**

```typescript
{
  "count": integer
  "next"?: string (uri) // 非必填
  "previous"?: string (uri) // 非必填
  "results": [
    {
      "id": string (uuid)
      "name"?: string // 工具名稱只能包含英文字母、數字、底線(_)和連字符(-)。MCP 類型工具不需要此欄位，此欄位將用於 API 類型工具給 LLM 使用。 (非必填)
      "displayName": string // 可包含任何字符的名稱，供使用者設定使用和管理。
      "description"?: string // 給用戶展示的工具描述。MCP 類型工具不需要此欄位。 (非必填)
      "prompt"?: string // 給 LLM 使用的工具描述/提示詞。若為空，系統將使用 description 欄位。MCP 類型工具不需要此欄位。 (非必填)
      "toolType"?:  // 非必填
      {
      }
      "apiUrl"?: string (uri) // 非必填
      "httpMethod"?: // 可能有不同的類型 (非必填)
      string (enum: get, post, put, delete, patch) // 非必填
      "rawHeaders"?: object // 非必填
      "rawParametersSchema"?: object // 非必填
      "functionCode"?: string // 非必填
      "organization": string (uuid)
      "createdBy": string (uuid)
      "isGlobal": boolean // If set as global tool, all organizations can use this tool
      "mcpUrl"?: string // 非必填
      "mcpAllowedTools"?: object // 非必填
      "rawMcpHeader"?: object // 當 Contact 沒有對應的 MCP Credential 時，將使用此預設標頭 (非必填)
      "createdAt": string (timestamp)
      "updatedAt": string (timestamp)
    }
  ]
}
```

**回應範例值**

```json
{
  "count": 123,
  "next": "http://api.example.org/accounts/?page=4",
  "previous": "http://api.example.org/accounts/?page=2",
  "results": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "name": "回應字串",
      "displayName": "回應字串",
      "description": "回應字串",
      "prompt": "回應字串",
      "toolType": {},
      "apiUrl": "https://example.com/file.jpg",
      "httpMethod": "get",
      "rawHeaders": null,
      "rawParametersSchema": null,
      "functionCode": "回應字串",
      "organization": "550e8400-e29b-41d4-a716-446655440000",
      "createdBy": "550e8400-e29b-41d4-a716-446655440000",
      "isGlobal": false,
      "mcpUrl": "回應字串",
      "mcpAllowedTools": null,
      "rawMcpHeader": null,
      "createdAt": "回應字串",
      "updatedAt": "回應字串"
    }
  ]
}
```

***

### 取得特定工具 <a href="#undefined" id="undefined"></a>

GET `/api/tools/{id}/`

#### 參數

| 參數名稱 | 必填 | 類型     | 說明                                 |
| ---- | -- | ------ | ---------------------------------- |
| `id` | ✅  | string | A UUID string identifying this 工具. |

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X GET "https://api.maiagent.ai/api/tools/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/tools/550e8400-e29b-41d4-a716-446655440000/", config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/tools/550e8400-e29b-41d4-a716-446655440000/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/tools/550e8400-e29b-41d4-a716-446655440000/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

**狀態碼: 200**

**回應結構範例**

```typescript
{
  "id": string (uuid)
  "name"?: string // 工具名稱只能包含英文字母、數字、底線(_)和連字符(-)。MCP 類型工具不需要此欄位，此欄位將用於 API 類型工具給 LLM 使用。 (非必填)
  "displayName": string // 可包含任何字符的名稱，供使用者設定使用和管理。
  "description"?: string // 給用戶展示的工具描述。MCP 類型工具不需要此欄位。 (非必填)
  "prompt"?: string // 給 LLM 使用的工具描述/提示詞。若為空，系統將使用 description 欄位。MCP 類型工具不需要此欄位。 (非必填)
  "toolType"?:  // 非必填
  {
  }
  "apiUrl"?: string (uri) // 非必填
  "httpMethod"?: // 可能有不同的類型 (非必填)
  string (enum: get, post, put, delete, patch) // 非必填
  "rawHeaders"?: object // 非必填
  "rawParametersSchema"?: object // 非必填
  "functionCode"?: string // 非必填
  "organization": string (uuid)
  "createdBy": string (uuid)
  "isGlobal": boolean // If set as global tool, all organizations can use this tool
  "mcpUrl"?: string // 非必填
  "mcpAllowedTools"?: object // 非必填
  "rawMcpHeader"?: object // 當 Contact 沒有對應的 MCP Credential 時，將使用此預設標頭 (非必填)
  "createdAt": string (timestamp)
  "updatedAt": string (timestamp)
}
```

**回應範例值**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "回應字串",
  "displayName": "回應字串",
  "description": "回應字串",
  "prompt": "回應字串",
  "toolType": {},
  "apiUrl": "https://example.com/file.jpg",
  "httpMethod": "get",
  "rawHeaders": null,
  "rawParametersSchema": null,
  "functionCode": "回應字串",
  "organization": "550e8400-e29b-41d4-a716-446655440000",
  "createdBy": "550e8400-e29b-41d4-a716-446655440000",
  "isGlobal": false,
  "mcpUrl": "回應字串",
  "mcpAllowedTools": null,
  "rawMcpHeader": null,
  "createdAt": "回應字串",
  "updatedAt": "回應字串"
}
```

***

### 取得特定工具 <a href="#undefined" id="undefined"></a>

GET `/api/tools/available-tools/`

#### 參數

| 參數名稱              | 必填 | 類型     | 說明                  |
| ----------------- | -- | ------ | ------------------- |
| `availableTools`  | ✅  | array  | 所有可用的MCP工具列表        |
| `mcpAllowedTools` | ❌  | array  | MCP 允許使用的工具列表       |
| `mcpUrl`          | ✅  | string | MCP 伺服器 URL（必填）     |
| `rawMcpHeader`    | ❌  |        | MCP Header（JSON 格式） |

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X GET "https://api.maiagent.ai/api/tools/available-tools/?availableTools=example&mcpAllowedTools=example&mcpUrl=example&rawMcpHeader=example" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/tools/available-tools/?availableTools=example&mcpAllowedTools=example&mcpUrl=example&rawMcpHeader=example", config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/tools/available-tools/?availableTools=example&mcpAllowedTools=example&mcpUrl=example&rawMcpHeader=example"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/tools/available-tools/?availableTools=example&mcpAllowedTools=example&mcpUrl=example&rawMcpHeader=example", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

**狀態碼: 200**

**回應結構範例**

```typescript
{
  "mcpUrl": string // MCP 伺服器 URL（必填）
  "rawMcpHeader"?: object // MCP Header（JSON 格式） (非必填)
  "mcpAllowedTools"?: [ // MCP 允許使用的工具列表 (非必填)
    string
  ]
  "availableTools": [ // 所有可用的MCP工具列表
    string
  ]
}
```

**回應範例值**

```json
{
  "mcpUrl": "回應字串",
  "rawMcpHeader": null,
  "mcpAllowedTools": [
    "回應字串"
  ],
  "availableTools": [
    "回應字串"
  ]
}
```

**狀態碼: 400**

**回應結構範例**

```typescript
{
  "detail"?: string // 非必填
}
```

**回應範例值**

```json
{
  "detail": "回應字串"
}
```

***

### 取得特定工具 <a href="#undefined" id="undefined"></a>

GET `/api/v1/tools/{id}/`

#### 參數

| 參數名稱 | 必填 | 類型     | 說明                                 |
| ---- | -- | ------ | ---------------------------------- |
| `id` | ✅  | string | A UUID string identifying this 工具. |

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X GET "https://api.maiagent.ai/api/v1/tools/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/v1/tools/550e8400-e29b-41d4-a716-446655440000/", config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/tools/550e8400-e29b-41d4-a716-446655440000/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/v1/tools/550e8400-e29b-41d4-a716-446655440000/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

**狀態碼: 200**

**回應結構範例**

```typescript
{
  "id": string (uuid)
  "name"?: string // 工具名稱只能包含英文字母、數字、底線(_)和連字符(-)。MCP 類型工具不需要此欄位，此欄位將用於 API 類型工具給 LLM 使用。 (非必填)
  "displayName": string // 可包含任何字符的名稱，供使用者設定使用和管理。
  "description"?: string // 給用戶展示的工具描述。MCP 類型工具不需要此欄位。 (非必填)
  "prompt"?: string // 給 LLM 使用的工具描述/提示詞。若為空，系統將使用 description 欄位。MCP 類型工具不需要此欄位。 (非必填)
  "toolType"?:  // 非必填
  {
  }
  "apiUrl"?: string (uri) // 非必填
  "httpMethod"?: // 可能有不同的類型 (非必填)
  string (enum: get, post, put, delete, patch) // 非必填
  "rawHeaders"?: object // 非必填
  "rawParametersSchema"?: object // 非必填
  "functionCode"?: string // 非必填
  "organization": string (uuid)
  "createdBy": string (uuid)
  "isGlobal": boolean // If set as global tool, all organizations can use this tool
  "mcpUrl"?: string // 非必填
  "mcpAllowedTools"?: object // 非必填
  "rawMcpHeader"?: object // 當 Contact 沒有對應的 MCP Credential 時，將使用此預設標頭 (非必填)
  "createdAt": string (timestamp)
  "updatedAt": string (timestamp)
}
```

**回應範例值**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "回應字串",
  "displayName": "回應字串",
  "description": "回應字串",
  "prompt": "回應字串",
  "toolType": {},
  "apiUrl": "https://example.com/file.jpg",
  "httpMethod": "get",
  "rawHeaders": null,
  "rawParametersSchema": null,
  "functionCode": "回應字串",
  "organization": "550e8400-e29b-41d4-a716-446655440000",
  "createdBy": "550e8400-e29b-41d4-a716-446655440000",
  "isGlobal": false,
  "mcpUrl": "回應字串",
  "mcpAllowedTools": null,
  "rawMcpHeader": null,
  "createdAt": "回應字串",
  "updatedAt": "回應字串"
}
```

***

### 取得特定工具 <a href="#undefined" id="undefined"></a>

GET `/api/v1/tools/available-tools/`

#### 參數

| 參數名稱              | 必填 | 類型     | 說明                  |
| ----------------- | -- | ------ | ------------------- |
| `availableTools`  | ✅  | array  | 所有可用的MCP工具列表        |
| `mcpAllowedTools` | ❌  | array  | MCP 允許使用的工具列表       |
| `mcpUrl`          | ✅  | string | MCP 伺服器 URL（必填）     |
| `rawMcpHeader`    | ❌  |        | MCP Header（JSON 格式） |

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X GET "https://api.maiagent.ai/api/v1/tools/available-tools/?availableTools=example&mcpAllowedTools=example&mcpUrl=example&rawMcpHeader=example" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/v1/tools/available-tools/?availableTools=example&mcpAllowedTools=example&mcpUrl=example&rawMcpHeader=example", config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/tools/available-tools/?availableTools=example&mcpAllowedTools=example&mcpUrl=example&rawMcpHeader=example"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/v1/tools/available-tools/?availableTools=example&mcpAllowedTools=example&mcpUrl=example&rawMcpHeader=example", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

**狀態碼: 200**

**回應結構範例**

```typescript
{
  "mcpUrl": string // MCP 伺服器 URL（必填）
  "rawMcpHeader"?: object // MCP Header（JSON 格式） (非必填)
  "mcpAllowedTools"?: [ // MCP 允許使用的工具列表 (非必填)
    string
  ]
  "availableTools": [ // 所有可用的MCP工具列表
    string
  ]
}
```

**回應範例值**

```json
{
  "mcpUrl": "回應字串",
  "rawMcpHeader": null,
  "mcpAllowedTools": [
    "回應字串"
  ],
  "availableTools": [
    "回應字串"
  ]
}
```

**狀態碼: 400**

**回應結構範例**

```typescript
{
  "detail"?: string // 非必填
}
```

**回應範例值**

```json
{
  "detail": "回應字串"
}
```

***

### 更新工具 <a href="#undefined" id="undefined"></a>

PUT `/api/tools/{id}/`

#### 參數

| 參數名稱 | 必填 | 類型     | 說明                                 |
| ---- | -- | ------ | ---------------------------------- |
| `id` | ✅  | string | A UUID string identifying this 工具. |

#### 請求內容

**請求參數**

| 欄位                  | 類型           | 必填 | 說明                                                                    |
| ------------------- | ------------ | -- | --------------------------------------------------------------------- |
| name                | string       | 否  | 工具名稱只能包含英文字母、數字、底線(\_)和連字符(-)。MCP 類型工具不需要此欄位，此欄位將用於 API 類型工具給 LLM 使用。 |
| displayName         | string       | 是  | 可包含任何字符的名稱，供使用者設定使用和管理。                                               |
| description         | string       | 否  | 給用戶展示的工具描述。MCP 類型工具不需要此欄位。                                            |
| prompt              | string       | 否  | 給 LLM 使用的工具描述/提示詞。若為空，系統將使用 description 欄位。MCP 類型工具不需要此欄位。            |
| toolType            | object       | 否  |                                                                       |
| apiUrl              | string (uri) | 否  |                                                                       |
| httpMethod          | object       | 否  |                                                                       |
| rawHeaders          | object       | 否  |                                                                       |
| rawParametersSchema | object       | 否  |                                                                       |
| functionCode        | string       | 否  |                                                                       |
| mcpUrl              | string       | 否  |                                                                       |
| mcpAllowedTools     | object       | 否  |                                                                       |
| rawMcpHeader        | object       | 否  | 當 Contact 沒有對應的 MCP Credential 時，將使用此預設標頭                             |

**請求結構範例**

```typescript
{
  "name"?: string // 工具名稱只能包含英文字母、數字、底線(_)和連字符(-)。MCP 類型工具不需要此欄位，此欄位將用於 API 類型工具給 LLM 使用。 (非必填)
  "displayName": string // 可包含任何字符的名稱，供使用者設定使用和管理。
  "description"?: string // 給用戶展示的工具描述。MCP 類型工具不需要此欄位。 (非必填)
  "prompt"?: string // 給 LLM 使用的工具描述/提示詞。若為空，系統將使用 description 欄位。MCP 類型工具不需要此欄位。 (非必填)
  "toolType"?:  // 非必填
  {
  }
  "apiUrl"?: string (uri) // 非必填
  "httpMethod"?: // 可能有不同的類型 (非必填)
  string (enum: get, post, put, delete, patch) // 非必填
  "rawHeaders"?: object // 非必填
  "rawParametersSchema"?: object // 非必填
  "functionCode"?: string // 非必填
  "mcpUrl"?: string // 非必填
  "mcpAllowedTools"?: object // 非必填
  "rawMcpHeader"?: object // 當 Contact 沒有對應的 MCP Credential 時，將使用此預設標頭 (非必填)
}
```

**請求範例值**

```json
{
  "name": "範例名稱",
  "displayName": "範例字串",
  "description": "範例字串",
  "prompt": "範例字串",
  "toolType": {},
  "apiUrl": "https://example.com/file.jpg",
  "httpMethod": null,
  "rawHeaders": null,
  "rawParametersSchema": null,
  "functionCode": "範例字串",
  "mcpUrl": "範例字串",
  "mcpAllowedTools": null,
  "rawMcpHeader": null
}
```

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X PUT "https://api.maiagent.ai/api/tools/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "範例名稱",
    "displayName": "範例字串",
    "description": "範例字串",
    "prompt": "範例字串",
    "toolType": {},
    "apiUrl": "https://example.com/file.jpg",
    "httpMethod": null,
    "rawHeaders": null,
    "rawParametersSchema": null,
    "functionCode": "範例字串",
    "mcpUrl": "範例字串",
    "mcpAllowedTools": null,
    "rawMcpHeader": null
  }'

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
};

// 請求內容 (payload)
const data = {
    "name": "範例名稱",
    "displayName": "範例字串",
    "description": "範例字串",
    "prompt": "範例字串",
    "toolType": {},
    "apiUrl": "https://example.com/file.jpg",
    "httpMethod": null,
    "rawHeaders": null,
    "rawParametersSchema": null,
    "functionCode": "範例字串",
    "mcpUrl": "範例字串",
    "mcpAllowedTools": null,
    "rawMcpHeader": null
  };

axios.put("https://api.maiagent.ai/api/tools/550e8400-e29b-41d4-a716-446655440000/", data, config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/tools/550e8400-e29b-41d4-a716-446655440000/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY",
    "Content-Type": "application/json"
}

# 請求內容 (payload)
data = {
      "name": "範例名稱",
      "displayName": "範例字串",
      "description": "範例字串",
      "prompt": "範例字串",
      "toolType": {},
      "apiUrl": "https://example.com/file.jpg",
      "httpMethod": null,
      "rawHeaders": null,
      "rawParametersSchema": null,
      "functionCode": "範例字串",
      "mcpUrl": "範例字串",
      "mcpAllowedTools": null,
      "rawMcpHeader": null
    }

response = requests.put(url, json=data, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->put("https://api.maiagent.ai/api/tools/550e8400-e29b-41d4-a716-446655440000/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY',
            'Content-Type' => 'application/json'
        ],
        'json' => {
            "name": "範例名稱",
            "displayName": "範例字串",
            "description": "範例字串",
            "prompt": "範例字串",
            "toolType": {},
            "apiUrl": "https://example.com/file.jpg",
            "httpMethod": null,
            "rawHeaders": null,
            "rawParametersSchema": null,
            "functionCode": "範例字串",
            "mcpUrl": "範例字串",
            "mcpAllowedTools": null,
            "rawMcpHeader": null
        }
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

**狀態碼: 200**

**回應結構範例**

```typescript
{
  "id": string (uuid)
  "name"?: string // 工具名稱只能包含英文字母、數字、底線(_)和連字符(-)。MCP 類型工具不需要此欄位，此欄位將用於 API 類型工具給 LLM 使用。 (非必填)
  "displayName": string // 可包含任何字符的名稱，供使用者設定使用和管理。
  "description"?: string // 給用戶展示的工具描述。MCP 類型工具不需要此欄位。 (非必填)
  "prompt"?: string // 給 LLM 使用的工具描述/提示詞。若為空，系統將使用 description 欄位。MCP 類型工具不需要此欄位。 (非必填)
  "toolType"?:  // 非必填
  {
  }
  "apiUrl"?: string (uri) // 非必填
  "httpMethod"?: // 可能有不同的類型 (非必填)
  string (enum: get, post, put, delete, patch) // 非必填
  "rawHeaders"?: object // 非必填
  "rawParametersSchema"?: object // 非必填
  "functionCode"?: string // 非必填
  "organization": string (uuid)
  "createdBy": string (uuid)
  "isGlobal": boolean // If set as global tool, all organizations can use this tool
  "mcpUrl"?: string // 非必填
  "mcpAllowedTools"?: object // 非必填
  "rawMcpHeader"?: object // 當 Contact 沒有對應的 MCP Credential 時，將使用此預設標頭 (非必填)
  "createdAt": string (timestamp)
  "updatedAt": string (timestamp)
}
```

**回應範例值**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "回應字串",
  "displayName": "回應字串",
  "description": "回應字串",
  "prompt": "回應字串",
  "toolType": {},
  "apiUrl": "https://example.com/file.jpg",
  "httpMethod": "get",
  "rawHeaders": null,
  "rawParametersSchema": null,
  "functionCode": "回應字串",
  "organization": "550e8400-e29b-41d4-a716-446655440000",
  "createdBy": "550e8400-e29b-41d4-a716-446655440000",
  "isGlobal": false,
  "mcpUrl": "回應字串",
  "mcpAllowedTools": null,
  "rawMcpHeader": null,
  "createdAt": "回應字串",
  "updatedAt": "回應字串"
}
```

***

### 更新工具 <a href="#undefined" id="undefined"></a>

PUT `/api/v1/tools/{id}/`

#### 參數

| 參數名稱 | 必填 | 類型     | 說明                                 |
| ---- | -- | ------ | ---------------------------------- |
| `id` | ✅  | string | A UUID string identifying this 工具. |

#### 請求內容

**請求參數**

| 欄位                  | 類型           | 必填 | 說明                                                                    |
| ------------------- | ------------ | -- | --------------------------------------------------------------------- |
| name                | string       | 否  | 工具名稱只能包含英文字母、數字、底線(\_)和連字符(-)。MCP 類型工具不需要此欄位，此欄位將用於 API 類型工具給 LLM 使用。 |
| displayName         | string       | 是  | 可包含任何字符的名稱，供使用者設定使用和管理。                                               |
| description         | string       | 否  | 給用戶展示的工具描述。MCP 類型工具不需要此欄位。                                            |
| prompt              | string       | 否  | 給 LLM 使用的工具描述/提示詞。若為空，系統將使用 description 欄位。MCP 類型工具不需要此欄位。            |
| toolType            | object       | 否  |                                                                       |
| apiUrl              | string (uri) | 否  |                                                                       |
| httpMethod          | object       | 否  |                                                                       |
| rawHeaders          | object       | 否  |                                                                       |
| rawParametersSchema | object       | 否  |                                                                       |
| functionCode        | string       | 否  |                                                                       |
| mcpUrl              | string       | 否  |                                                                       |
| mcpAllowedTools     | object       | 否  |                                                                       |
| rawMcpHeader        | object       | 否  | 當 Contact 沒有對應的 MCP Credential 時，將使用此預設標頭                             |

**請求結構範例**

```typescript
{
  "name"?: string // 工具名稱只能包含英文字母、數字、底線(_)和連字符(-)。MCP 類型工具不需要此欄位，此欄位將用於 API 類型工具給 LLM 使用。 (非必填)
  "displayName": string // 可包含任何字符的名稱，供使用者設定使用和管理。
  "description"?: string // 給用戶展示的工具描述。MCP 類型工具不需要此欄位。 (非必填)
  "prompt"?: string // 給 LLM 使用的工具描述/提示詞。若為空，系統將使用 description 欄位。MCP 類型工具不需要此欄位。 (非必填)
  "toolType"?:  // 非必填
  {
  }
  "apiUrl"?: string (uri) // 非必填
  "httpMethod"?: // 可能有不同的類型 (非必填)
  string (enum: get, post, put, delete, patch) // 非必填
  "rawHeaders"?: object // 非必填
  "rawParametersSchema"?: object // 非必填
  "functionCode"?: string // 非必填
  "mcpUrl"?: string // 非必填
  "mcpAllowedTools"?: object // 非必填
  "rawMcpHeader"?: object // 當 Contact 沒有對應的 MCP Credential 時，將使用此預設標頭 (非必填)
}
```

**請求範例值**

```json
{
  "name": "範例名稱",
  "displayName": "範例字串",
  "description": "範例字串",
  "prompt": "範例字串",
  "toolType": {},
  "apiUrl": "https://example.com/file.jpg",
  "httpMethod": null,
  "rawHeaders": null,
  "rawParametersSchema": null,
  "functionCode": "範例字串",
  "mcpUrl": "範例字串",
  "mcpAllowedTools": null,
  "rawMcpHeader": null
}
```

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X PUT "https://api.maiagent.ai/api/v1/tools/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "範例名稱",
    "displayName": "範例字串",
    "description": "範例字串",
    "prompt": "範例字串",
    "toolType": {},
    "apiUrl": "https://example.com/file.jpg",
    "httpMethod": null,
    "rawHeaders": null,
    "rawParametersSchema": null,
    "functionCode": "範例字串",
    "mcpUrl": "範例字串",
    "mcpAllowedTools": null,
    "rawMcpHeader": null
  }'

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
};

// 請求內容 (payload)
const data = {
    "name": "範例名稱",
    "displayName": "範例字串",
    "description": "範例字串",
    "prompt": "範例字串",
    "toolType": {},
    "apiUrl": "https://example.com/file.jpg",
    "httpMethod": null,
    "rawHeaders": null,
    "rawParametersSchema": null,
    "functionCode": "範例字串",
    "mcpUrl": "範例字串",
    "mcpAllowedTools": null,
    "rawMcpHeader": null
  };

axios.put("https://api.maiagent.ai/api/v1/tools/550e8400-e29b-41d4-a716-446655440000/", data, config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/tools/550e8400-e29b-41d4-a716-446655440000/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY",
    "Content-Type": "application/json"
}

# 請求內容 (payload)
data = {
      "name": "範例名稱",
      "displayName": "範例字串",
      "description": "範例字串",
      "prompt": "範例字串",
      "toolType": {},
      "apiUrl": "https://example.com/file.jpg",
      "httpMethod": null,
      "rawHeaders": null,
      "rawParametersSchema": null,
      "functionCode": "範例字串",
      "mcpUrl": "範例字串",
      "mcpAllowedTools": null,
      "rawMcpHeader": null
    }

response = requests.put(url, json=data, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->put("https://api.maiagent.ai/api/v1/tools/550e8400-e29b-41d4-a716-446655440000/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY',
            'Content-Type' => 'application/json'
        ],
        'json' => {
            "name": "範例名稱",
            "displayName": "範例字串",
            "description": "範例字串",
            "prompt": "範例字串",
            "toolType": {},
            "apiUrl": "https://example.com/file.jpg",
            "httpMethod": null,
            "rawHeaders": null,
            "rawParametersSchema": null,
            "functionCode": "範例字串",
            "mcpUrl": "範例字串",
            "mcpAllowedTools": null,
            "rawMcpHeader": null
        }
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

**狀態碼: 200**

**回應結構範例**

```typescript
{
  "id": string (uuid)
  "name"?: string // 工具名稱只能包含英文字母、數字、底線(_)和連字符(-)。MCP 類型工具不需要此欄位，此欄位將用於 API 類型工具給 LLM 使用。 (非必填)
  "displayName": string // 可包含任何字符的名稱，供使用者設定使用和管理。
  "description"?: string // 給用戶展示的工具描述。MCP 類型工具不需要此欄位。 (非必填)
  "prompt"?: string // 給 LLM 使用的工具描述/提示詞。若為空，系統將使用 description 欄位。MCP 類型工具不需要此欄位。 (非必填)
  "toolType"?:  // 非必填
  {
  }
  "apiUrl"?: string (uri) // 非必填
  "httpMethod"?: // 可能有不同的類型 (非必填)
  string (enum: get, post, put, delete, patch) // 非必填
  "rawHeaders"?: object // 非必填
  "rawParametersSchema"?: object // 非必填
  "functionCode"?: string // 非必填
  "organization": string (uuid)
  "createdBy": string (uuid)
  "isGlobal": boolean // If set as global tool, all organizations can use this tool
  "mcpUrl"?: string // 非必填
  "mcpAllowedTools"?: object // 非必填
  "rawMcpHeader"?: object // 當 Contact 沒有對應的 MCP Credential 時，將使用此預設標頭 (非必填)
  "createdAt": string (timestamp)
  "updatedAt": string (timestamp)
}
```

**回應範例值**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "回應字串",
  "displayName": "回應字串",
  "description": "回應字串",
  "prompt": "回應字串",
  "toolType": {},
  "apiUrl": "https://example.com/file.jpg",
  "httpMethod": "get",
  "rawHeaders": null,
  "rawParametersSchema": null,
  "functionCode": "回應字串",
  "organization": "550e8400-e29b-41d4-a716-446655440000",
  "createdBy": "550e8400-e29b-41d4-a716-446655440000",
  "isGlobal": false,
  "mcpUrl": "回應字串",
  "mcpAllowedTools": null,
  "rawMcpHeader": null,
  "createdAt": "回應字串",
  "updatedAt": "回應字串"
}
```

***

### 部分更新工具 <a href="#undefined" id="undefined"></a>

PATCH `/api/tools/{id}/`

#### 參數

| 參數名稱 | 必填 | 類型     | 說明                                 |
| ---- | -- | ------ | ---------------------------------- |
| `id` | ✅  | string | A UUID string identifying this 工具. |

#### 請求內容

**請求參數**

| 欄位                  | 類型           | 必填 | 說明                                                                    |
| ------------------- | ------------ | -- | --------------------------------------------------------------------- |
| name                | string       | 否  | 工具名稱只能包含英文字母、數字、底線(\_)和連字符(-)。MCP 類型工具不需要此欄位，此欄位將用於 API 類型工具給 LLM 使用。 |
| displayName         | string       | 否  | 可包含任何字符的名稱，供使用者設定使用和管理。                                               |
| description         | string       | 否  | 給用戶展示的工具描述。MCP 類型工具不需要此欄位。                                            |
| prompt              | string       | 否  | 給 LLM 使用的工具描述/提示詞。若為空，系統將使用 description 欄位。MCP 類型工具不需要此欄位。            |
| toolType            | object       | 否  |                                                                       |
| apiUrl              | string (uri) | 否  |                                                                       |
| httpMethod          | object       | 否  |                                                                       |
| rawHeaders          | object       | 否  |                                                                       |
| rawParametersSchema | object       | 否  |                                                                       |
| functionCode        | string       | 否  |                                                                       |
| mcpUrl              | string       | 否  |                                                                       |
| mcpAllowedTools     | object       | 否  |                                                                       |
| rawMcpHeader        | object       | 否  | 當 Contact 沒有對應的 MCP Credential 時，將使用此預設標頭                             |

**請求結構範例**

```typescript
{
  "name"?: string // 工具名稱只能包含英文字母、數字、底線(_)和連字符(-)。MCP 類型工具不需要此欄位，此欄位將用於 API 類型工具給 LLM 使用。 (非必填)
  "displayName"?: string // 可包含任何字符的名稱，供使用者設定使用和管理。 (非必填)
  "description"?: string // 給用戶展示的工具描述。MCP 類型工具不需要此欄位。 (非必填)
  "prompt"?: string // 給 LLM 使用的工具描述/提示詞。若為空，系統將使用 description 欄位。MCP 類型工具不需要此欄位。 (非必填)
  "toolType"?:  // 非必填
  {
  }
  "apiUrl"?: string (uri) // 非必填
  "httpMethod"?: // 可能有不同的類型 (非必填)
  string (enum: get, post, put, delete, patch) // 非必填
  "rawHeaders"?: object // 非必填
  "rawParametersSchema"?: object // 非必填
  "functionCode"?: string // 非必填
  "mcpUrl"?: string // 非必填
  "mcpAllowedTools"?: object // 非必填
  "rawMcpHeader"?: object // 當 Contact 沒有對應的 MCP Credential 時，將使用此預設標頭 (非必填)
}
```

**請求範例值**

```json
{
  "name": "範例名稱",
  "displayName": "範例字串",
  "description": "範例字串",
  "prompt": "範例字串",
  "toolType": {},
  "apiUrl": "https://example.com/file.jpg",
  "httpMethod": null,
  "rawHeaders": null,
  "rawParametersSchema": null,
  "functionCode": "範例字串",
  "mcpUrl": "範例字串",
  "mcpAllowedTools": null,
  "rawMcpHeader": null
}
```

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X PATCH "https://api.maiagent.ai/api/tools/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "範例名稱",
    "displayName": "範例字串",
    "description": "範例字串",
    "prompt": "範例字串",
    "toolType": {},
    "apiUrl": "https://example.com/file.jpg",
    "httpMethod": null,
    "rawHeaders": null,
    "rawParametersSchema": null,
    "functionCode": "範例字串",
    "mcpUrl": "範例字串",
    "mcpAllowedTools": null,
    "rawMcpHeader": null
  }'

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
};

// 請求內容 (payload)
const data = {
    "name": "範例名稱",
    "displayName": "範例字串",
    "description": "範例字串",
    "prompt": "範例字串",
    "toolType": {},
    "apiUrl": "https://example.com/file.jpg",
    "httpMethod": null,
    "rawHeaders": null,
    "rawParametersSchema": null,
    "functionCode": "範例字串",
    "mcpUrl": "範例字串",
    "mcpAllowedTools": null,
    "rawMcpHeader": null
  };

axios.patch("https://api.maiagent.ai/api/tools/550e8400-e29b-41d4-a716-446655440000/", data, config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/tools/550e8400-e29b-41d4-a716-446655440000/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY",
    "Content-Type": "application/json"
}

# 請求內容 (payload)
data = {
      "name": "範例名稱",
      "displayName": "範例字串",
      "description": "範例字串",
      "prompt": "範例字串",
      "toolType": {},
      "apiUrl": "https://example.com/file.jpg",
      "httpMethod": null,
      "rawHeaders": null,
      "rawParametersSchema": null,
      "functionCode": "範例字串",
      "mcpUrl": "範例字串",
      "mcpAllowedTools": null,
      "rawMcpHeader": null
    }

response = requests.patch(url, json=data, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->patch("https://api.maiagent.ai/api/tools/550e8400-e29b-41d4-a716-446655440000/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY',
            'Content-Type' => 'application/json'
        ],
        'json' => {
            "name": "範例名稱",
            "displayName": "範例字串",
            "description": "範例字串",
            "prompt": "範例字串",
            "toolType": {},
            "apiUrl": "https://example.com/file.jpg",
            "httpMethod": null,
            "rawHeaders": null,
            "rawParametersSchema": null,
            "functionCode": "範例字串",
            "mcpUrl": "範例字串",
            "mcpAllowedTools": null,
            "rawMcpHeader": null
        }
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

**狀態碼: 200**

**回應結構範例**

```typescript
{
  "id": string (uuid)
  "name"?: string // 工具名稱只能包含英文字母、數字、底線(_)和連字符(-)。MCP 類型工具不需要此欄位，此欄位將用於 API 類型工具給 LLM 使用。 (非必填)
  "displayName": string // 可包含任何字符的名稱，供使用者設定使用和管理。
  "description"?: string // 給用戶展示的工具描述。MCP 類型工具不需要此欄位。 (非必填)
  "prompt"?: string // 給 LLM 使用的工具描述/提示詞。若為空，系統將使用 description 欄位。MCP 類型工具不需要此欄位。 (非必填)
  "toolType"?:  // 非必填
  {
  }
  "apiUrl"?: string (uri) // 非必填
  "httpMethod"?: // 可能有不同的類型 (非必填)
  string (enum: get, post, put, delete, patch) // 非必填
  "rawHeaders"?: object // 非必填
  "rawParametersSchema"?: object // 非必填
  "functionCode"?: string // 非必填
  "organization": string (uuid)
  "createdBy": string (uuid)
  "isGlobal": boolean // If set as global tool, all organizations can use this tool
  "mcpUrl"?: string // 非必填
  "mcpAllowedTools"?: object // 非必填
  "rawMcpHeader"?: object // 當 Contact 沒有對應的 MCP Credential 時，將使用此預設標頭 (非必填)
  "createdAt": string (timestamp)
  "updatedAt": string (timestamp)
}
```

**回應範例值**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "回應字串",
  "displayName": "回應字串",
  "description": "回應字串",
  "prompt": "回應字串",
  "toolType": {},
  "apiUrl": "https://example.com/file.jpg",
  "httpMethod": "get",
  "rawHeaders": null,
  "rawParametersSchema": null,
  "functionCode": "回應字串",
  "organization": "550e8400-e29b-41d4-a716-446655440000",
  "createdBy": "550e8400-e29b-41d4-a716-446655440000",
  "isGlobal": false,
  "mcpUrl": "回應字串",
  "mcpAllowedTools": null,
  "rawMcpHeader": null,
  "createdAt": "回應字串",
  "updatedAt": "回應字串"
}
```

***

### 部分更新工具 <a href="#undefined" id="undefined"></a>

PATCH `/api/v1/tools/{id}/`

#### 參數

| 參數名稱 | 必填 | 類型     | 說明                                 |
| ---- | -- | ------ | ---------------------------------- |
| `id` | ✅  | string | A UUID string identifying this 工具. |

#### 請求內容

**請求參數**

| 欄位                  | 類型           | 必填 | 說明                                                                    |
| ------------------- | ------------ | -- | --------------------------------------------------------------------- |
| name                | string       | 否  | 工具名稱只能包含英文字母、數字、底線(\_)和連字符(-)。MCP 類型工具不需要此欄位，此欄位將用於 API 類型工具給 LLM 使用。 |
| displayName         | string       | 否  | 可包含任何字符的名稱，供使用者設定使用和管理。                                               |
| description         | string       | 否  | 給用戶展示的工具描述。MCP 類型工具不需要此欄位。                                            |
| prompt              | string       | 否  | 給 LLM 使用的工具描述/提示詞。若為空，系統將使用 description 欄位。MCP 類型工具不需要此欄位。            |
| toolType            | object       | 否  |                                                                       |
| apiUrl              | string (uri) | 否  |                                                                       |
| httpMethod          | object       | 否  |                                                                       |
| rawHeaders          | object       | 否  |                                                                       |
| rawParametersSchema | object       | 否  |                                                                       |
| functionCode        | string       | 否  |                                                                       |
| mcpUrl              | string       | 否  |                                                                       |
| mcpAllowedTools     | object       | 否  |                                                                       |
| rawMcpHeader        | object       | 否  | 當 Contact 沒有對應的 MCP Credential 時，將使用此預設標頭                             |

**請求結構範例**

```typescript
{
  "name"?: string // 工具名稱只能包含英文字母、數字、底線(_)和連字符(-)。MCP 類型工具不需要此欄位，此欄位將用於 API 類型工具給 LLM 使用。 (非必填)
  "displayName"?: string // 可包含任何字符的名稱，供使用者設定使用和管理。 (非必填)
  "description"?: string // 給用戶展示的工具描述。MCP 類型工具不需要此欄位。 (非必填)
  "prompt"?: string // 給 LLM 使用的工具描述/提示詞。若為空，系統將使用 description 欄位。MCP 類型工具不需要此欄位。 (非必填)
  "toolType"?:  // 非必填
  {
  }
  "apiUrl"?: string (uri) // 非必填
  "httpMethod"?: // 可能有不同的類型 (非必填)
  string (enum: get, post, put, delete, patch) // 非必填
  "rawHeaders"?: object // 非必填
  "rawParametersSchema"?: object // 非必填
  "functionCode"?: string // 非必填
  "mcpUrl"?: string // 非必填
  "mcpAllowedTools"?: object // 非必填
  "rawMcpHeader"?: object // 當 Contact 沒有對應的 MCP Credential 時，將使用此預設標頭 (非必填)
}
```

**請求範例值**

```json
{
  "name": "範例名稱",
  "displayName": "範例字串",
  "description": "範例字串",
  "prompt": "範例字串",
  "toolType": {},
  "apiUrl": "https://example.com/file.jpg",
  "httpMethod": null,
  "rawHeaders": null,
  "rawParametersSchema": null,
  "functionCode": "範例字串",
  "mcpUrl": "範例字串",
  "mcpAllowedTools": null,
  "rawMcpHeader": null
}
```

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X PATCH "https://api.maiagent.ai/api/v1/tools/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "範例名稱",
    "displayName": "範例字串",
    "description": "範例字串",
    "prompt": "範例字串",
    "toolType": {},
    "apiUrl": "https://example.com/file.jpg",
    "httpMethod": null,
    "rawHeaders": null,
    "rawParametersSchema": null,
    "functionCode": "範例字串",
    "mcpUrl": "範例字串",
    "mcpAllowedTools": null,
    "rawMcpHeader": null
  }'

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
};

// 請求內容 (payload)
const data = {
    "name": "範例名稱",
    "displayName": "範例字串",
    "description": "範例字串",
    "prompt": "範例字串",
    "toolType": {},
    "apiUrl": "https://example.com/file.jpg",
    "httpMethod": null,
    "rawHeaders": null,
    "rawParametersSchema": null,
    "functionCode": "範例字串",
    "mcpUrl": "範例字串",
    "mcpAllowedTools": null,
    "rawMcpHeader": null
  };

axios.patch("https://api.maiagent.ai/api/v1/tools/550e8400-e29b-41d4-a716-446655440000/", data, config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/tools/550e8400-e29b-41d4-a716-446655440000/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY",
    "Content-Type": "application/json"
}

# 請求內容 (payload)
data = {
      "name": "範例名稱",
      "displayName": "範例字串",
      "description": "範例字串",
      "prompt": "範例字串",
      "toolType": {},
      "apiUrl": "https://example.com/file.jpg",
      "httpMethod": null,
      "rawHeaders": null,
      "rawParametersSchema": null,
      "functionCode": "範例字串",
      "mcpUrl": "範例字串",
      "mcpAllowedTools": null,
      "rawMcpHeader": null
    }

response = requests.patch(url, json=data, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->patch("https://api.maiagent.ai/api/v1/tools/550e8400-e29b-41d4-a716-446655440000/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY',
            'Content-Type' => 'application/json'
        ],
        'json' => {
            "name": "範例名稱",
            "displayName": "範例字串",
            "description": "範例字串",
            "prompt": "範例字串",
            "toolType": {},
            "apiUrl": "https://example.com/file.jpg",
            "httpMethod": null,
            "rawHeaders": null,
            "rawParametersSchema": null,
            "functionCode": "範例字串",
            "mcpUrl": "範例字串",
            "mcpAllowedTools": null,
            "rawMcpHeader": null
        }
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

**狀態碼: 200**

**回應結構範例**

```typescript
{
  "id": string (uuid)
  "name"?: string // 工具名稱只能包含英文字母、數字、底線(_)和連字符(-)。MCP 類型工具不需要此欄位，此欄位將用於 API 類型工具給 LLM 使用。 (非必填)
  "displayName": string // 可包含任何字符的名稱，供使用者設定使用和管理。
  "description"?: string // 給用戶展示的工具描述。MCP 類型工具不需要此欄位。 (非必填)
  "prompt"?: string // 給 LLM 使用的工具描述/提示詞。若為空，系統將使用 description 欄位。MCP 類型工具不需要此欄位。 (非必填)
  "toolType"?:  // 非必填
  {
  }
  "apiUrl"?: string (uri) // 非必填
  "httpMethod"?: // 可能有不同的類型 (非必填)
  string (enum: get, post, put, delete, patch) // 非必填
  "rawHeaders"?: object // 非必填
  "rawParametersSchema"?: object // 非必填
  "functionCode"?: string // 非必填
  "organization": string (uuid)
  "createdBy": string (uuid)
  "isGlobal": boolean // If set as global tool, all organizations can use this tool
  "mcpUrl"?: string // 非必填
  "mcpAllowedTools"?: object // 非必填
  "rawMcpHeader"?: object // 當 Contact 沒有對應的 MCP Credential 時，將使用此預設標頭 (非必填)
  "createdAt": string (timestamp)
  "updatedAt": string (timestamp)
}
```

**回應範例值**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "回應字串",
  "displayName": "回應字串",
  "description": "回應字串",
  "prompt": "回應字串",
  "toolType": {},
  "apiUrl": "https://example.com/file.jpg",
  "httpMethod": "get",
  "rawHeaders": null,
  "rawParametersSchema": null,
  "functionCode": "回應字串",
  "organization": "550e8400-e29b-41d4-a716-446655440000",
  "createdBy": "550e8400-e29b-41d4-a716-446655440000",
  "isGlobal": false,
  "mcpUrl": "回應字串",
  "mcpAllowedTools": null,
  "rawMcpHeader": null,
  "createdAt": "回應字串",
  "updatedAt": "回應字串"
}
```

***

### 刪除工具 <a href="#undefined" id="undefined"></a>

DELETE `/api/tools/{id}/`

#### 參數

| 參數名稱 | 必填 | 類型     | 說明                                 |
| ---- | -- | ------ | ---------------------------------- |
| `id` | ✅  | string | A UUID string identifying this 工具. |

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X DELETE "https://api.maiagent.ai/api/tools/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

// 請求內容 (payload)
const data = null;

axios.delete("https://api.maiagent.ai/api/tools/550e8400-e29b-41d4-a716-446655440000/", data, config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/tools/550e8400-e29b-41d4-a716-446655440000/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.delete(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->delete("https://api.maiagent.ai/api/tools/550e8400-e29b-41d4-a716-446655440000/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

| 狀態碼 | 說明               |
| --- | ---------------- |
| 204 | No response body |

***

### 刪除工具 <a href="#undefined" id="undefined"></a>

DELETE `/api/v1/tools/{id}/`

#### 參數

| 參數名稱 | 必填 | 類型     | 說明                                 |
| ---- | -- | ------ | ---------------------------------- |
| `id` | ✅  | string | A UUID string identifying this 工具. |

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X DELETE "https://api.maiagent.ai/api/v1/tools/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

// 請求內容 (payload)
const data = null;

axios.delete("https://api.maiagent.ai/api/v1/tools/550e8400-e29b-41d4-a716-446655440000/", data, config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/tools/550e8400-e29b-41d4-a716-446655440000/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.delete(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->delete("https://api.maiagent.ai/api/v1/tools/550e8400-e29b-41d4-a716-446655440000/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

| 狀態碼 | 說明               |
| --- | ---------------- |
| 204 | No response body |

***

### 建立連接器 <a href="#undefined" id="undefined"></a>

POST `/api/connectors/`

#### 請求內容

**請求參數**

| 欄位            | 類型            | 必填 | 說明                                                                           |
| ------------- | ------------- | -- | ---------------------------------------------------------------------------- |
| mcpRegistryId | string (uuid) | 是  |                                                                              |
| displayName   | string        | 否  | Custom display name for this connector (defaults to MCP Registry name)       |
| description   | string        | 否  | Custom description for this connector (defaults to MCP Registry description) |
| isEnabled     | boolean       | 否  | Whether this connector is enabled for contacts in the organization           |

**請求結構範例**

```typescript
{
  "mcpRegistryId": string (uuid)
  "displayName"?: string // Custom display name for this connector (defaults to MCP Registry name) (非必填)
  "description"?: string // Custom description for this connector (defaults to MCP Registry description) (非必填)
  "isEnabled"?: boolean // Whether this connector is enabled for contacts in the organization (非必填)
}
```

**請求範例值**

```json
{
  "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
  "displayName": "範例字串",
  "description": "範例字串",
  "isEnabled": true
}
```

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X POST "https://api.maiagent.ai/api/connectors/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
    "displayName": "範例字串",
    "description": "範例字串",
    "isEnabled": true
  }'

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
};

// 請求內容 (payload)
const data = {
    "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
    "displayName": "範例字串",
    "description": "範例字串",
    "isEnabled": true
  };

axios.post("https://api.maiagent.ai/api/connectors/", data, config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/connectors/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY",
    "Content-Type": "application/json"
}

# 請求內容 (payload)
data = {
      "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
      "displayName": "範例字串",
      "description": "範例字串",
      "isEnabled": true
    }

response = requests.post(url, json=data, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->post("https://api.maiagent.ai/api/connectors/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY',
            'Content-Type' => 'application/json'
        ],
        'json' => {
            "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
            "displayName": "範例字串",
            "description": "範例字串",
            "isEnabled": true
        }
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

**狀態碼: 201**

**回應結構範例**

```typescript
{
  "id": string (uuid)
  "mcpRegistry": 
  {
    "id": string (uuid)
    "name": string // MCP service name (e.g., Supabase, Sentry). Only alphanumeric, underscore and hyphen allowed.
    "displayName"?: string // Human-readable display name (defaults to name if empty) (非必填)
    "description": string // Brief description of the MCP service
    "remoteMcpUrl": string (uri) // The URL of the Remote MCP service
    "oauthServerUrl"?: string (uri) // OAuth server URL if different from MCP server (e.g., Supabase MCP is at mcp.supabase.com but OAuth is at api.supabase.com) (非必填)
    "logoUrl"?: string (uri) // CDN URL for the MCP service logo (for frontend rendering) (非必填)
    "isActive"?: boolean // Whether this MCP service is currently available for use (非必填)
    "createdAt": string (timestamp)
    "updatedAt": string (timestamp)
  }
  "mcpRegistryId": string (uuid)
  "name": string
  "displayName"?: string // Custom display name for this connector (defaults to MCP Registry name) (非必填)
  "description"?: string // Custom description for this connector (defaults to MCP Registry description) (非必填)
  "effectiveDescription": string
  "remoteMcpUrl": string
  "oauthServerUrl": string
  "logoUrl": string
  "isEnabled"?: boolean // Whether this connector is enabled for contacts in the organization (非必填)
  "organization": string (uuid)
  "createdBy": string (uuid)
  "createdAt": string (timestamp)
  "updatedAt": string (timestamp)
}
```

**回應範例值**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "mcpRegistry": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "回應字串",
    "displayName": "回應字串",
    "description": "回應字串",
    "remoteMcpUrl": "https://example.com/file.jpg",
    "oauthServerUrl": "https://example.com/file.jpg",
    "logoUrl": "https://example.com/file.jpg",
    "isActive": false,
    "createdAt": "回應字串",
    "updatedAt": "回應字串"
  },
  "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
  "name": "回應字串",
  "displayName": "回應字串",
  "description": "回應字串",
  "effectiveDescription": "回應字串",
  "remoteMcpUrl": "回應字串",
  "oauthServerUrl": "回應字串",
  "logoUrl": "回應字串",
  "isEnabled": false,
  "organization": "550e8400-e29b-41d4-a716-446655440000",
  "createdBy": "550e8400-e29b-41d4-a716-446655440000",
  "createdAt": "回應字串",
  "updatedAt": "回應字串"
}
```

***

### 建立連接器 <a href="#undefined" id="undefined"></a>

POST `/api/v1/connectors/`

#### 請求內容

**請求參數**

| 欄位            | 類型            | 必填 | 說明                                                                           |
| ------------- | ------------- | -- | ---------------------------------------------------------------------------- |
| mcpRegistryId | string (uuid) | 是  |                                                                              |
| displayName   | string        | 否  | Custom display name for this connector (defaults to MCP Registry name)       |
| description   | string        | 否  | Custom description for this connector (defaults to MCP Registry description) |
| isEnabled     | boolean       | 否  | Whether this connector is enabled for contacts in the organization           |

**請求結構範例**

```typescript
{
  "mcpRegistryId": string (uuid)
  "displayName"?: string // Custom display name for this connector (defaults to MCP Registry name) (非必填)
  "description"?: string // Custom description for this connector (defaults to MCP Registry description) (非必填)
  "isEnabled"?: boolean // Whether this connector is enabled for contacts in the organization (非必填)
}
```

**請求範例值**

```json
{
  "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
  "displayName": "範例字串",
  "description": "範例字串",
  "isEnabled": true
}
```

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X POST "https://api.maiagent.ai/api/v1/connectors/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
    "displayName": "範例字串",
    "description": "範例字串",
    "isEnabled": true
  }'

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
};

// 請求內容 (payload)
const data = {
    "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
    "displayName": "範例字串",
    "description": "範例字串",
    "isEnabled": true
  };

axios.post("https://api.maiagent.ai/api/v1/connectors/", data, config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/connectors/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY",
    "Content-Type": "application/json"
}

# 請求內容 (payload)
data = {
      "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
      "displayName": "範例字串",
      "description": "範例字串",
      "isEnabled": true
    }

response = requests.post(url, json=data, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->post("https://api.maiagent.ai/api/v1/connectors/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY',
            'Content-Type' => 'application/json'
        ],
        'json' => {
            "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
            "displayName": "範例字串",
            "description": "範例字串",
            "isEnabled": true
        }
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

**狀態碼: 201**

**回應結構範例**

```typescript
{
  "id": string (uuid)
  "mcpRegistry": 
  {
    "id": string (uuid)
    "name": string // MCP service name (e.g., Supabase, Sentry). Only alphanumeric, underscore and hyphen allowed.
    "displayName"?: string // Human-readable display name (defaults to name if empty) (非必填)
    "description": string // Brief description of the MCP service
    "remoteMcpUrl": string (uri) // The URL of the Remote MCP service
    "oauthServerUrl"?: string (uri) // OAuth server URL if different from MCP server (e.g., Supabase MCP is at mcp.supabase.com but OAuth is at api.supabase.com) (非必填)
    "logoUrl"?: string (uri) // CDN URL for the MCP service logo (for frontend rendering) (非必填)
    "isActive"?: boolean // Whether this MCP service is currently available for use (非必填)
    "createdAt": string (timestamp)
    "updatedAt": string (timestamp)
  }
  "mcpRegistryId": string (uuid)
  "name": string
  "displayName"?: string // Custom display name for this connector (defaults to MCP Registry name) (非必填)
  "description"?: string // Custom description for this connector (defaults to MCP Registry description) (非必填)
  "effectiveDescription": string
  "remoteMcpUrl": string
  "oauthServerUrl": string
  "logoUrl": string
  "isEnabled"?: boolean // Whether this connector is enabled for contacts in the organization (非必填)
  "organization": string (uuid)
  "createdBy": string (uuid)
  "createdAt": string (timestamp)
  "updatedAt": string (timestamp)
}
```

**回應範例值**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "mcpRegistry": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "回應字串",
    "displayName": "回應字串",
    "description": "回應字串",
    "remoteMcpUrl": "https://example.com/file.jpg",
    "oauthServerUrl": "https://example.com/file.jpg",
    "logoUrl": "https://example.com/file.jpg",
    "isActive": false,
    "createdAt": "回應字串",
    "updatedAt": "回應字串"
  },
  "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
  "name": "回應字串",
  "displayName": "回應字串",
  "description": "回應字串",
  "effectiveDescription": "回應字串",
  "remoteMcpUrl": "回應字串",
  "oauthServerUrl": "回應字串",
  "logoUrl": "回應字串",
  "isEnabled": false,
  "organization": "550e8400-e29b-41d4-a716-446655440000",
  "createdBy": "550e8400-e29b-41d4-a716-446655440000",
  "createdAt": "回應字串",
  "updatedAt": "回應字串"
}
```

***

### 列出連接器 <a href="#undefined" id="undefined"></a>

GET `/api/connectors/`

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X GET "https://api.maiagent.ai/api/connectors/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/connectors/", config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/connectors/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/connectors/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

**狀態碼: 200**

**回應結構範例**

```typescript
[
  {
    "id": string (uuid)
    "displayName"?: string // Custom display name for this connector (defaults to MCP Registry name) (非必填)
    "mcpRegistryName": string
    "mcpRegistryId": string
    "logoUrl": string
    "isEnabled"?: boolean // Whether this connector is enabled for contacts in the organization (非必填)
    "authorizedMembersCount": integer // 獲取已授權的 Member 數量
    "createdAt": string (timestamp)
    "updatedAt": string (timestamp)
  }
]
```

**回應範例值**

```json
[
  {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "displayName": "回應字串",
    "mcpRegistryName": "回應字串",
    "mcpRegistryId": "回應字串",
    "logoUrl": "回應字串",
    "isEnabled": false,
    "authorizedMembersCount": 456,
    "createdAt": "回應字串",
    "updatedAt": "回應字串"
  }
]
```

***

### 列出連接器 <a href="#undefined" id="undefined"></a>

GET `/api/v1/connectors/`

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X GET "https://api.maiagent.ai/api/v1/connectors/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/v1/connectors/", config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/connectors/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/v1/connectors/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

**狀態碼: 200**

**回應結構範例**

```typescript
[
  {
    "id": string (uuid)
    "displayName"?: string // Custom display name for this connector (defaults to MCP Registry name) (非必填)
    "mcpRegistryName": string
    "mcpRegistryId": string
    "logoUrl": string
    "isEnabled"?: boolean // Whether this connector is enabled for contacts in the organization (非必填)
    "authorizedMembersCount": integer // 獲取已授權的 Member 數量
    "createdAt": string (timestamp)
    "updatedAt": string (timestamp)
  }
]
```

**回應範例值**

```json
[
  {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "displayName": "回應字串",
    "mcpRegistryName": "回應字串",
    "mcpRegistryId": "回應字串",
    "logoUrl": "回應字串",
    "isEnabled": false,
    "authorizedMembersCount": 456,
    "createdAt": "回應字串",
    "updatedAt": "回應字串"
  }
]
```

***

### 取得特定連接器 <a href="#undefined" id="undefined"></a>

GET `/api/connectors/{id}/`

#### 參數

| 參數名稱 | 必填 | 類型     | 說明 |
| ---- | -- | ------ | -- |
| `id` | ✅  | string |    |

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X GET "https://api.maiagent.ai/api/connectors/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/connectors/550e8400-e29b-41d4-a716-446655440000/", config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/connectors/550e8400-e29b-41d4-a716-446655440000/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/connectors/550e8400-e29b-41d4-a716-446655440000/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

**狀態碼: 200**

**回應結構範例**

```typescript
{
  "id": string (uuid)
  "mcpRegistry": 
  {
    "id": string (uuid)
    "name": string // MCP service name (e.g., Supabase, Sentry). Only alphanumeric, underscore and hyphen allowed.
    "displayName"?: string // Human-readable display name (defaults to name if empty) (非必填)
    "description": string // Brief description of the MCP service
    "remoteMcpUrl": string (uri) // The URL of the Remote MCP service
    "oauthServerUrl"?: string (uri) // OAuth server URL if different from MCP server (e.g., Supabase MCP is at mcp.supabase.com but OAuth is at api.supabase.com) (非必填)
    "logoUrl"?: string (uri) // CDN URL for the MCP service logo (for frontend rendering) (非必填)
    "isActive"?: boolean // Whether this MCP service is currently available for use (非必填)
    "createdAt": string (timestamp)
    "updatedAt": string (timestamp)
  }
  "mcpRegistryId": string (uuid)
  "name": string
  "displayName"?: string // Custom display name for this connector (defaults to MCP Registry name) (非必填)
  "description"?: string // Custom description for this connector (defaults to MCP Registry description) (非必填)
  "effectiveDescription": string
  "remoteMcpUrl": string
  "oauthServerUrl": string
  "logoUrl": string
  "isEnabled"?: boolean // Whether this connector is enabled for contacts in the organization (非必填)
  "organization": string (uuid)
  "createdBy": string (uuid)
  "createdAt": string (timestamp)
  "updatedAt": string (timestamp)
}
```

**回應範例值**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "mcpRegistry": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "回應字串",
    "displayName": "回應字串",
    "description": "回應字串",
    "remoteMcpUrl": "https://example.com/file.jpg",
    "oauthServerUrl": "https://example.com/file.jpg",
    "logoUrl": "https://example.com/file.jpg",
    "isActive": false,
    "createdAt": "回應字串",
    "updatedAt": "回應字串"
  },
  "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
  "name": "回應字串",
  "displayName": "回應字串",
  "description": "回應字串",
  "effectiveDescription": "回應字串",
  "remoteMcpUrl": "回應字串",
  "oauthServerUrl": "回應字串",
  "logoUrl": "回應字串",
  "isEnabled": false,
  "organization": "550e8400-e29b-41d4-a716-446655440000",
  "createdBy": "550e8400-e29b-41d4-a716-446655440000",
  "createdAt": "回應字串",
  "updatedAt": "回應字串"
}
```

***

### 取得特定連接器 <a href="#undefined" id="undefined"></a>

GET `/api/v1/connectors/{id}/`

#### 參數

| 參數名稱 | 必填 | 類型     | 說明 |
| ---- | -- | ------ | -- |
| `id` | ✅  | string |    |

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X GET "https://api.maiagent.ai/api/v1/connectors/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/v1/connectors/550e8400-e29b-41d4-a716-446655440000/", config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/connectors/550e8400-e29b-41d4-a716-446655440000/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/v1/connectors/550e8400-e29b-41d4-a716-446655440000/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

**狀態碼: 200**

**回應結構範例**

```typescript
{
  "id": string (uuid)
  "mcpRegistry": 
  {
    "id": string (uuid)
    "name": string // MCP service name (e.g., Supabase, Sentry). Only alphanumeric, underscore and hyphen allowed.
    "displayName"?: string // Human-readable display name (defaults to name if empty) (非必填)
    "description": string // Brief description of the MCP service
    "remoteMcpUrl": string (uri) // The URL of the Remote MCP service
    "oauthServerUrl"?: string (uri) // OAuth server URL if different from MCP server (e.g., Supabase MCP is at mcp.supabase.com but OAuth is at api.supabase.com) (非必填)
    "logoUrl"?: string (uri) // CDN URL for the MCP service logo (for frontend rendering) (非必填)
    "isActive"?: boolean // Whether this MCP service is currently available for use (非必填)
    "createdAt": string (timestamp)
    "updatedAt": string (timestamp)
  }
  "mcpRegistryId": string (uuid)
  "name": string
  "displayName"?: string // Custom display name for this connector (defaults to MCP Registry name) (非必填)
  "description"?: string // Custom description for this connector (defaults to MCP Registry description) (非必填)
  "effectiveDescription": string
  "remoteMcpUrl": string
  "oauthServerUrl": string
  "logoUrl": string
  "isEnabled"?: boolean // Whether this connector is enabled for contacts in the organization (非必填)
  "organization": string (uuid)
  "createdBy": string (uuid)
  "createdAt": string (timestamp)
  "updatedAt": string (timestamp)
}
```

**回應範例值**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "mcpRegistry": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "回應字串",
    "displayName": "回應字串",
    "description": "回應字串",
    "remoteMcpUrl": "https://example.com/file.jpg",
    "oauthServerUrl": "https://example.com/file.jpg",
    "logoUrl": "https://example.com/file.jpg",
    "isActive": false,
    "createdAt": "回應字串",
    "updatedAt": "回應字串"
  },
  "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
  "name": "回應字串",
  "displayName": "回應字串",
  "description": "回應字串",
  "effectiveDescription": "回應字串",
  "remoteMcpUrl": "回應字串",
  "oauthServerUrl": "回應字串",
  "logoUrl": "回應字串",
  "isEnabled": false,
  "organization": "550e8400-e29b-41d4-a716-446655440000",
  "createdBy": "550e8400-e29b-41d4-a716-446655440000",
  "createdAt": "回應字串",
  "updatedAt": "回應字串"
}
```

***

### 更新連接器 <a href="#undefined" id="undefined"></a>

PUT `/api/connectors/{id}/`

#### 參數

| 參數名稱 | 必填 | 類型     | 說明 |
| ---- | -- | ------ | -- |
| `id` | ✅  | string |    |

#### 請求內容

**請求參數**

| 欄位            | 類型            | 必填 | 說明                                                                           |
| ------------- | ------------- | -- | ---------------------------------------------------------------------------- |
| mcpRegistryId | string (uuid) | 是  |                                                                              |
| displayName   | string        | 否  | Custom display name for this connector (defaults to MCP Registry name)       |
| description   | string        | 否  | Custom description for this connector (defaults to MCP Registry description) |
| isEnabled     | boolean       | 否  | Whether this connector is enabled for contacts in the organization           |

**請求結構範例**

```typescript
{
  "mcpRegistryId": string (uuid)
  "displayName"?: string // Custom display name for this connector (defaults to MCP Registry name) (非必填)
  "description"?: string // Custom description for this connector (defaults to MCP Registry description) (非必填)
  "isEnabled"?: boolean // Whether this connector is enabled for contacts in the organization (非必填)
}
```

**請求範例值**

```json
{
  "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
  "displayName": "範例字串",
  "description": "範例字串",
  "isEnabled": true
}
```

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X PUT "https://api.maiagent.ai/api/connectors/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
    "displayName": "範例字串",
    "description": "範例字串",
    "isEnabled": true
  }'

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
};

// 請求內容 (payload)
const data = {
    "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
    "displayName": "範例字串",
    "description": "範例字串",
    "isEnabled": true
  };

axios.put("https://api.maiagent.ai/api/connectors/550e8400-e29b-41d4-a716-446655440000/", data, config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/connectors/550e8400-e29b-41d4-a716-446655440000/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY",
    "Content-Type": "application/json"
}

# 請求內容 (payload)
data = {
      "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
      "displayName": "範例字串",
      "description": "範例字串",
      "isEnabled": true
    }

response = requests.put(url, json=data, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->put("https://api.maiagent.ai/api/connectors/550e8400-e29b-41d4-a716-446655440000/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY',
            'Content-Type' => 'application/json'
        ],
        'json' => {
            "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
            "displayName": "範例字串",
            "description": "範例字串",
            "isEnabled": true
        }
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

**狀態碼: 200**

**回應結構範例**

```typescript
{
  "id": string (uuid)
  "mcpRegistry": 
  {
    "id": string (uuid)
    "name": string // MCP service name (e.g., Supabase, Sentry). Only alphanumeric, underscore and hyphen allowed.
    "displayName"?: string // Human-readable display name (defaults to name if empty) (非必填)
    "description": string // Brief description of the MCP service
    "remoteMcpUrl": string (uri) // The URL of the Remote MCP service
    "oauthServerUrl"?: string (uri) // OAuth server URL if different from MCP server (e.g., Supabase MCP is at mcp.supabase.com but OAuth is at api.supabase.com) (非必填)
    "logoUrl"?: string (uri) // CDN URL for the MCP service logo (for frontend rendering) (非必填)
    "isActive"?: boolean // Whether this MCP service is currently available for use (非必填)
    "createdAt": string (timestamp)
    "updatedAt": string (timestamp)
  }
  "mcpRegistryId": string (uuid)
  "name": string
  "displayName"?: string // Custom display name for this connector (defaults to MCP Registry name) (非必填)
  "description"?: string // Custom description for this connector (defaults to MCP Registry description) (非必填)
  "effectiveDescription": string
  "remoteMcpUrl": string
  "oauthServerUrl": string
  "logoUrl": string
  "isEnabled"?: boolean // Whether this connector is enabled for contacts in the organization (非必填)
  "organization": string (uuid)
  "createdBy": string (uuid)
  "createdAt": string (timestamp)
  "updatedAt": string (timestamp)
}
```

**回應範例值**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "mcpRegistry": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "回應字串",
    "displayName": "回應字串",
    "description": "回應字串",
    "remoteMcpUrl": "https://example.com/file.jpg",
    "oauthServerUrl": "https://example.com/file.jpg",
    "logoUrl": "https://example.com/file.jpg",
    "isActive": false,
    "createdAt": "回應字串",
    "updatedAt": "回應字串"
  },
  "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
  "name": "回應字串",
  "displayName": "回應字串",
  "description": "回應字串",
  "effectiveDescription": "回應字串",
  "remoteMcpUrl": "回應字串",
  "oauthServerUrl": "回應字串",
  "logoUrl": "回應字串",
  "isEnabled": false,
  "organization": "550e8400-e29b-41d4-a716-446655440000",
  "createdBy": "550e8400-e29b-41d4-a716-446655440000",
  "createdAt": "回應字串",
  "updatedAt": "回應字串"
}
```

***

### 更新連接器 <a href="#undefined" id="undefined"></a>

PUT `/api/v1/connectors/{id}/`

#### 參數

| 參數名稱 | 必填 | 類型     | 說明 |
| ---- | -- | ------ | -- |
| `id` | ✅  | string |    |

#### 請求內容

**請求參數**

| 欄位            | 類型            | 必填 | 說明                                                                           |
| ------------- | ------------- | -- | ---------------------------------------------------------------------------- |
| mcpRegistryId | string (uuid) | 是  |                                                                              |
| displayName   | string        | 否  | Custom display name for this connector (defaults to MCP Registry name)       |
| description   | string        | 否  | Custom description for this connector (defaults to MCP Registry description) |
| isEnabled     | boolean       | 否  | Whether this connector is enabled for contacts in the organization           |

**請求結構範例**

```typescript
{
  "mcpRegistryId": string (uuid)
  "displayName"?: string // Custom display name for this connector (defaults to MCP Registry name) (非必填)
  "description"?: string // Custom description for this connector (defaults to MCP Registry description) (非必填)
  "isEnabled"?: boolean // Whether this connector is enabled for contacts in the organization (非必填)
}
```

**請求範例值**

```json
{
  "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
  "displayName": "範例字串",
  "description": "範例字串",
  "isEnabled": true
}
```

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X PUT "https://api.maiagent.ai/api/v1/connectors/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
    "displayName": "範例字串",
    "description": "範例字串",
    "isEnabled": true
  }'

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
};

// 請求內容 (payload)
const data = {
    "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
    "displayName": "範例字串",
    "description": "範例字串",
    "isEnabled": true
  };

axios.put("https://api.maiagent.ai/api/v1/connectors/550e8400-e29b-41d4-a716-446655440000/", data, config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/connectors/550e8400-e29b-41d4-a716-446655440000/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY",
    "Content-Type": "application/json"
}

# 請求內容 (payload)
data = {
      "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
      "displayName": "範例字串",
      "description": "範例字串",
      "isEnabled": true
    }

response = requests.put(url, json=data, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->put("https://api.maiagent.ai/api/v1/connectors/550e8400-e29b-41d4-a716-446655440000/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY',
            'Content-Type' => 'application/json'
        ],
        'json' => {
            "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
            "displayName": "範例字串",
            "description": "範例字串",
            "isEnabled": true
        }
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

**狀態碼: 200**

**回應結構範例**

```typescript
{
  "id": string (uuid)
  "mcpRegistry": 
  {
    "id": string (uuid)
    "name": string // MCP service name (e.g., Supabase, Sentry). Only alphanumeric, underscore and hyphen allowed.
    "displayName"?: string // Human-readable display name (defaults to name if empty) (非必填)
    "description": string // Brief description of the MCP service
    "remoteMcpUrl": string (uri) // The URL of the Remote MCP service
    "oauthServerUrl"?: string (uri) // OAuth server URL if different from MCP server (e.g., Supabase MCP is at mcp.supabase.com but OAuth is at api.supabase.com) (非必填)
    "logoUrl"?: string (uri) // CDN URL for the MCP service logo (for frontend rendering) (非必填)
    "isActive"?: boolean // Whether this MCP service is currently available for use (非必填)
    "createdAt": string (timestamp)
    "updatedAt": string (timestamp)
  }
  "mcpRegistryId": string (uuid)
  "name": string
  "displayName"?: string // Custom display name for this connector (defaults to MCP Registry name) (非必填)
  "description"?: string // Custom description for this connector (defaults to MCP Registry description) (非必填)
  "effectiveDescription": string
  "remoteMcpUrl": string
  "oauthServerUrl": string
  "logoUrl": string
  "isEnabled"?: boolean // Whether this connector is enabled for contacts in the organization (非必填)
  "organization": string (uuid)
  "createdBy": string (uuid)
  "createdAt": string (timestamp)
  "updatedAt": string (timestamp)
}
```

**回應範例值**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "mcpRegistry": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "回應字串",
    "displayName": "回應字串",
    "description": "回應字串",
    "remoteMcpUrl": "https://example.com/file.jpg",
    "oauthServerUrl": "https://example.com/file.jpg",
    "logoUrl": "https://example.com/file.jpg",
    "isActive": false,
    "createdAt": "回應字串",
    "updatedAt": "回應字串"
  },
  "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
  "name": "回應字串",
  "displayName": "回應字串",
  "description": "回應字串",
  "effectiveDescription": "回應字串",
  "remoteMcpUrl": "回應字串",
  "oauthServerUrl": "回應字串",
  "logoUrl": "回應字串",
  "isEnabled": false,
  "organization": "550e8400-e29b-41d4-a716-446655440000",
  "createdBy": "550e8400-e29b-41d4-a716-446655440000",
  "createdAt": "回應字串",
  "updatedAt": "回應字串"
}
```

***

### 部分更新連接器 <a href="#undefined" id="undefined"></a>

PATCH `/api/connectors/{id}/`

#### 參數

| 參數名稱 | 必填 | 類型     | 說明 |
| ---- | -- | ------ | -- |
| `id` | ✅  | string |    |

#### 請求內容

**請求參數**

| 欄位            | 類型            | 必填 | 說明                                                                           |
| ------------- | ------------- | -- | ---------------------------------------------------------------------------- |
| mcpRegistryId | string (uuid) | 否  |                                                                              |
| displayName   | string        | 否  | Custom display name for this connector (defaults to MCP Registry name)       |
| description   | string        | 否  | Custom description for this connector (defaults to MCP Registry description) |
| isEnabled     | boolean       | 否  | Whether this connector is enabled for contacts in the organization           |

**請求結構範例**

```typescript
{
  "mcpRegistryId"?: string (uuid) // 非必填
  "displayName"?: string // Custom display name for this connector (defaults to MCP Registry name) (非必填)
  "description"?: string // Custom description for this connector (defaults to MCP Registry description) (非必填)
  "isEnabled"?: boolean // Whether this connector is enabled for contacts in the organization (非必填)
}
```

**請求範例值**

```json
{
  "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
  "displayName": "範例字串",
  "description": "範例字串",
  "isEnabled": true
}
```

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X PATCH "https://api.maiagent.ai/api/connectors/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
    "displayName": "範例字串",
    "description": "範例字串",
    "isEnabled": true
  }'

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
};

// 請求內容 (payload)
const data = {
    "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
    "displayName": "範例字串",
    "description": "範例字串",
    "isEnabled": true
  };

axios.patch("https://api.maiagent.ai/api/connectors/550e8400-e29b-41d4-a716-446655440000/", data, config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/connectors/550e8400-e29b-41d4-a716-446655440000/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY",
    "Content-Type": "application/json"
}

# 請求內容 (payload)
data = {
      "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
      "displayName": "範例字串",
      "description": "範例字串",
      "isEnabled": true
    }

response = requests.patch(url, json=data, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->patch("https://api.maiagent.ai/api/connectors/550e8400-e29b-41d4-a716-446655440000/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY',
            'Content-Type' => 'application/json'
        ],
        'json' => {
            "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
            "displayName": "範例字串",
            "description": "範例字串",
            "isEnabled": true
        }
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

**狀態碼: 200**

**回應結構範例**

```typescript
{
  "id": string (uuid)
  "mcpRegistry": 
  {
    "id": string (uuid)
    "name": string // MCP service name (e.g., Supabase, Sentry). Only alphanumeric, underscore and hyphen allowed.
    "displayName"?: string // Human-readable display name (defaults to name if empty) (非必填)
    "description": string // Brief description of the MCP service
    "remoteMcpUrl": string (uri) // The URL of the Remote MCP service
    "oauthServerUrl"?: string (uri) // OAuth server URL if different from MCP server (e.g., Supabase MCP is at mcp.supabase.com but OAuth is at api.supabase.com) (非必填)
    "logoUrl"?: string (uri) // CDN URL for the MCP service logo (for frontend rendering) (非必填)
    "isActive"?: boolean // Whether this MCP service is currently available for use (非必填)
    "createdAt": string (timestamp)
    "updatedAt": string (timestamp)
  }
  "mcpRegistryId": string (uuid)
  "name": string
  "displayName"?: string // Custom display name for this connector (defaults to MCP Registry name) (非必填)
  "description"?: string // Custom description for this connector (defaults to MCP Registry description) (非必填)
  "effectiveDescription": string
  "remoteMcpUrl": string
  "oauthServerUrl": string
  "logoUrl": string
  "isEnabled"?: boolean // Whether this connector is enabled for contacts in the organization (非必填)
  "organization": string (uuid)
  "createdBy": string (uuid)
  "createdAt": string (timestamp)
  "updatedAt": string (timestamp)
}
```

**回應範例值**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "mcpRegistry": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "回應字串",
    "displayName": "回應字串",
    "description": "回應字串",
    "remoteMcpUrl": "https://example.com/file.jpg",
    "oauthServerUrl": "https://example.com/file.jpg",
    "logoUrl": "https://example.com/file.jpg",
    "isActive": false,
    "createdAt": "回應字串",
    "updatedAt": "回應字串"
  },
  "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
  "name": "回應字串",
  "displayName": "回應字串",
  "description": "回應字串",
  "effectiveDescription": "回應字串",
  "remoteMcpUrl": "回應字串",
  "oauthServerUrl": "回應字串",
  "logoUrl": "回應字串",
  "isEnabled": false,
  "organization": "550e8400-e29b-41d4-a716-446655440000",
  "createdBy": "550e8400-e29b-41d4-a716-446655440000",
  "createdAt": "回應字串",
  "updatedAt": "回應字串"
}
```

***

### 部分更新連接器 <a href="#undefined" id="undefined"></a>

PATCH `/api/v1/connectors/{id}/`

#### 參數

| 參數名稱 | 必填 | 類型     | 說明 |
| ---- | -- | ------ | -- |
| `id` | ✅  | string |    |

#### 請求內容

**請求參數**

| 欄位            | 類型            | 必填 | 說明                                                                           |
| ------------- | ------------- | -- | ---------------------------------------------------------------------------- |
| mcpRegistryId | string (uuid) | 否  |                                                                              |
| displayName   | string        | 否  | Custom display name for this connector (defaults to MCP Registry name)       |
| description   | string        | 否  | Custom description for this connector (defaults to MCP Registry description) |
| isEnabled     | boolean       | 否  | Whether this connector is enabled for contacts in the organization           |

**請求結構範例**

```typescript
{
  "mcpRegistryId"?: string (uuid) // 非必填
  "displayName"?: string // Custom display name for this connector (defaults to MCP Registry name) (非必填)
  "description"?: string // Custom description for this connector (defaults to MCP Registry description) (非必填)
  "isEnabled"?: boolean // Whether this connector is enabled for contacts in the organization (非必填)
}
```

**請求範例值**

```json
{
  "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
  "displayName": "範例字串",
  "description": "範例字串",
  "isEnabled": true
}
```

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X PATCH "https://api.maiagent.ai/api/v1/connectors/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
    "displayName": "範例字串",
    "description": "範例字串",
    "isEnabled": true
  }'

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY',
    'Content-Type': 'application/json'
  }
};

// 請求內容 (payload)
const data = {
    "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
    "displayName": "範例字串",
    "description": "範例字串",
    "isEnabled": true
  };

axios.patch("https://api.maiagent.ai/api/v1/connectors/550e8400-e29b-41d4-a716-446655440000/", data, config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/connectors/550e8400-e29b-41d4-a716-446655440000/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY",
    "Content-Type": "application/json"
}

# 請求內容 (payload)
data = {
      "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
      "displayName": "範例字串",
      "description": "範例字串",
      "isEnabled": true
    }

response = requests.patch(url, json=data, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->patch("https://api.maiagent.ai/api/v1/connectors/550e8400-e29b-41d4-a716-446655440000/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY',
            'Content-Type' => 'application/json'
        ],
        'json' => {
            "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
            "displayName": "範例字串",
            "description": "範例字串",
            "isEnabled": true
        }
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

**狀態碼: 200**

**回應結構範例**

```typescript
{
  "id": string (uuid)
  "mcpRegistry": 
  {
    "id": string (uuid)
    "name": string // MCP service name (e.g., Supabase, Sentry). Only alphanumeric, underscore and hyphen allowed.
    "displayName"?: string // Human-readable display name (defaults to name if empty) (非必填)
    "description": string // Brief description of the MCP service
    "remoteMcpUrl": string (uri) // The URL of the Remote MCP service
    "oauthServerUrl"?: string (uri) // OAuth server URL if different from MCP server (e.g., Supabase MCP is at mcp.supabase.com but OAuth is at api.supabase.com) (非必填)
    "logoUrl"?: string (uri) // CDN URL for the MCP service logo (for frontend rendering) (非必填)
    "isActive"?: boolean // Whether this MCP service is currently available for use (非必填)
    "createdAt": string (timestamp)
    "updatedAt": string (timestamp)
  }
  "mcpRegistryId": string (uuid)
  "name": string
  "displayName"?: string // Custom display name for this connector (defaults to MCP Registry name) (非必填)
  "description"?: string // Custom description for this connector (defaults to MCP Registry description) (非必填)
  "effectiveDescription": string
  "remoteMcpUrl": string
  "oauthServerUrl": string
  "logoUrl": string
  "isEnabled"?: boolean // Whether this connector is enabled for contacts in the organization (非必填)
  "organization": string (uuid)
  "createdBy": string (uuid)
  "createdAt": string (timestamp)
  "updatedAt": string (timestamp)
}
```

**回應範例值**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "mcpRegistry": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "回應字串",
    "displayName": "回應字串",
    "description": "回應字串",
    "remoteMcpUrl": "https://example.com/file.jpg",
    "oauthServerUrl": "https://example.com/file.jpg",
    "logoUrl": "https://example.com/file.jpg",
    "isActive": false,
    "createdAt": "回應字串",
    "updatedAt": "回應字串"
  },
  "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
  "name": "回應字串",
  "displayName": "回應字串",
  "description": "回應字串",
  "effectiveDescription": "回應字串",
  "remoteMcpUrl": "回應字串",
  "oauthServerUrl": "回應字串",
  "logoUrl": "回應字串",
  "isEnabled": false,
  "organization": "550e8400-e29b-41d4-a716-446655440000",
  "createdBy": "550e8400-e29b-41d4-a716-446655440000",
  "createdAt": "回應字串",
  "updatedAt": "回應字串"
}
```

***

### 刪除連接器 <a href="#undefined" id="undefined"></a>

DELETE `/api/connectors/{id}/`

#### 參數

| 參數名稱 | 必填 | 類型     | 說明 |
| ---- | -- | ------ | -- |
| `id` | ✅  | string |    |

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X DELETE "https://api.maiagent.ai/api/connectors/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

// 請求內容 (payload)
const data = null;

axios.delete("https://api.maiagent.ai/api/connectors/550e8400-e29b-41d4-a716-446655440000/", data, config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/connectors/550e8400-e29b-41d4-a716-446655440000/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.delete(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->delete("https://api.maiagent.ai/api/connectors/550e8400-e29b-41d4-a716-446655440000/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

| 狀態碼 | 說明               |
| --- | ---------------- |
| 204 | No response body |

***

### 刪除連接器 <a href="#undefined" id="undefined"></a>

DELETE `/api/v1/connectors/{id}/`

#### 參數

| 參數名稱 | 必填 | 類型     | 說明 |
| ---- | -- | ------ | -- |
| `id` | ✅  | string |    |

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X DELETE "https://api.maiagent.ai/api/v1/connectors/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

// 請求內容 (payload)
const data = null;

axios.delete("https://api.maiagent.ai/api/v1/connectors/550e8400-e29b-41d4-a716-446655440000/", data, config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/connectors/550e8400-e29b-41d4-a716-446655440000/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.delete(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->delete("https://api.maiagent.ai/api/v1/connectors/550e8400-e29b-41d4-a716-446655440000/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

| 狀態碼 | 說明               |
| --- | ---------------- |
| 204 | No response body |

***

### 列出連接器授權成員 <a href="#undefined" id="undefined"></a>

GET `/api/connectors/{id}/authorized-members/`

#### 參數

| 參數名稱 | 必填 | 類型     | 說明 |
| ---- | -- | ------ | -- |
| `id` | ✅  | string |    |

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X GET "https://api.maiagent.ai/api/connectors/550e8400-e29b-41d4-a716-446655440000/authorized-members/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/connectors/550e8400-e29b-41d4-a716-446655440000/authorized-members/", config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/connectors/550e8400-e29b-41d4-a716-446655440000/authorized-members/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/connectors/550e8400-e29b-41d4-a716-446655440000/authorized-members/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

**狀態碼: 200**

**回應結構範例**

```typescript
{
  "id": string (uuid)
  "mcpRegistry": 
  {
    "id": string (uuid)
    "name": string // MCP service name (e.g., Supabase, Sentry). Only alphanumeric, underscore and hyphen allowed.
    "displayName"?: string // Human-readable display name (defaults to name if empty) (非必填)
    "description": string // Brief description of the MCP service
    "remoteMcpUrl": string (uri) // The URL of the Remote MCP service
    "oauthServerUrl"?: string (uri) // OAuth server URL if different from MCP server (e.g., Supabase MCP is at mcp.supabase.com but OAuth is at api.supabase.com) (非必填)
    "logoUrl"?: string (uri) // CDN URL for the MCP service logo (for frontend rendering) (非必填)
    "isActive"?: boolean // Whether this MCP service is currently available for use (非必填)
    "createdAt": string (timestamp)
    "updatedAt": string (timestamp)
  }
  "mcpRegistryId": string (uuid)
  "name": string
  "displayName"?: string // Custom display name for this connector (defaults to MCP Registry name) (非必填)
  "description"?: string // Custom description for this connector (defaults to MCP Registry description) (非必填)
  "effectiveDescription": string
  "remoteMcpUrl": string
  "oauthServerUrl": string
  "logoUrl": string
  "isEnabled"?: boolean // Whether this connector is enabled for contacts in the organization (非必填)
  "organization": string (uuid)
  "createdBy": string (uuid)
  "createdAt": string (timestamp)
  "updatedAt": string (timestamp)
}
```

**回應範例值**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "mcpRegistry": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "回應字串",
    "displayName": "回應字串",
    "description": "回應字串",
    "remoteMcpUrl": "https://example.com/file.jpg",
    "oauthServerUrl": "https://example.com/file.jpg",
    "logoUrl": "https://example.com/file.jpg",
    "isActive": false,
    "createdAt": "回應字串",
    "updatedAt": "回應字串"
  },
  "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
  "name": "回應字串",
  "displayName": "回應字串",
  "description": "回應字串",
  "effectiveDescription": "回應字串",
  "remoteMcpUrl": "回應字串",
  "oauthServerUrl": "回應字串",
  "logoUrl": "回應字串",
  "isEnabled": false,
  "organization": "550e8400-e29b-41d4-a716-446655440000",
  "createdBy": "550e8400-e29b-41d4-a716-446655440000",
  "createdAt": "回應字串",
  "updatedAt": "回應字串"
}
```

***

### 列出連接器授權成員 <a href="#undefined" id="undefined"></a>

GET `/api/v1/connectors/{id}/authorized-members/`

#### 參數

| 參數名稱 | 必填 | 類型     | 說明 |
| ---- | -- | ------ | -- |
| `id` | ✅  | string |    |

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X GET "https://api.maiagent.ai/api/v1/connectors/550e8400-e29b-41d4-a716-446655440000/authorized-members/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/v1/connectors/550e8400-e29b-41d4-a716-446655440000/authorized-members/", config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/connectors/550e8400-e29b-41d4-a716-446655440000/authorized-members/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/v1/connectors/550e8400-e29b-41d4-a716-446655440000/authorized-members/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

**狀態碼: 200**

**回應結構範例**

```typescript
{
  "id": string (uuid)
  "mcpRegistry": 
  {
    "id": string (uuid)
    "name": string // MCP service name (e.g., Supabase, Sentry). Only alphanumeric, underscore and hyphen allowed.
    "displayName"?: string // Human-readable display name (defaults to name if empty) (非必填)
    "description": string // Brief description of the MCP service
    "remoteMcpUrl": string (uri) // The URL of the Remote MCP service
    "oauthServerUrl"?: string (uri) // OAuth server URL if different from MCP server (e.g., Supabase MCP is at mcp.supabase.com but OAuth is at api.supabase.com) (非必填)
    "logoUrl"?: string (uri) // CDN URL for the MCP service logo (for frontend rendering) (非必填)
    "isActive"?: boolean // Whether this MCP service is currently available for use (非必填)
    "createdAt": string (timestamp)
    "updatedAt": string (timestamp)
  }
  "mcpRegistryId": string (uuid)
  "name": string
  "displayName"?: string // Custom display name for this connector (defaults to MCP Registry name) (非必填)
  "description"?: string // Custom description for this connector (defaults to MCP Registry description) (非必填)
  "effectiveDescription": string
  "remoteMcpUrl": string
  "oauthServerUrl": string
  "logoUrl": string
  "isEnabled"?: boolean // Whether this connector is enabled for contacts in the organization (非必填)
  "organization": string (uuid)
  "createdBy": string (uuid)
  "createdAt": string (timestamp)
  "updatedAt": string (timestamp)
}
```

**回應範例值**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "mcpRegistry": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "回應字串",
    "displayName": "回應字串",
    "description": "回應字串",
    "remoteMcpUrl": "https://example.com/file.jpg",
    "oauthServerUrl": "https://example.com/file.jpg",
    "logoUrl": "https://example.com/file.jpg",
    "isActive": false,
    "createdAt": "回應字串",
    "updatedAt": "回應字串"
  },
  "mcpRegistryId": "550e8400-e29b-41d4-a716-446655440000",
  "name": "回應字串",
  "displayName": "回應字串",
  "description": "回應字串",
  "effectiveDescription": "回應字串",
  "remoteMcpUrl": "回應字串",
  "oauthServerUrl": "回應字串",
  "logoUrl": "回應字串",
  "isEnabled": false,
  "organization": "550e8400-e29b-41d4-a716-446655440000",
  "createdBy": "550e8400-e29b-41d4-a716-446655440000",
  "createdAt": "回應字串",
  "updatedAt": "回應字串"
}
```

***

### 移除連接器授權成員 <a href="#undefined" id="undefined"></a>

DELETE `/api/connectors/{id}/authorized-members/{memberId}/`

#### 參數

| 參數名稱       | 必填 | 類型     | 說明 |
| ---------- | -- | ------ | -- |
| `id`       | ✅  | string |    |
| `memberId` | ✅  | string |    |

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X DELETE "https://api.maiagent.ai/api/connectors/550e8400-e29b-41d4-a716-446655440000/authorized-members/{memberId}/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

// 請求內容 (payload)
const data = null;

axios.delete("https://api.maiagent.ai/api/connectors/550e8400-e29b-41d4-a716-446655440000/authorized-members/{memberId}/", data, config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/connectors/550e8400-e29b-41d4-a716-446655440000/authorized-members/{memberId}/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.delete(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->delete("https://api.maiagent.ai/api/connectors/550e8400-e29b-41d4-a716-446655440000/authorized-members/{memberId}/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

| 狀態碼 | 說明               |
| --- | ---------------- |
| 204 | No response body |

***

### 移除連接器授權成員 <a href="#undefined" id="undefined"></a>

DELETE `/api/v1/connectors/{id}/authorized-members/{memberId}/`

#### 參數

| 參數名稱       | 必填 | 類型     | 說明 |
| ---------- | -- | ------ | -- |
| `id`       | ✅  | string |    |
| `memberId` | ✅  | string |    |

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X DELETE "https://api.maiagent.ai/api/v1/connectors/550e8400-e29b-41d4-a716-446655440000/authorized-members/{memberId}/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

// 請求內容 (payload)
const data = null;

axios.delete("https://api.maiagent.ai/api/v1/connectors/550e8400-e29b-41d4-a716-446655440000/authorized-members/{memberId}/", data, config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/connectors/550e8400-e29b-41d4-a716-446655440000/authorized-members/{memberId}/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.delete(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->delete("https://api.maiagent.ai/api/v1/connectors/550e8400-e29b-41d4-a716-446655440000/authorized-members/{memberId}/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

| 狀態碼 | 說明               |
| --- | ---------------- |
| 204 | No response body |

***

### 列出 MCP 工具登錄 <a href="#mcp" id="mcp"></a>

GET `/api/mcp/registry/`

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X GET "https://api.maiagent.ai/api/mcp/registry/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/mcp/registry/", config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/mcp/registry/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/mcp/registry/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

**狀態碼: 200**

**回應結構範例**

```typescript
[
  {
    "id": string (uuid)
    "name": string // MCP service name (e.g., Supabase, Sentry). Only alphanumeric, underscore and hyphen allowed.
    "displayName"?: string // Human-readable display name (defaults to name if empty) (非必填)
    "description": string // Brief description of the MCP service
    "remoteMcpUrl": string (uri) // The URL of the Remote MCP service
    "oauthServerUrl"?: string (uri) // OAuth server URL if different from MCP server (e.g., Supabase MCP is at mcp.supabase.com but OAuth is at api.supabase.com) (非必填)
    "logoUrl"?: string (uri) // CDN URL for the MCP service logo (for frontend rendering) (非必填)
    "isActive"?: boolean // Whether this MCP service is currently available for use (非必填)
    "createdAt": string (timestamp)
    "updatedAt": string (timestamp)
  }
]
```

**回應範例值**

```json
[
  {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "回應字串",
    "displayName": "回應字串",
    "description": "回應字串",
    "remoteMcpUrl": "https://example.com/file.jpg",
    "oauthServerUrl": "https://example.com/file.jpg",
    "logoUrl": "https://example.com/file.jpg",
    "isActive": false,
    "createdAt": "回應字串",
    "updatedAt": "回應字串"
  }
]
```

***

### 列出 MCP 工具登錄 <a href="#mcp" id="mcp"></a>

GET `/api/v1/mcp/registry/`

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X GET "https://api.maiagent.ai/api/v1/mcp/registry/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/v1/mcp/registry/", config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/mcp/registry/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/v1/mcp/registry/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

**狀態碼: 200**

**回應結構範例**

```typescript
[
  {
    "id": string (uuid)
    "name": string // MCP service name (e.g., Supabase, Sentry). Only alphanumeric, underscore and hyphen allowed.
    "displayName"?: string // Human-readable display name (defaults to name if empty) (非必填)
    "description": string // Brief description of the MCP service
    "remoteMcpUrl": string (uri) // The URL of the Remote MCP service
    "oauthServerUrl"?: string (uri) // OAuth server URL if different from MCP server (e.g., Supabase MCP is at mcp.supabase.com but OAuth is at api.supabase.com) (非必填)
    "logoUrl"?: string (uri) // CDN URL for the MCP service logo (for frontend rendering) (非必填)
    "isActive"?: boolean // Whether this MCP service is currently available for use (非必填)
    "createdAt": string (timestamp)
    "updatedAt": string (timestamp)
  }
]
```

**回應範例值**

```json
[
  {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "回應字串",
    "displayName": "回應字串",
    "description": "回應字串",
    "remoteMcpUrl": "https://example.com/file.jpg",
    "oauthServerUrl": "https://example.com/file.jpg",
    "logoUrl": "https://example.com/file.jpg",
    "isActive": false,
    "createdAt": "回應字串",
    "updatedAt": "回應字串"
  }
]
```

***

### 取得特定 MCP 工具登錄 <a href="#mcp" id="mcp"></a>

GET `/api/mcp/registry/{id}/`

#### 參數

| 參數名稱 | 必填 | 類型     | 說明                                           |
| ---- | -- | ------ | -------------------------------------------- |
| `id` | ✅  | string | A UUID string identifying this MCP Registry. |

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X GET "https://api.maiagent.ai/api/mcp/registry/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/mcp/registry/550e8400-e29b-41d4-a716-446655440000/", config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/mcp/registry/550e8400-e29b-41d4-a716-446655440000/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/mcp/registry/550e8400-e29b-41d4-a716-446655440000/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

**狀態碼: 200**

**回應結構範例**

```typescript
{
  "id": string (uuid)
  "name": string // MCP service name (e.g., Supabase, Sentry). Only alphanumeric, underscore and hyphen allowed.
  "displayName"?: string // Human-readable display name (defaults to name if empty) (非必填)
  "description": string // Brief description of the MCP service
  "remoteMcpUrl": string (uri) // The URL of the Remote MCP service
  "oauthServerUrl"?: string (uri) // OAuth server URL if different from MCP server (e.g., Supabase MCP is at mcp.supabase.com but OAuth is at api.supabase.com) (非必填)
  "logoUrl"?: string (uri) // CDN URL for the MCP service logo (for frontend rendering) (非必填)
  "isActive"?: boolean // Whether this MCP service is currently available for use (非必填)
  "createdAt": string (timestamp)
  "updatedAt": string (timestamp)
}
```

**回應範例值**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "回應字串",
  "displayName": "回應字串",
  "description": "回應字串",
  "remoteMcpUrl": "https://example.com/file.jpg",
  "oauthServerUrl": "https://example.com/file.jpg",
  "logoUrl": "https://example.com/file.jpg",
  "isActive": false,
  "createdAt": "回應字串",
  "updatedAt": "回應字串"
}
```

***

### 取得特定 MCP 工具登錄 <a href="#mcp" id="mcp"></a>

GET `/api/v1/mcp/registry/{id}/`

#### 參數

| 參數名稱 | 必填 | 類型     | 說明                                           |
| ---- | -- | ------ | -------------------------------------------- |
| `id` | ✅  | string | A UUID string identifying this MCP Registry. |

#### 程式碼範例

{% tabs %}
{% tab title="Shell/Bash" %}

```bash
# 呼叫 API 示例 (Shell)
curl -X GET "https://api.maiagent.ai/api/v1/mcp/registry/550e8400-e29b-41d4-a716-446655440000/" \
  -H "Authorization: Api-Key YOUR_API_KEY"

# 請確認在執行前替換 YOUR_API_KEY 並核對請求資料。
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

// 設定請求標頭
const config = {
  headers: {
    'Authorization': 'Api-Key YOUR_API_KEY'
  }
};

axios.get("https://api.maiagent.ai/api/v1/mcp/registry/550e8400-e29b-41d4-a716-446655440000/", config)
  .then(response => {
    console.log('成功取得回應:');
    console.log(response.data);
  })
  .catch(error => {
    console.error('請求發生錯誤:');
    console.error(error.response?.data || error.message);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.maiagent.ai/api/v1/mcp/registry/550e8400-e29b-41d4-a716-446655440000/"
headers = {
    "Authorization": "Api-Key YOUR_API_KEY"
}


response = requests.get(url, headers=headers)
try:
    print("成功取得回應:")
    print(response.json())
except Exception as e:
    print("請求發生錯誤:", e)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
require 'vendor/autoload.php';

$client = new GuzzleHttp\Client();

try {
    $response = $client->get("https://api.maiagent.ai/api/v1/mcp/registry/550e8400-e29b-41d4-a716-446655440000/", [
        'headers' => [
            'Authorization' => 'Api-Key YOUR_API_KEY'
        ]
    ]);
    
    $data = json_decode($response->getBody(), true);
    echo "成功取得回應:\n";
    print_r($data);
} catch (Exception $e) {
    echo '請求發生錯誤: ' . $e->getMessage();
}
?>
```

{% endtab %}
{% endtabs %}

#### 回應內容

**狀態碼: 200**

**回應結構範例**

```typescript
{
  "id": string (uuid)
  "name": string // MCP service name (e.g., Supabase, Sentry). Only alphanumeric, underscore and hyphen allowed.
  "displayName"?: string // Human-readable display name (defaults to name if empty) (非必填)
  "description": string // Brief description of the MCP service
  "remoteMcpUrl": string (uri) // The URL of the Remote MCP service
  "oauthServerUrl"?: string (uri) // OAuth server URL if different from MCP server (e.g., Supabase MCP is at mcp.supabase.com but OAuth is at api.supabase.com) (非必填)
  "logoUrl"?: string (uri) // CDN URL for the MCP service logo (for frontend rendering) (非必填)
  "isActive"?: boolean // Whether this MCP service is currently available for use (非必填)
  "createdAt": string (timestamp)
  "updatedAt": string (timestamp)
}
```

**回應範例值**

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "回應字串",
  "displayName": "回應字串",
  "description": "回應字串",
  "remoteMcpUrl": "https://example.com/file.jpg",
  "oauthServerUrl": "https://example.com/file.jpg",
  "logoUrl": "https://example.com/file.jpg",
  "isActive": false,
  "createdAt": "回應字串",
  "updatedAt": "回應字串"
}
```

***


---

# Agent Instructions: 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:

```
GET https://docs.maiagent.ai/api/api-reference/gong-ju-he-lian-jie-qi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
