# 工具

<figure><img src="https://1593648278-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fmzb5NG9GDzFP2YDKeYVl%2Fuploads%2Fgit-blob-abf4737aff583831b0ca9d1a7b463ef283467758%2Ftools-infographic.png?alt=media" alt="工具概念"><figcaption><p>工具：Agent 透過 Function Calling 呼叫外部服務</p></figcaption></figure>

## 這是什麼？

工具讓 Agent 能「動手做事」——呼叫外部服務來執行動作或取得即時資訊。

沒有工具的 Agent 只能用已有的知識回答問題。有了工具，它可以查即時天氣、在 CRM 建立一筆客戶資料、寄送 Email、或從第三方 API 取得最新數據。

## 跟技能有什麼不同？

|             | 工具               | 技能                 |
| ----------- | ---------------- | ------------------ |
| **本質**      | 一個可呼叫的外部服務       | 一段多步驟的推理流程         |
| **粒度**      | 單一動作（如「查天氣」「寄信」） | 多步驟 SOP（如「完整報價流程」） |
| **誰決定用不用**  | Agent 自行判斷何時呼叫   | Agent 依情境觸發技能中的流程  |
| **會不會用到工具** | 工具本身就是最小單位       | 技能裡面可以串接多個工具       |

**簡單判斷**：如果是一個單點能力（查資料、執行動作），做成工具；如果是一整套流程（先查 A 再判斷要不要做 B），做成技能。

## 工具類型

### API 工具

直接呼叫 REST API。你設定 URL、HTTP 方法、參數，Agent 就能在對話中使用。

**適合**：公司內部 API、第三方服務 API、簡單的 HTTP 請求

### MCP 工具

透過 MCP（Model Context Protocol）連接外部服務。MCP 是一個標準化的協議，讓 Agent 能更方便地串接各種服務。

**適合**：已有 MCP Server 的服務、需要更複雜互動的外部整合

### 內建工具

MaiAgent 預設提供的工具，例如 AI 圖像生成。不需額外設定即可使用。

> **進階說明**：工具的底層是 Function Calling 技術。Agent 會根據對話內容判斷是否需要呼叫工具，自動組合參數、發出請求、解讀回傳結果，最後用自然語言回覆使用者。

## 我需要做什麼？

1. **建立工具** — 選擇類型（API / MCP），設定連線資訊
2. **定義參數** — 描述工具的用途和參數，讓 Agent 知道什麼情況要用
3. **測試** — 確認工具能正常呼叫和回傳
4. **掛載到 Agent** — 在 Agent 設定中配置這個工具

## 延伸閱讀

* [工具功能概覽](https://github.com/Playma-Co-Ltd/maiagent-user-guide-gitbook/blob/main/zh-tw/tools/tool_description.md)
* [建立 MCP 工具](https://github.com/Playma-Co-Ltd/maiagent-user-guide-gitbook/blob/main/zh-tw/tools/setup.md)
* [建立 API 工具](https://github.com/Playma-Co-Ltd/maiagent-user-guide-gitbook/blob/main/zh-tw/tools/setup_api_tool.md)
* [內建 AI 圖像生成工具](https://github.com/Playma-Co-Ltd/maiagent-user-guide-gitbook/blob/main/zh-tw/tools/ai-image-generation-guide.md)
* [為 AI 助理配置工具](https://github.com/Playma-Co-Ltd/maiagent-user-guide-gitbook/blob/main/zh-tw/tools/configure_tools.md)


---

# 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/agent-builder/tools.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.
