> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flowstep.ai/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://docs.flowstep.ai/zh/mcp/usage-limits.md)。

每个工具还会发布 MCP 注解，让客户端了解其作用。`delete-file`、`delete-screen`、`delete-file-instructions`、`replace-screen-jsx`、`ai-design-screens` 和 `ai-edit-screen-variant` 被标记为破坏性操作，因为它们会删除或覆盖现有内容。

***

## 文件工具

### `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 theme={"system"}
{
  "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 theme={"system"}
{
  "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 theme={"system"}
{
  "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 theme={"system"}
{
  "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`：存储在屏幕上的共享界面元素，例如导航栏、页眉或 Logo，以 `{ 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`。

如需展示你上传的图片，请参阅 [Images in 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 }`。使用 `screenId` 调用 `get-screen-image` 即可查看结果。

```json theme={"system"}
{
  "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`）开始，然后修改需要改变的部分。如需展示你上传的图片，请参阅 [Images in 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` 的共享界面元素。省略则保留当前的 fragments，传入 `[]` 则清空 |

**输出**：`{ fileId, screenId }`。使用 `screenId` 调用 `get-screen-image` 即可查看结果。

> [!WARNING]
>
> 此操作会原地替换屏幕的内容。

***

### `rename-screen`

重命名屏幕在画布上的标签，即 `list-screens` 和编辑器中显示的名称。此操作仅更改标签，不会改变屏幕的布局、尺寸或内容。如需修改这些内容，请使用 `ai-design-screens`。

**输入**

| 参数 | 类型 | 说明 |
| - | - | - |
| `fileId` | `uuid` | 文件 ID |
| `screenId` | `uuid` | `list-screens` 返回的 `screenId` |
| `name` | `string`（1–100 个字符） | 新的屏幕名称。首尾空白会被去除 |

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

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

***

### `delete-screen`

永久删除文件中的屏幕。你传入的 `name` 会与屏幕当前的显示名称进行比对。如果不匹配，删除操作将被中止。代理会被指示先向你确认。

**输入**

| 参数 | 类型 | 说明 |
| - | - | - |
| `fileId` | `uuid` | 文件 ID |
| `screenId` | `uuid` | 要删除的屏幕 |
| `name` | `string` | 屏幕当前的显示名称，必须匹配，否则删除会被中止 |

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

***

### Images in 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)]` 中。

其他图片 URL 请保持 `get-screen-jsx` 返回的原样。不要在 `src` 中使用 `path`、`signedUrl` 或 `uploadCommand`。

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

***

### Screen field values

`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://docs.flowstep.ai/zh/design-guidelines.md)。

### `get-file-instructions`

获取附加在文件上的文件指令。

**输入**

| 参数 | 类型 | 说明 |
| - | - | - |
| `fileId` | `uuid` | 文件 ID |

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

```json theme={"system"}
{
  "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 theme={"system"}
{
  "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` 中用作附件；或上传图片，以便通过 `add-screen-jsx` 或 `replace-screen-jsx` 放入你自己的 JSX。`ai-generate-screen-variant` 和 `ai-edit-screen-variant` 不接受附件。文件字节不会经过模型，服务器也绝不会代你获取 URL。如需引用网页，请改为在 `ai-design-screens` 的 `message` 中包含其 URL。

此工具有两种模式。只使用其中一种，不要混用。

**模式 A：文件和图片（`mimeType` + `fileName`）**

任何图片、PDF 或较大的文本文件都需要通过以下三步流程上传：

1. 仅使用 `mimeType` 和 `fileName` 调用 `upload-attachment`（例如 `image/png` 和 `dog.png`）。响应是一个*已准备*的上传，而不是已存储的文件：

   ```json theme={"system"}
   {
     "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(...)]` 中。请参阅 [Images in JSX](#images-in-jsx)。

如需附加远程文件，请先自行将其下载到本地路径（例如使用 `curl`），然后按相同的三步操作。切勿将 URL 传给 `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 theme={"system"}
{
  "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`：已上传文件的 URL，两种模式下都会返回。仅当 `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 文件 key |
| `figmaUrl` | `string` | 指向特定 Figma 框架的链接，包含 `node-id`。在 Figma 中，右键单击该框架并选择 **Copy/Paste as** → **Copy link to selection**。指向页面的链接会导入该页面上的所有顶层框架（通过 MCP 最多 20 个框架） |

**输出**：`{ fileId, screenId, frameCount? }`。`screenId` 是导入的屏幕，将其传给 `get-screen-image` 即可查看结果。当页面 URL 导入多个框架时，`screenId` 为 `null`，并返回 `frameCount`。此时请调用 `list-screens`，然后对每个新屏幕调用 `get-screen-image`。

```json theme={"system"}
{
  "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://docs.flowstep.ai/zh/mcp/usage-limits.md)。

***

## AI design tools

这三个工具根据描述或预设进行设计，它们从不接受或复用 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 参考的网页 URL，请在此处一并填写 |
| `elementIds` | `uuid[]` | `[]` | 可选。来自 `list-screens` 的 `screenId` 和/或来自 `get-screen-jsx`（带 `includeIds`）的元素 `data-id`，类似于编辑器中的选区。它们可以被原地编辑，也可以作为新屏幕的视觉参考。`screenId` 会针对整个屏幕 |
| `attachments` | `{ id, path, type }[]`（最多 5 个） | `[]` | 来自 `upload-attachment` 的文件：图片、PDF，或代码和文本文件。不要将文件内容直接写入消息中 |

**示例**：在一次调用中编辑一个屏幕并添加另一个屏幕：

```json theme={"system"}
{
  "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 theme={"system"}
{
  "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`。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.