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

# MCP 工具參考

> 所有 22 個 Flowstep MCP 工具的輸入結構描述、輸出格式與範例。

成功時，除 `get-screen-image` 外，每個工具都會回傳兩次結果：作為 `structuredContent`（依該工具發布的輸出結構描述驗證），以及以相同物件序列化成的文字區塊 `{ type: "text", text: "<json-string>" }`，供不讀取結構化內容的用戶端使用。`get-screen-image` 只回傳 MCP 圖片區塊：`{ type: "image", data: "<base64>", mimeType: "image/png" }`。

失敗時，會設定 `isError: true`，且文字區塊會包含簡短的錯誤訊息。可行動的錯誤（例如刪除時名稱不符、無效的 Figma 連結、附件問題或生成逾時）會說明該如何修正。其他失敗則會回傳通用訊息，例如 `Failed to list files`。

> [!NOTE]
>
> **費用：**三個 [AI 設計工具](#ai-design-tools)（`ai-design-screens`、`ai-generate-screen-variant` 與 `ai-edit-screen-variant`）與 Flowstep 應用程式使用相同的訊息額度。其他所有工具皆免費。請參閱[使用限制](https://flowstep.ai/docs/zh-Hant/mcp/usage-limits.md)。

每個工具也會發布 MCP 註解，讓用戶端了解其作用。`delete-file`、`delete-screen`、`delete-file-instructions`、`replace-screen-jsx`、`ai-design-screens` 與 `ai-edit-screen-variant` 會被標記為 destructive（具破壞性），因為它們會移除或覆寫既有內容。

***

## 檔案工具

### `list-files`

列出您的 Flowstep 檔案中繼資料。請先呼叫此工具，確認是否已有相關檔案。它不會回傳畫面內容，如需內容，請使用 `get-screen-image` 或 `get-screen-jsx`。

**輸入**

| 參數 | 類型 | 預設值 | 說明 |
| - | - | - | - |
| `orderByCreation` | `boolean` | `true` | 依 `created_at` 由新到舊排序（`true`），或依 `updated_at` 排序（`false`）。若要找出最近編輯過的檔案，請使用 `false` |
| `limit` | `integer`（1–100） | `20` | 回傳的檔案數上限。若回傳頁面已滿，表示可能還有更多檔案 |
| `offset` | `integer`（≥0） | `0` | 要略過的檔案數。下一頁為 `offset + limit` |

**輸出**：`{ files }`。

```json
{
  "files": [
    {
      "id": "5c2170f0-5b09-4a5a-ba7a-4d5c2cfb07e0",
      "name": "Dashboard redesign",
      "created_at": "2026-04-30T15:02:13.120152+00:00",
      "updated_at": "2026-04-30T15:02:13.120152+00:00",
      "organisation_id": "0b7f3c9e-2d4a-4f1b-9a5e-6c8d7e1f2a3b",
      "shared_with_me": false,
      "owner": true,
      "url": "https://app.flowstep.ai/file?activeFileId=5c2170f0-5b09-4a5a-ba7a-4d5c2cfb07e0"
    }
  ]
}
```

* `owner`：若您建立了該檔案，則為 `true`。
* `shared_with_me`：若檔案是直接與您分享（而非僅透過您的組織分享），則為 `true`。
* `url`：在 Flowstep 編輯器中開啟該檔案。

***

### `get-file`

取得單一檔案的中繼資料。此處刻意不包含檔案內容。若要檢視畫面，請使用 `get-screen-image` 或 `get-screen-jsx`；若要取得檔案的指示，請使用 `get-file-instructions`。若您有待處理的檔案邀請，呼叫 `get-file` 即會接受該邀請。

**輸入**

| 參數 | 類型 | 說明 |
| - | - | - |
| `id` | `uuid` | 檔案 ID |

**輸出**：`{ file, user_access_level }`。

```json
{
  "file": {
    "id": "5c2170f0-5b09-4a5a-ba7a-4d5c2cfb07e0",
    "name": "Dashboard redesign",
    "created_at": "2026-04-30T15:02:13.120152+00:00",
    "updated_at": "2026-04-30T15:02:13.120152+00:00",
    "project_id": "81cb84d6-c69f-492c-a895-7421b60d1a6d",
    "access_level": "private",
    "visibility": "private",
    "owner": true,
    "url": "https://app.flowstep.ai/file?activeFileId=5c2170f0-5b09-4a5a-ba7a-4d5c2cfb07e0"
  },
  "user_access_level": "write"
}
```

* `access_level`：`private`、`read` 或 `write`。
* `visibility`：`private`、`member` 或 `public`。
* `user_access_level`：您對該檔案的存取權限，為 `read` 或 `write`。

***

### `create-file`

建立一個沒有任何畫面的空白 Flowstep 檔案。若要在一個步驟中建立檔案並生成畫面，請改為呼叫不帶 `fileId` 的 `ai-design-screens`。程式碼優先的工作流程請使用 `create-file`，接著使用 `add-screen-jsx`。

**輸入**

| 參數 | 類型 | 說明 |
| - | - | - |
| `name` | `string`（最少 1 個字元） | 新檔案的顯示名稱 |

**輸出**：`{ file, user_access_level }`，格式與 `get-file` 相同。`owner` 一律為 `true`，`user_access_level` 一律為 `write`。

在後續的工具呼叫中，請將回傳的 `file.id` 作為 `fileId` 使用。

***

### `update-file`

重新命名檔案。

**輸入**

| 參數 | 類型 | 說明 |
| - | - | - |
| `id` | `uuid` | 檔案 ID |
| `name` | `string`（最少 1 個字元） | 新的顯示名稱 |

**輸出**：`{ file, user_access_level }`，格式與 `get-file` 相同。

***

### `delete-file`

永久刪除檔案。您傳入的 `name` 會在刪除前與檔案目前的顯示名稱進行比對，若不相符，則會中止刪除。這可防止誤刪錯誤的檔案。代理會被指示先與您確認。

**輸入**

| 參數 | 類型 | 說明 |
| - | - | - |
| `id` | `uuid` | 檔案 ID |
| `name` | `string` | 檔案目前的顯示名稱，必須相符，否則將中止刪除 |

**輸出**：`{ "deleted": true }`

> [!WARNING]
>
> 此操作無法復原。檔案中的所有畫面都會被刪除。

***

## 畫面工具

### `list-screens`

依畫布順序列出檔案中的畫面。請在 `list-files` 之後呼叫此工具，以查看檔案中已有的內容。將回傳的 `screenId` 值用於其他畫面工具與 AI 設計工具。

**輸入**

| 參數 | 類型 | 說明 |
| - | - | - |
| `fileId` | `uuid` | 檔案 ID |

**輸出**：`{ screens }`。

```json
{
  "screens": [
    {
      "screenId": "3f9e6eb6-5525-4383-9375-67e0bd762dbe",
      "name": "Mobile login screen",
      "prompt": "Generate a simple mobile login screen with email and password fields and a sign in button",
      "fidelity": "ui"
    }
  ]
}
```

* `prompt`：畫面最後一次的生成提示詞；若該畫面從未生成過（例如使用 `add-screen-jsx` 新增的畫面），則為空字串。
* `fidelity`：`lofi`、`hifi` 或 `ui`。

***

### `get-screen-image`

將畫面渲染為 PNG，並以內嵌圖片的形式回傳。需要支援圖片內容區塊的用戶端。請針對 AI 設計工具、`add-screen-jsx`、`replace-screen-jsx` 或 `import-figma` 回傳的每個 `screenId` 各呼叫一次。

**輸入**

| 參數 | 類型 | 說明 |
| - | - | - |
| `fileId` | `uuid` | 檔案 ID |
| `screenId` | `uuid` | 來自 `list-screens` 或設計工具回傳之 `screenIds` 陣列的 `screenId` |

**輸出**：MCP 圖片內容區塊（`image/png`）。`data` 是 PNG 位元組的標準 base64 編碼，而非 data URI。此工具沒有 `structuredContent`。

***

### `get-screen-jsx`

以 JSX 取得畫面及其中繼資料，讓您可以在程式碼庫中以此為基礎進行開發，或編輯後使用 `replace-screen-jsx` 寫回。若要取得視覺預覽，請改用 `get-screen-image`。

**輸入**

| 參數 | 類型 | 預設值 | 說明 |
| - | - | - | - |
| `fileId` | `uuid` | — | 檔案 ID |
| `screenId` | `uuid` | — | 來自 `list-screens` 或設計工具回傳之 `screenIds` 陣列的 `screenId` |
| `includeIds` | `boolean` | `false` | 在 `jsx` 中的元素上包含 `data-id` 屬性。當您需要將元素 ID 作為 `elementIds` 傳入 `ai-design-screens`（無論是就地編輯，或作為視覺參考）時使用 |

**輸出**：`{ fileId, screenId, name, prompt, fidelity, screenType, colorTheme, jsx, fragments }`。

```json
{
  "fileId": "5c2170f0-5b09-4a5a-ba7a-4d5c2cfb07e0",
  "screenId": "c13d3707-0efe-49f5-b6cb-0ca5ac5223d0",
  "name": "World clock",
  "prompt": "A world clock screen with a city search and alert button",
  "fidelity": "ui",
  "screenType": "iphone-x-vertical",
  "colorTheme": "blue",
  "jsx": "<div className=\"bg-white text-zinc-950 w-full h-fit\">\n  <div className=\"flex p-6 flex-col gap-6\">\n    …\n  </div>\n</div>",
  "fragments": []
}
```

* `jsx`：僅包含標記。只有當 `includeIds` 為 `true` 時，才會包含 `data-id` 屬性。
* `prompt`：最後一次的生成提示詞；若畫面從未生成過，則為空字串。
* `fragments`：儲存在畫面上的共用外框元素，例如導覽列、標頭或標誌，以 `{ purpose, markup }` 物件的形式表示。若沒有，則為空陣列。將它們傳回 `replace-screen-jsx` 即可保留或更新。

關於 `fidelity`、`screenType` 與 `colorTheme` 的值，請參閱[畫面欄位值](#screen-field-values)。

***

### `add-screen-jsx`

將您撰寫的 JSX 新增為檔案中的新畫面。這是程式碼優先的方式，且免費。若您希望由 Flowstep 的 AI 設計畫面，請使用 `ai-design-screens`。`add-screen-jsx` 一律會建立新畫面；若要覆寫既有畫面，請使用 `replace-screen-jsx`。

若要顯示您上傳的圖片，請參閱 [JSX 中的圖片](#images-in-jsx)。

若新畫面以既有畫面為基礎，請從 `get-screen-jsx`（不含 `includeIds`）取得 `name`、`fidelity`、`screenType`、`colorTheme` 與 `jsx`，然後變更需要不同的部分。

**輸入**

| 參數 | 類型 | 預設值 | 說明 |
| - | - | - | - |
| `fileId` | `uuid` | — | 檔案 ID |
| `name` | `string`（1–100 個字元） | — | 選填的顯示名稱。省略時，畫面會自動命名為 `Screen N` |
| `fidelity` | `string` | `"ui"` | 畫面保真度 |
| `screenType` | `string` | — | **必填**：畫面設計所針對的裝置或視口 |
| `colorTheme` | `string` | `"default"` | 色彩主題 |
| `jsx` | `string` | — | 僅包含 JSX 標記。任何 `data-id` 屬性都會被忽略，新畫面會取得新的元素 ID |

**輸出**：`{ fileId, screenId }`。呼叫 `get-screen-image` 並傳入 `screenId` 即可檢視結果。

```json
{
  "fileId": "5c2170f0-5b09-4a5a-ba7a-4d5c2cfb07e0",
  "screenId": "3f9e6eb6-5525-4383-9375-67e0bd762dbf"
}
```

***

### `replace-screen-jsx`

以您撰寫的 JSX 覆寫既有畫面。該畫面會保留其 `screenId` 與在畫布上的位置；巢狀元素會取得新的 ID。這是程式碼優先的方式，且免費。若要進行 AI 變更，請使用 `ai-design-screens` 或 `ai-edit-screen-variant`；若要建立新畫面，請改用 `add-screen-jsx`。

請從 `get-screen-jsx`（不含 `includeIds`）開始，然後變更需要不同的部分。若要顯示您上傳的圖片，請參閱 [JSX 中的圖片](#images-in-jsx)。

**輸入**

| 參數 | 類型 | 說明 |
| - | - | - |
| `fileId` | `uuid` | 檔案 ID |
| `screenId` | `uuid` | 要覆寫的畫面 |
| `jsx` | `string` | 僅包含 JSX 標記。任何 `data-id` 屬性都會被忽略 |
| `name` | `string`（1–100 個字元） | 選填。省略則保留目前名稱 |
| `fidelity` | `string` | 選填。省略則保留目前的保真度 |
| `screenType` | `string` | 選填。省略則保留目前的畫面類型 |
| `colorTheme` | `string` | 選填。省略則保留目前的色彩主題 |
| `fragments` | `{ purpose, markup }[]` | 選填。來自 `get-screen-jsx` 的共用外框元素。省略則保留目前的外框元素，或傳入 `[]` 以清除 |

**輸出**：`{ fileId, screenId }`。呼叫 `get-screen-image` 並傳入 `screenId` 即可檢視結果。

> [!WARNING]
>
> 此操作會就地取代畫面的內容。

***

### `rename-screen`

重新命名畫面在畫布上的標籤，也就是 `list-screens` 與編輯器中顯示的名稱。此操作只會變更標籤，不會變更畫面的版面配置、尺寸或內容。若要變更這些項目，請使用 `ai-design-screens`。

**輸入**

| 參數 | 類型 | 說明 |
| - | - | - |
| `fileId` | `uuid` | 檔案 ID |
| `screenId` | `uuid` | `list-screens` 回傳的 `screenId` |
| `name` | `string`（1–100 個字元） | 新的畫面名稱。前後空白會被修剪 |

**輸出**：`{ screenId, name }`。

```json
{ "screenId": "3f9e6eb6-5525-4383-9375-67e0bd762dbe", "name": "Checkout — empty cart" }
```

***

### `delete-screen`

永久刪除檔案中的畫面。您傳入的 `name` 會與畫面目前的顯示名稱進行比對，若不相符，則會中止刪除。代理會被指示先與您確認。

**輸入**

| 參數 | 類型 | 說明 |
| - | - | - |
| `fileId` | `uuid` | 檔案 ID |
| `screenId` | `uuid` | 要刪除的畫面 |
| `name` | `string` | 畫面目前的顯示名稱，必須相符，否則將中止刪除 |

**輸出**：`{ "deleted": true }`

***

### JSX 中的圖片

`add-screen-jsx` 與 `replace-screen-jsx` 接受 `img` 的 `src` 中的圖片，或在 `className` 中以 `bg-[url(...)]` 設定為背景。請撰寫 `alt` 文字，並依用途調整每張圖片的尺寸。

若要放置您自己的圖片：

1. 以模式 A（`mimeType` + `fileName`）使用 [`upload-attachment`](#upload-attachment) 上傳，並執行回傳的 `uploadCommand`。
2. 若回應的 `type` 為 `"image"`，請將其 `assetUrl` 原樣貼到 `img src` 或 `bg-[url(assetUrl)]` 中。

其他所有圖片網址請保持 `get-screen-jsx` 回傳的原樣。請勿將 `path`、`signedUrl` 或 `uploadCommand` 放入 `src`。

```jsx
<img src="ASSET_URL" alt="Team photo" className="w-full h-48 object-cover rounded-lg" />
```

***

### 畫面欄位值

`get-screen-jsx` 會回傳以下值，而 `add-screen-jsx` 與 `replace-screen-jsx` 也接受這些值：

| 欄位 | 值 |
| - | - |
| `fidelity` | `lofi`、`hifi`、`ui` |
| `screenType` | `web`、`desktop`、`desktop-large`、`desktop-medium`、`desktop-small`、`tablet`、`ipad-tablet-horizontal`、`ipad-tablet-vertical`、`android-tablet-horizontal`、`android-tablet-vertical`、`mobile_ios`、`mobile_android`、`iphone-vertical`、`iphone-horizontal`、`iphone-x-vertical`、`iphone-x-horizontal`、`android-vertical`、`android-horizontal`、`android-small-vertical`、`android-small-horizontal` |
| `colorTheme` | `default`、`defaultDark`、`blue`、`blueDark`、`ice`、`iceDark`、`grayscale`、`grayscaleDark`、`green`、`greenDark`、`orange`、`orangeDark`、`red`、`redDark`、`rose`、`roseDark`、`violet`、`violetDark`、`yellow`、`yellowDark` |

***

## 檔案指示工具

檔案指示是儲存在檔案上的純 Markdown 文字。設定後，它會作為背景資訊，隨該檔案的每次 AI 生成與編輯一併送出。請參閱[檔案指示](https://flowstep.ai/docs/zh-Hant/design-guidelines.md)。

### `get-file-instructions`

取得附加在檔案上的檔案指示。

**輸入**

| 參數 | 類型 | 說明 |
| - | - | - |
| `fileId` | `uuid` | 檔案 ID |

**輸出**：`{ instructions }`。

```json
{
  "instructions": "Prices are always in euros.\nNavigation sits in a left sidebar, never a top bar."
}
```

若尚未設定任何指示，`instructions` 會是 `null`。

***

### `update-file-instructions`

為檔案設定或取代檔案指示。請以純 Markdown 字串傳入指示，而非物件或 JSON。若您要從檔案讀取，請傳入該檔案的文字。顏色、圓角與字型來自檔案的主題；提及這些項目的指示，會透過主題的權杖套用。

**輸入**

| 參數 | 類型 | 說明 |
| - | - | - |
| `fileId` | `uuid` | 檔案 ID |
| `instructions` | `string`（1–50,000 個字元） | 原始 Markdown 文字。必須是純字串，不可經過 JSON 編碼 |

**輸出**：`{ "updated": true }`

***

### `delete-file-instructions`

清除檔案的檔案指示。刪除不存在的指示不會產生任何效果。

**輸入**

| 參數 | 類型 | 說明 |
| - | - | - |
| `fileId` | `uuid` | 檔案 ID |

**輸出**：`{ "deleted": true }`

***

## 聊天工具

### `get-chat-history`

取得與檔案相關聯的設計對話，也就是該檔案的 Flowstep 聊天，而非您的 MCP 用戶端對話。可用來接續先前在檔案上的工作。

**輸入**

| 參數 | 類型 | 說明 |
| - | - | - |
| `fileId` | `uuid` | 檔案 ID |

**輸出**：`{ messages }`。若您在該檔案上沒有設計對話，`messages` 會是空的。每則訊息都有 `type`（`"request"` 或 `"response"`）、`author`（`"human"` 或 `"ai"`），以及 `content_type`。回應訊息使用 `"text"`、`"summary"` 或 `"followup"`。

```json
{
  "messages": [
    {
      "id": "453f593d-2380-425b-ba29-127db08d6a8e",
      "type": "request",
      "status": "success",
      "content": "Generate a simple mobile login screen with email and password fields",
      "author": "human",
      "content_type": "text",
      "sequence": 1,
      "targets": [],
      "attachments": []
    },
    {
      "id": "d860186b-82d5-4bd1-8e8e-8ba5377a14bf",
      "type": "response",
      "status": "success",
      "content": "Generated a mobile login screen with email and password input fields, a sign in button, and a sign up link.",
      "author": "ai",
      "content_type": "summary",
      "sequence": 7,
      "request_message_id": "453f593d-2380-425b-ba29-127db08d6a8e",
      "targets": [{ "target_id": "3f9e6eb6-5525-4383-9375-67e0bd762dbe" }]
    }
  ]
}
```

***

## 附件工具

### `upload-attachment`

上傳參考檔案，以用作 `ai-design-screens` 的附件；或上傳圖片，以放入您自己的 JSX（搭配 `add-screen-jsx` 或 `replace-screen-jsx`）。`ai-generate-screen-variant` 與 `ai-edit-screen-variant` 不接受附件。檔案位元組不會經過模型，伺服器也絕不會代您擷取網址。若要參照網頁，請改將其網址放入 `ai-design-screens` 的 `message` 中。

此工具有兩種模式，請只使用其中一種，不可混用。

**模式 A：檔案與圖片（`mimeType` + `fileName`）**

適用於任何圖片、PDF 或較大文字檔案的必要三步驟流程：

1. 僅使用 `mimeType` 與 `fileName` 呼叫 `upload-attachment`（例如 `image/png` 與 `dog.png`）。回應是*已準備好的*上傳，而非已儲存的檔案：

   ```json
   {
     "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
     "path": "attachments/a1b2c3d4-e5f6-7890-abcd-ef1234567890",
     "assetUrl": "https://…",
     "type": "image",
     "mimeType": "image/png",
     "signedUrl": "https://…",
     "uploadCommand": "curl -sS -f -X PUT '…' -H 'Content-Type: image/png' -H 'x-metadata: …' --data-binary @LOCAL_FILE_PATH",
     "nextStep": "…"
   }
   ```
2. 將 `uploadCommand` 中的 `LOCAL_FILE_PATH` 替換為您檔案的絕對路徑，並在 shell 中執行該完整指令，且必須以 0 結束。`signedUrl` 中的權杖只授權此次上傳。**略過此步驟會使儲存空間保持為空，設計工具的預檢也會失敗。**
3. 只將 `{ id, path, type }` 傳入 `ai-design-screens` 的 `attachments` 陣列，不要傳入 `signedUrl`、`uploadCommand` 或 `nextStep`。若要改在您自己的 JSX 中放置圖片，請將 `assetUrl` 放入您傳給 `add-screen-jsx` 或 `replace-screen-jsx` 的 JSX 中的 `img src` 或 `bg-[url(...)]`。請參閱 [JSX 中的圖片](#images-in-jsx)。

若要附加遠端檔案，請先自行將其下載到本機路徑（例如使用 `curl`），然後依相同的三個步驟進行。切勿將網址傳給 `upload-attachment`。

| 參數 | 類型 | 說明 |
| - | - | - |
| `mimeType` | enum | 檔案的 MIME 類型。可為 `image/jpeg`、`image/png`、`image/webp`、`image/gif`、`application/pdf`、`text/markdown`、`text/plain`、`text/javascript` 其中之一。`.jsx`、`.tsx`、`.js`、`.ts` 檔案請使用 `text/javascript` |
| `fileName` | `string`（最少 1 個字元） | 含副檔名的原始檔名，例如 `cat.png` 或 `design.md` |

**模式 B：短文字（`text` + `mimeType`）**

上傳已在上下文中的文字，無需 shell 指令。回應可直接使用：

```json
{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "path": "attachments/a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "assetUrl": "https://…",
  "type": "document",
  "mimeType": "text/plain"
}
```

| 參數 | 類型 | 說明 |
| - | - | - |
| `text` | `string`（最多 64,000 個字元） | 原始文字內容。僅適用於文字檔，請勿用於圖片或 PDF。超過 64,000 個字元？請改用模式 A |
| `mimeType` | enum | `text/markdown`、`text/plain`、`text/javascript` 其中之一 |

將產生的 `{ id, path, type }` 傳入 `ai-design-screens` 的 `attachments` 陣列。

圖片最大可達 **20 MB**；文件（PDF、文字與程式碼檔案）最大為 **3 MB**。PDF 上限為 100 頁。超過上限的檔案會導致上傳失敗並回傳 HTTP 413，且不會儲存。

**輸出**：`{ id, path, assetUrl, type, mimeType, signedUrl?, uploadCommand?, nextStep? }`。

* `type`：圖片檔案為 `"image"`，PDF 與文字檔案為 `"document"`。
* `assetUrl`：已上傳檔案的網址，兩種模式都會回傳。只有當 `type` 為 `"image"`，且在模式 A 的 `uploadCommand` 執行完成後，才可在 `add-screen-jsx` 或 `replace-screen-jsx` 的 JSX 中使用。
* `signedUrl`、`uploadCommand`、`nextStep`：只在模式 A 中設定。請勿將它們傳入設計工具。

***

## Figma 工具

### `import-figma`

將 Figma 框架匯入 Flowstep 檔案，成為畫布上可編輯的元素。每次匯入都會新增一個畫面，因此匯入同一個框架兩次會得到兩個畫面。若您原本想取代舊畫面，請使用 `delete-screen` 刪除舊畫面。檔案所屬的組織必須已在 Flowstep 設定中連接 Figma。

**輸入**

| 參數 | 類型 | 說明 |
| - | - | - |
| `fileId` | `uuid` | 要匯入框架的 Flowstep 檔案。這不是 `figmaUrl` 中的 Figma 檔案金鑰 |
| `figmaUrl` | `string` | 指向特定 Figma 框架並帶有 `node-id` 的連結。在 Figma 中，於框架上按右鍵，並選擇 **Copy/Paste as** → **Copy link to selection**。頁面連結會匯入該頁面上所有最上層的框架（透過 MCP 上限為 20 個框架） |

**輸出**：`{ fileId, screenId, frameCount? }`。`screenId` 是匯入的畫面，請將其傳給 `get-screen-image` 以檢視結果。若頁面網址匯入了多個框架，則 `screenId` 為 `null`，並改回傳 `frameCount`；此時請呼叫 `list-screens`，然後對每個新畫面呼叫 `get-screen-image`。

```json
{
  "fileId": "5c2170f0-5b09-4a5a-ba7a-4d5c2cfb07e0",
  "screenId": "3f9e6eb6-5525-4383-9375-67e0bd762dbe"
}
```

***

## 方案與帳務工具

### `get-plan-details`

取得您組織的 Flowstep 方案、訂閱狀態、用量與剩餘額度。此工具不接受輸入，組織會根據已登入的使用者自動判定。請在呼叫 AI 設計工具前，使用此工具檢查您的額度。

**輸出**：`{ plan, subscription, limits, usage, remaining }`。

| 欄位 | 說明 |
| - | - |
| `plan` | `{ name, code, type }`。`type` 為 `"free"` 或 `"paid"` |
| `subscription` | `{ isPaid, isTrial, startDate, endDate, trialDaysRemaining }` |
| `limits` | 各功能的限額，以功能為鍵（例如 `messages`）。每項都有選填的 `daily` 與 `monthly` 物件，各包含 `max` 與 `warn` 數值，以及 `unlimited` 旗標 |
| `usage` | 各功能目前的用量，格式為 `{ daily, monthly }` |
| `remaining` | 各功能剩餘的額度，格式為 `{ daily, monthly }`。不限量的功能會省略此欄位 |

限額依方案而異，請參閱[定價](https://flowstep.ai/pricing)與[使用限制](https://flowstep.ai/docs/zh-Hant/mcp/usage-limits.md)。

***

## AI 設計工具

這三個工具依據描述或預設來設計，絕不接受或重複使用 JSX。每次呼叫都會使用與 Flowstep 應用程式相同的訊息額度，並會等待生成完成或逾時（180 秒）。

| 工具 | 用途 |
| - | - |
| `ai-design-screens` | 根據自由格式的描述，生成新畫面、就地變更現有畫面，或兩者兼具 |
| `ai-generate-screen-variant` | 為一個現有畫面新增下一步、錯誤或空白狀態，或平台變體 |
| `ai-edit-screen-variant` | 對一個完整的現有畫面套用編輯或重新設計預設 |

這三個工具都會回傳 `{ status, fileId, screenIds }`。請對每個 `screenId` 各呼叫一次 `get-screen-image`，以檢視結果。

***

### `ai-design-screens`

根據文字描述，在一次呼叫中生成一或多個新畫面、就地變更現有畫面，或兩者兼具，例如新的流程、主題套用、文案、版面配置，或跨多個畫面的協調變更。這與 Flowstep 編輯器中聊天使用的是同一個設計代理。它會根據您的 `message` 與 `elementIds`，決定要建立與變更的內容。

省略 `fileId` 即可建立新檔案；傳入 `fileId` 則可在現有檔案中工作。如果請求可能適用於您已擁有的檔案，您的代理應先檢查 `list-files` 與 `list-screens`。若要為一個畫面產生下一步、錯誤或空白狀態，或平台變體，請使用 `ai-generate-screen-variant`。若要對一個畫面進行預設編輯或重新設計，請使用 `ai-edit-screen-variant`。若您已有 JSX，請改用 `add-screen-jsx` 或 `replace-screen-jsx`。

**輸入**

| 參數 | 類型 | 預設值 | 說明 |
| - | - | - | - |
| `fileId` | `uuid` | — | 目標檔案。省略則建立新檔案。設定 `elementIds` 時必填 |
| `message` | `string` | — | 要生成的畫面描述及／或要進行的變更。傳入 `elementIds` 時，請說明是要編輯它們，還是將其作為參考。您希望 Flowstep 參照的任何網頁網址，請都放在這裡 |
| `elementIds` | `uuid[]` | `[]` | 選填。來自 `list-screens` 的 `screenId`，及／或來自 `get-screen-jsx`（搭配 `includeIds`）的元素 `data-id`，類似編輯器中的選取範圍。它們可以就地編輯，也可以作為新畫面的視覺參考。`screenId` 會指向整個畫面 |
| `attachments` | `{ id, path, type }[]`（最多 5 個） | `[]` | 來自 `upload-attachment` 的檔案：圖片、PDF，或程式碼與文字檔。請勿將檔案內容直接放入訊息中 |

**範例**：在一次呼叫中編輯一個畫面，並新增另一個畫面：

```json
{
  "fileId": "5c2170f0-5b09-4a5a-ba7a-4d5c2cfb07e0",
  "message": "Switch this sign-in screen to dark mode, then add a matching forgot-password screen.",
  "elementIds": ["3f9e6eb6-5525-4383-9375-67e0bd762dbe"]
}
```

**輸出**：`{ status, fileId, screenIds, reply? }`。

```json
{
  "status": "generated",
  "fileId": "5c2170f0-5b09-4a5a-ba7a-4d5c2cfb07e0",
  "screenIds": [
    "3f9e6eb6-5525-4383-9375-67e0bd762dbe",
    "c13d3707-0efe-49f5-b6cb-0ca5ac5223d0"
  ]
}
```

* `status`：畫面已建立或變更時為 `"generated"`。若 Flowstep 只回覆而未建立畫面，則為 `"chat"`，此時 `reply` 會包含其回答，且 `screenIds` 為空。若您的需求描述不明確，您的代理應請您釐清，然後再次呼叫此工具。
* `screenIds`：此次呼叫中建立或變更的每個畫面，包括就地編輯的畫面。若呼叫在部分畫面建立後逾時，會回傳這些畫面，而非錯誤。

> [!WARNING]
>
> 您要求它編輯的畫面會被就地覆寫。

***

### `ai-generate-screen-variant`

從恰好一個現有畫面衍生出一個新畫面：流程中的下一步、錯誤或空白狀態，或其他平台的版本。原始畫面保持不變。若要新增並非現有畫面變體的畫面（例如設定畫面），請搭配 `fileId` 使用 `ai-design-screens`。

**輸入**

| 參數 | 類型 | 說明 |
| - | - | - |
| `fileId` | `uuid` | 目標檔案 |
| `screenId` | `uuid` | 用來衍生的現有畫面 |
| `operationVariant` | enum | **必填**：新畫面與現有畫面的關係 |

| `operationVariant` | 新增內容 |
| - | - |
| `next_screen` | 使用者流程中的下一個畫面 |
| `error_state` | 該畫面的錯誤狀態 |
| `empty_state` | 該畫面的空白狀態 |
| `web_version` | 網頁版本 |
| `mobile_version` | 行動版本 |
| `tablet_version` | 平板版本 |
| `mobile_ios_version` | iOS 版本 |
| `mobile_android_version` | Android 版本 |

**輸出**：`{ status, fileId, screenIds }`。`status` 一律為 `"generated"`。

***

### `ai-edit-screen-variant`

使用預設，就地變更恰好一個現有畫面：為它套用主題或潤飾、嘗試不同的版面配置或視覺風格，或從頭重新設計。若要新畫面、自由格式的指示，或對個別元素進行精確編輯，請使用 `ai-design-screens`。

**輸入**

| 參數 | 類型 | 說明 |
| - | - | - |
| `fileId` | `uuid` | 目標檔案 |
| `screenId` | `uuid` | 要變更的現有畫面 |
| `operationVariant` | enum | **必填**：要套用的編輯或重新設計預設 |

| `operationVariant` | 類型 | 效果 |
| - | - | - |
| `dark_theme` | 編輯 | 將畫面切換為深色主題 |
| `light_theme` | 編輯 | 將畫面切換為淺色主題 |
| `make_pretty` | 編輯 | 潤飾畫面的視覺設計 |
| `different_layout` | 重新設計 | 嘗試不同的版面配置 |
| `different_style` | 重新設計 | 嘗試不同的視覺風格 |
| `from_scratch` | 重新設計 | 從頭重新設計畫面 |

**輸出**：`{ status, fileId, screenIds }`。`status` 一律為 `"generated"`。

> [!WARNING]
>
> 此操作會就地覆寫畫面的內容。

***

## 已重新命名的工具

工具名稱在 2026 年 9 月與 10 月間有所變更。若您的提示詞、指令碼或代理指示使用舊名稱，請進行更新：

| 舊名稱 | 新名稱 |
| - | - |
| `get-screen` | `get-screen-jsx` |
| `add-screen` | `add-screen-jsx` |
| `replace-screen` | `replace-screen-jsx` |
| `ai-generate-screens` | `ai-design-screens` |
| `ai-edit-screens` | `ai-design-screens` |
| `create-new-design` | `ai-design-screens` |
| `edit-design`（自由格式指示） | `ai-design-screens` |
| `edit-design`（搭配 `operationVariant` 預設） | `ai-edit-screen-variant` |
| `regenerate-design` | `ai-edit-screen-variant` |
| `expand-design` | `ai-generate-screen-variant` |
| `get-design-guidelines` | `get-file-instructions` |
| `update-design-guidelines` | `update-file-instructions` |
| `delete-design-guidelines` | `delete-file-instructions` |

輸入也有所變更：AI 設計工具改為接受 `elementIds`（變體工具則接受單一 `screenId`），取代 `targets`；`add-screen-jsx` 改為接受 `jsx` 與明確的中繼資料欄位，取代帶有中繼資料註解的 `jsxContent`；`create-file` 改為接受 `name`，取代 `title`；檔案指示工具改為接受 `fileId`，取代 `resourceId` 與 `linkedTo`，且 `update-file-instructions` 改為接受 `instructions`，取代 `designGuidelines`。
