@codify-ai/mcp-client 1.0.32 → 1.0.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -58,7 +58,7 @@
58
58
 
59
59
  #### 方式 1:将设计稿给其他人(研发)拉取代码到本地
60
60
 
61
- Codify 插件中选中一个元素,复制的指令然后给到其他人来获取代码。
61
+ MasterGo 中选中一个元素,复制的指令然后给到其他人来获取代码。
62
62
 
63
63
  无需启动 MasterGo,直接在 IDE 中输入该指令即可获取代码。
64
64
 
@@ -77,13 +77,13 @@ codify://getCode/{contentId}
77
77
  - "将我选中的图层,同步到本地代码" (**agent_sync_design**)
78
78
  - "对比本地代码与设计稿的差异" (**get_design_diff**)
79
79
 
80
- #### 方式 3:引用核心规范资源
80
+ #### 方式 3:加载核心规范工具
81
81
 
82
- 在对话中通过或直接输入 URI 引用:
82
+ 在对话中直接要求调用:
83
83
 
84
- - `codify://rule`
85
- - 核心规范与设计哲学:
86
- 你需要让 LLM 严格遵守转译代码规范才能完美的将它转译为 MasterGo 设计稿。当你需要将你已有的前端项目转换为设计稿的时候,必须让 LLM 读取此文档。同时,Codify为你总结了一套非常实用的UI设计哲学,它能够让LLM在生成页面的时候,保持优秀的设计审美。
84
+ - `get_guidelines`
85
+ - 推荐用法:
86
+ 当你需要让 LLM 严格遵守 Codify 的转译规范、组件导入规则和最终硬闸门时,应优先调用该工具加载规则,而不是引用旧的资源 URI。
87
87
 
88
88
  ## 可用工具
89
89
 
@@ -126,28 +126,46 @@ codify://getCode/{contentId}
126
126
 
127
127
  #### **get_component_info**
128
128
 
129
- 拉取指定团队库组件数据并落盘到本地 `.codify/library/<teamLibraryId>/<teamLibraryName>.json`,用于组件库页面生成。
129
+ 拉取指定团队库组件数据并落盘到本地 `.codify/library/<teamLibraryId>/<teamLibraryName>/`,用于组件库页面生成。每次指定团队库调用都会重新远端拉取并覆盖本地快照。
130
130
 
131
131
  - **参数**: `projectDir` (必填), `teamLibraryId` (可选), `teamLibraryName` (可选), `includePropertyDetails` (可选, 默认 true)
132
132
  - **示例**: "使用 Ant Design UIKit 团队库,拉取组件信息"
133
133
 
134
134
  组件库页面生成标准流程:
135
135
  1. 调用 `get_library_list` 确认团队库;
136
- 2. 调用 `get_component_info` 拉取并落盘 JSON;
137
- 3. 读取 JSON 结构:`components` 用于 `<ui-component>`,`icons` 用于 `<ui-icon>`;其中 `<ui-component>` 的 `props` 仅允许由 `components[].props` 推导(禁止臆造)。
136
+ 2. 调用 `get_component_info` 重新远端拉取并覆盖落盘 `index.md`、`components/*.json`、`icons.json`、`variable.json`;
137
+ 3. 先读 `index.md` 了解文件位置,再直接读取 `components/*.json` 作为 `<ui-component>` 来源,读取 `icons.json` 作为 `<ui-icon>` 来源;其中 `<ui-component>` 的 `props` 仅允许由组件详情文件里的 `props` 推导(禁止臆造)。
138
+
139
+ #### **get_variables**
140
+
141
+ 获取当前 MasterGo 文件中的全部本地变量。只读取当前文件,不读取远程团队库。
142
+
143
+ - **参数**: `projectDir` (必填)
144
+ - **示例**: "获取当前文件的全部变量"
145
+ - **返回**: `documentName`、`documentId`、`variables`
146
+ - **落盘**: 将 `variables` 字段内容写入 `.codify/variable/{documentId}.json`
147
+
148
+ #### **update_variables**
149
+
150
+ 创建、修改或删除当前 MasterGo 文件变量。
151
+
152
+ - **固定流程**: 先调用 `get_variables` 落盘;创建一套变量时先 `update_variables` 提交基础变量,再 `get_variables` 刷新 ID,然后 `update_variables` 提交语义/引用变量,最后再次 `get_variables`
153
+ - **参数**: `projectDir` (必填), `filePath` / `variables` / `operations` 三选一;也可传 `documentId` 让工具读取 `.codify/variable/{documentId}.json`
154
+ - **规则**: 首次调用会自动加载 `variable-generate` 规则;已有变量修改必须保留 `id`
155
+ - **示例**: "把当前变量文件提交到 MasterGo"
138
156
 
139
157
  ### 🎨 生成与设计
140
158
 
141
- #### **design**
159
+ #### **design_page**
142
160
 
143
161
  根据自然语言需求生成符合 Codify 规范的 HTML+CSS 代码。
144
162
 
145
163
  - **参数**: `requirement` (必填)
146
164
  - **示例**: "帮我设计一个深色模式的登录页面"
147
165
 
148
- #### **agent_create_page**
166
+ #### **submit_page_to_canvas**
149
167
 
150
- 将生成的 HTML 代码发送到 MasterGo 插件并创建新页面。
168
+ 将生成的 HTML 代码发送到 MasterGo 并创建新页面。
151
169
 
152
170
  - **参数**: `code` (可选), `filePath` (可选), `projectDir` (必填), `saveCodeToLocal` (可选)
153
171
  - **示例**: "在 MasterGo 中创建一个新页面,代码在 ./temp.html"
@@ -6,7 +6,7 @@
6
6
  - 本文件不定义工作流编排与工具调用顺序;仅约束输出代码本身。
7
7
 
8
8
  ## 目标
9
- 根据需求输出可被插件识别的组件代码,生成以下两类资产:
9
+ 根据需求输出可被 MasterGo 识别的组件代码,生成以下两类资产:
10
10
  1. `Component`(单个母版组件)
11
11
  2. `Component Set`(带变体的组件集)
12
12
 
@@ -86,6 +86,35 @@
86
86
  3. 根节点缺失 `data-type` 或 `data-name`。
87
87
  4. 输出页面容器(如 `<main w-[1440px]>`)来包裹组件集。
88
88
 
89
+ ## 与工具参数对齐
90
+ - 提交组件时,传入字段是 `code`(不是 `htmlCode`)。
91
+ - `code` 内容必须包含 `data-type="component"` 或 `data-type="component-set"`。
92
+
93
+ ## 变量样式优先(视觉语言一致性)
94
+
95
+ 如果当前文件已存在设计系统变量(`get_variables` 已落盘到 `{{docDir}}/variable/{documentId}.json`),母版组件样式**必须**优先通过 `var(...)` 引用变量,而不是写死字面值。
96
+
97
+ 适用属性:颜色、字号、字重、行高、圆角、边框宽度、阴影、间距(gap / padding / 单边)等关键视觉属性。
98
+
99
+ 约束、写法、回退策略一律遵循 `variable-import.md`,本文不重复展开。要点:
100
+
101
+ - 变量引用统一写为 `var(变量 name)`,放入 Tailwind 任意值语法(如 `bg-[var(色彩/brand/primary)]` / `gap-[var(间距/index_8/sm)]`)
102
+ - 引用时只能写变量 `name` 原文,禁止改写大小写 / 中英文 / 分隔符,禁止把 `value` 直接抄进 class
103
+ - 找不到精确匹配时按语义最近邻;都不匹配才允许该属性局部回退字面值,并在自检里标注"属性 + 缺失变量原因"
104
+ - 字面值回退时仍需满足 `page-generate.md` 的 8pt 网格 / Hex 颜色 / 整数 px 约束
105
+
106
+ 模板对照(同样的 button 组件,有变量时怎么写):
107
+
108
+ ```html
109
+ <div data-type="component" data-name="primary-button"
110
+ class="flex flex-row justify-center items-center bg-[var(色彩/brand/primary)] rounded-[var(圆角/index_8/sm)] px-[var(间距/index_16/md)] py-[var(间距/index_10/sm)]">
111
+ <span data-name="label"
112
+ class="text-[var(文字/正文/14)] leading-[var(行高/正文/1.2)] font-[var(字重/semibold)] text-[var(色彩/文本/反白)]">确认</span>
113
+ </div>
114
+ ```
115
+
116
+ 只有当前文件**完全没有变量**(变量清单 JSON 为空或不存在)时,才允许回到本文件示例里的字面值写法。
117
+
89
118
  ## 输出前自检清单
90
119
  1. 根节点是否为 `component` 或 `component-set`。
91
120
  2. 每个节点是否都有 `data-name`。
@@ -93,7 +122,4 @@
93
122
  4. 变体维度键和值是否完整一致。
94
123
  5. 是否存在 margin / grid / 原生表单标签。
95
124
  6. Flex 是否显式写全。
96
-
97
- ## 与工具参数对齐
98
- - 提交组件时,传入字段是 `code`(不是 `htmlCode`)。
99
- - `code` 内容必须包含 `data-type="component"` 或 `data-type="component-set"`。
125
+ 7. 当前文件存在变量时,关键视觉属性(颜色 / 文字 / 间距 / 圆角 / 边框 / 阴影)是否已经走 `var(...)` 引用;每个回退字面值是否在自检里标注了缺失原因。
@@ -19,66 +19,52 @@
19
19
 
20
20
  ## 流程(仅组件库模式)
21
21
  1. `get_library_list`(确认目标团队库)
22
- 2. `get_component_info`(落盘本地快照)
23
- 3. 严格基于落盘 JSON 生成代码
24
- 4. 如果你无法推测这个组件的形态,你可以查看 `index.json` `cover` 字段的图片
25
- 5. 使用 `variable.json` 里的样式变量
22
+ 2. `get_component_info`(重新远端拉取并覆盖落盘本地快照)
23
+ 3. 严格基于落盘文件生成代码
24
+ 4. 选择组件时必须参考 `components/*.json` 里的 `description`;它可能描述组件用途或限制,不能只按组件名猜测。
25
+ 5. 如果你无法推测这个组件的形态,你可以查看对应 `components/*.json` 里的 `cover` 字段图片
26
+ 6. 使用 `variable.json` 里的样式变量
26
27
 
27
28
  示例:
28
29
  ```text
29
- get_library_list -> get_component_info -> 读取 index/components/icons/variable -> 生成页面 -> agent_create_page
30
+ get_library_list -> get_component_info -> 读取 index.md/components/icons/variable -> 生成页面 -> submit_page_to_canvas
30
31
  ```
31
32
 
32
33
  ## 数据来源(唯一事实)
33
34
  按顺序读取:
34
- 1. `index.json`(候选组件)
35
- 2. `components/{key}.json`(组件详情)
35
+ 1. `index.md`(文件导航和读取说明)
36
+ 2. `components/*.json`(组件详情;每个文件直接包含 `name`、`description`、`cover`、`size`、`props`、`slots`、`instance_swap`)
36
37
  3. `icons.json`
37
38
  4. `variable.json`(样式变量,必须读取)
38
39
 
39
- 禁止臆造组件名、props、slot 名称、图标名或 instance_swap 值。
40
+ 所有 `name` 只能来自落盘文件,禁止改写:`components/*.json`、`icons.json`、`instance_swap`、`variable.json`。
40
41
 
41
42
  示例(读取顺序):
42
43
  ```text
43
- 先从 index.json 选“卡片”
44
- 再读 components/001-卡片.json 获取 props/slots/instance_swap
44
+ 先读 index.md 了解组件、图标、变量文件在哪里
45
+ 再扫描/读取 components/*.json,找到“卡片”并获取 description/cover/props/slots/instance_swap
45
46
  再读 icons.json 选择图标名
46
47
  最后读 variable.json 使用设计变量
47
48
  ```
48
49
 
49
- ## 变量样式协议(关键)
50
- - `full-components` `hybrid` 两种策略下,必须优先使用 `variable.json` 中可用变量表达样式。
51
- - 适用范围:颜色、字号、字重、行高、圆角、边框宽度、阴影、间距(gap/padding)等关键视觉属性。
52
- - 变量引用格式统一为 `var(...)`,并放入 Tailwind 任意值语法;引用时必须使用变量名(`name`,缺失时可用 `ukey`),禁止直接抄 `value`。
53
- - 若变量项为 `{ name: "色彩/brand/primary", value: "#1677FF" }`,必须写 `bg-[var(色彩/brand/primary)]`,禁止写 `bg-[#1677FF]`。
54
- - 若变量项为 `{ name: "间距/index_10/sm", value: "8px" }`,必须写 `gap-[var(间距/index_10/sm)]`,禁止写 `gap-[8px]`。
55
- - 变量引用示例:
56
- - `bg-[var(色彩/brand/primary)]`
57
- - `text-[var(文字/正文/14)]`
58
- - `gap-[var(间距/index_10/sm)]`
59
- - `rounded-[var(圆角/index_6/md)]`
60
- - 仅当 `variable.json` 中确实不存在可匹配变量时,才允许回退字面值(Hex/px);并需在输出前自检中标注“属性 + 缺失变量原因”。
61
-
62
- 示例:
63
- ```html
64
- <div data-name="filter-wrap" class="flex flex-row justify-start items-center gap-[var(间距/index_10/sm)] p-[var(间距/index_12/md)] bg-[var(色彩/填充/容器)] rounded-[var(圆角/index_6/md)]">
65
- <span data-name="filter-label" class="text-[var(文字/正文/14)] leading-[var(行高/正文/1.5)] font-[var(字重/medium)] text-[var(色彩/文本/主)]">筛选条件</span>
66
- </div>
67
- ```
50
+ ## 变量样式
51
+ - 组件库模式下变量来源为 `variable.json`,引用写法、强约束、回退策略一律遵循 `variable-import.md`。
52
+ - 本文档不重复展开;所有 `full-components` / `hybrid` 输出必须同时满足 `variable-import.md` 的硬约束。
68
53
 
69
54
  ## 合法引用
70
55
  - `<ui-component name="...">`
71
- - `name` 必须来自组件详情
56
+ - `name` 只能来自 `components/*.json` 的 `name`,禁止改写
72
57
  - `props` 字段必须存在于组件详情
73
58
  - `props` / `instance_swap` / `variants` 等 JSON 属性必须使用**单引号**包裹,内部 JSON 使用双引号(合法 JSON)
74
59
  - 严禁输出 HTML 实体编码到 JSON 属性中(如 `&quot;` / `&#34;` / `&#x22;`)
75
60
  - 若模型生成了双引号包裹 JSON 或实体编码,必须在最终输出前改写为单引号 JSON 属性
76
- - `instance_swap` 的值优先使用组件名(name);也可使用 ukey 或组件库 component id
61
+ - `instance_swap` 的值必须使用组件详情里已归一化的组件名(name
62
+ - `instance_swap` 的 value 只能来自组件详情中的 `instance_swap` 或 `icons[].name`,禁止改写
77
63
  - 禁止使用画布节点 ID(例如 `data-node-id` / `450:74735/414:32354`)作为 `instance_swap` 值
78
64
  - 布局样式按排版需要声明:需要填充主区域时使用 `flex-1` / `self-stretch`;需要固定宽度时可写 `w-[...]`
79
65
  - `class` 按需声明:若不需要额外布局/视觉覆盖可省略;若处于复杂布局容器中,建议补充布局 class 以保证排版稳定
80
66
  - `<ui-icon name="...">`
81
- - `name` 必须来自 `icons[].name`
67
+ - `name` 只能来自 `icons[].name`,禁止改写
82
68
  - 仅用于“独立图标节点”或“组件明确存在可承载图标节点的 slot”
83
69
  - 禁止把 `<ui-icon slot="...">` 当作 `instance_swap` 的替代写法
84
70
 
@@ -116,9 +102,10 @@ get_library_list -> get_component_info -> 读取 index/components/icons/variable
116
102
  ## 子实例接入决策(instance_swap vs 子节点直写)
117
103
  - 先看组件详情:
118
104
  - `slots` 非空:按 slot 白名单注入内容(`<ui-slot name="...">` 或 `slot="..."`)。
119
- - `slots` 为空但存在 `instance_swap`(如 `"图标": "10:38187"` / `"前缀": "10:xxxx"`):使用 `<ui-component instance_swap='...'>`,不要用子节点伪造替换。
105
+ - `slots` 为空但存在 `instance_swap`(如 `"图标": "SwitchButton"` / `"前缀": "搜索图标"`):使用 `<ui-component instance_swap='...'>`,不要用子节点伪造替换。
120
106
  - `instance_swap` 是通用“子实例替换”通道,不仅限图标;也可用于前后缀、状态标记、操作区子组件等可替换实例。
121
- - `instance_swap` 的 value 必须来自组件能力映射(组件名/name、ukey 或组件 id),不是任意字符串。
107
+ - `instance_swap` 的 value 必须来自组件能力映射里的组件名(name),禁止改写。
108
+ - 当 value 来自 `icons.json` 时,只能来自 `icons[].name`,禁止改写。
122
109
  - 若某替换目标存在对应 props 开关(如 `显示图标` / `显示右边图标` / `启用前缀`),使用替换时必须同步设为 `true`。
123
110
  - `instance_swap` 与子节点直写是两条通道:前者是组件内部实例替换,后者是显式节点渲染,不能混用表达同一替换位。
124
111
 
@@ -198,7 +185,7 @@ get_library_list -> get_component_info -> 读取 index/components/icons/variable
198
185
  ## 构建策略
199
186
  - `full-components`(全组件设计模式):
200
187
  - 页面中的功能区块(如头部、筛选区、表单区、表格区、操作区、状态区)必须优先使用 `<ui-component>`
201
- - 只要 `index.json + components/*.json` 中存在可用组件,就禁止改为普通 HTML 自绘
188
+ - 只要 `components/*.json` 中存在可用组件,就禁止改为普通 HTML 自绘
202
189
  - 必须全量使用组件库样式变量与图标系统(变量优先,格式为 `var(...)`)
203
190
  - 仅当本地快照中确实不存在可用组件时,才允许局部回退普通 HTML,并在输出前自检中逐项说明“缺失组件原因”
204
191
  - `hybrid`(混合设计模式):
@@ -214,18 +201,17 @@ buildStrategy = "hybrid"
214
201
 
215
202
  ## full-components 专项硬约束
216
203
  - 禁止把常见可组件化区块直接自绘:按钮、输入框、下拉、表单项、标签、卡片、表格、分页、弹窗、菜单、导航、空状态、加载态。
217
- - 先从 `index.json` 选择候选组件,再读取对应 `components/{key}.json` 确认 props/slots;确认可用后必须使用 `<ui-component>`。
204
+ - 先读取 `index.md` 了解文件位置,再从 `components/*.json` 选择候选组件并确认 props/slots;确认可用后必须使用 `<ui-component>`。
218
205
  - 组件布局样式按排版需要声明:占满剩余空间使用 `flex-1/self-stretch`;仅在需要固定宽度时写 `w-[...]`。
219
206
  - 若最终出现普通 HTML 区块,必须满足两条:
220
207
  1. 在组件快照中无法找到可替代组件;
221
208
  2. 在输出前自检中逐项标注“区块名 + 缺失原因”。
222
- - 变量样式强约束:凡能匹配 `variable.json` 的样式属性必须使用 `var(...)`,不得随意写 Hex/px 字面值。
223
- - 变量名强约束:`var(...)` 中必须写变量名(`name`/`ukey`),禁止把 `value` 直接写进 class(如 `bg-[#1677FF]`、`gap-[8px]`)。
209
+ - 变量样式遵循 `variable-import.md`:能匹配 `variable.json` 的属性必须 `var(...)`;只写 `name`,禁止抄 `value`。
224
210
 
225
211
  ## 失败回退
226
212
  关键字段缺失或不确定时,允许回退普通 HTML;不要使用不确定的组件引用。
227
213
  但在 `full-components` 模式下,回退仅限“组件快照不存在可替代项”的区块,且必须在自检中逐项说明。
228
- 变量缺失时,也仅允许该属性局部回退字面值,并在自检中说明“属性 + 缺失变量原因”。
214
+ 变量回退细则见 `variable-import.md`。
229
215
 
230
216
  示例:
231
217
  ```text
@@ -236,7 +222,9 @@ buildStrategy = "hybrid"
236
222
  - 修改现有节点时,默认使用 `agent_update_node`。
237
223
  - 图标、图片、样式、文本及大多数局部结构调整,都应优先通过 `agent_update_node` 完成。
238
224
 
239
- 推荐顺序:
225
+ **重要前置条件**:`get_selection_code` 仅用于"读取/同步当前画布上下文"。在用户没有给出具体修改诉求(例如"把按钮改成蓝色"、"替换文案为 XXX")之前,**禁止**在 `get_selection_code` 之后自动衔接 `agent_update_node` / `agent_replace_node` / `sync_to_design`。仅完成读取后即停下来,等待用户的下一步指令。
226
+
227
+ 推荐顺序(仅当用户已发出明确修改诉求时才进入):
240
228
  1. `get_selection_code` 拉取最新上下文
241
229
  2. `agent_update_node` 提交属性修改
242
230
  3. 再次 `get_selection_code` 验证结果
@@ -0,0 +1,129 @@
1
+ {
2
+ "getGuidelines": {
3
+ "description": "[Session entry] When the user wants to use {{displayName}} / MasterGo workflows (e.g. \"use {{displayName}} mcp\", \"design with {{displayName}}\"), call this tool first. scope is a string array, default [\"page-generate\"]. Available values: page-generate / component-import / component-generate / variable-import / variable-generate. component-generate is only for agent_create_component master component/component-set creation; for team/component-library page generation, pass [\"page-generate\",\"component-import\",\"variable-import\"].",
4
+ "inputSchema": "Optional: scope (string array, items in page-generate / component-import / component-generate / variable-import / variable-generate). Default [\"page-generate\"]. Multiple scopes are concatenated and a Final Hard Gate section is appended."
5
+ },
6
+ "createPage": {
7
+ "description": "[INTERNAL submission tool · Only call after design_page has produced final HTML] Submits a fully-generated page HTML to the {{pluginName}} canvas. ⚠️ When the user says \"design / create / make / build / draw / generate a page\" (or the Chinese equivalents 设计 / 创建 / 做一个 / 帮我画 / 生成 一个页面), DO NOT call this tool directly — you MUST first call design_page to go through requirement decomposition and design-source selection. This tool only ships the final HTML produced by the design_page flow.\n\n[Performance Tip] If pure HTML is already saved as a local file, prefer passing the absolute path via filePath to save tokens. If the code is temporarily generated, use the code parameter directly.\n\nReverse Transpilation Warning: Strictly forbidden to directly send Vue/React business code containing dynamic bindings ({{}}) or framework directives! If you want to convert business code to a design, you MUST first perform \"Reverse Transpilation\" and, when needed, load the official rules through get_guidelines before sending pure HTML with static mock data.",
8
+ "code": "[Optional] The HTML code content to send. Use ONLY if the code is temporarily generated and not saved as a file.",
9
+ "filePath": "[Optional] The absolute path of the local HTML file. If the file exists locally, you MUST pass this parameter; the tool will automatically read and persist it.",
10
+ "projectDir": "[Required] The absolute path of the user's current workspace root directory.",
11
+ "saveCodeToLocal": "Whether to save the rendering results returned by the plugin to the local {{docDir}} directory (persistence mechanism)."
12
+ },
13
+ "updateNode": {
14
+ "description": "Default tool for edits on existing nodes. Text, styles, icons, images, and most local structural adjustments should all use agent_update_node first. Note: if modifying a parent container's styles or internal content, the returned HTML must include all child elements that should be preserved to prevent data loss.",
15
+ "documentId": "Current MasterGo document ID.",
16
+ "documentPageId": "Current MasterGo page ID.",
17
+ "targetNodeId": "[Optional] Target layer ID (e.g., 123:456). Defaults to the current selection.",
18
+ "code": "[Required] Modified HTML fragment. MUST include data-node-id."
19
+ },
20
+ "replaceNode": {
21
+ "description": "Use this tool only when the user explicitly asks to replace a specific node, icon, or image. Icons should follow FontAwesome, and image replacement should follow the <img src=\"{{keyword}}\" /> semantic convention.",
22
+ "documentId": "Current MasterGo document ID.",
23
+ "documentPageId": "Current MasterGo page ID.",
24
+ "targetNodeId": "[Optional] Target layer ID (e.g., 123:456). Defaults to the current selection.",
25
+ "code": "[Required] New HTML code. Will fully replace the target node content."
26
+ },
27
+ "removeVariable": {
28
+ "description": "Remove variable: dedicated tool for dangerous delete operations. Deletes variables in the current MasterGo file and does not use update_variables; tool name is agent_remove_variable. Prefer id; without id, collection/collectionId + name + type are required to avoid accidental deletion. The first call auto-loads the variable-generate rules.",
29
+ "documentId": "Current MasterGo document ID.",
30
+ "documentPageId": "Current MasterGo page ID.",
31
+ "id": "[Recommended] Variable ID to delete.",
32
+ "collection": "[Required without id] Variable collection name.",
33
+ "collectionId": "[Optional] Variable collection ID; can replace collection.",
34
+ "name": "[Required without id] Variable name.",
35
+ "type": "[Required without id] Variable type, such as COLOR, PAINT, NUMBER.",
36
+ "variables": "[Optional] Batch delete array. Each item should provide id, or collection/collectionId + name + type."
37
+ },
38
+ "syncToDesign": {
39
+ "description": "Perform a [Full Sync]: overwrite the MasterGo design with your full static HTML file. Only call this when the user explicitly asks to sync to canvas; never auto-sync after local edits.",
40
+ "documentId": "Current MasterGo document ID.",
41
+ "documentPageId": "Current MasterGo page ID.",
42
+ "targetNodeId": "[Recommended] Root Node ID (rootId). Defaults to current selection if omitted.",
43
+ "filePath": "[Required] Absolute path of local static HTML file (found in {{docDir}}/...). Tool auto-reads the file. NEVER pass .vue/.tsx paths!",
44
+ "userConfirmed": "[Required] Whether the user explicitly confirmed syncing to canvas. Only pass true after explicit user request."
45
+ },
46
+ "getSelectionCode": {
47
+ "description": "Get HTML/CSS code for the currently selected layer (or a specified layer) in MasterGo and intelligently persist it to the local project directory. This tool ONLY reads/syncs context — do NOT chain agent_update_node / agent_replace_node / sync_to_design after this call unless the user has issued an explicit modification request. The generated code is typically used for partial modifications or syncing local base files. For a rendered preview image (visual reference), call get_selection_image separately.",
48
+ "projectDir": "[Required] The absolute path of the user's current workspace root directory.",
49
+ "targetNodeId": "[Optional] MasterGo layer ID (e.g., 123:456). If provided, the code for that ID will be pulled directly; if not, the code for the currently selected layer will be pulled.",
50
+ "syncToBase": "[Optional] Whether to sync the obtained child layer code back to the base HTML file in the local {{docDir}} directory (merge update). Defaults to true."
51
+ },
52
+ "getSelectionImage": {
53
+ "description": "Get a rendered preview (PNG by default) of the currently selected layer (or a specified layer) in MasterGo. Call this ONLY when you need a visual reference — e.g. \"match the design\", \"reproduce this design\", \"follow the visual\", \"reference the mockup\", \"还原设计稿\", \"对照视觉\". The response includes an image content block for multimodal grounding and persists a copy to {{docDir}}/.preview/ so the user can verify what the model saw. For routine code sync / small edits use get_selection_code, not this tool.",
54
+ "projectDir": "[Required] Absolute path of the workspace root. Previews are persisted to {{docDir}}/.preview/{documentId}/{pageId}/{nodeId}.png under this root.",
55
+ "targetNodeId": "[Optional] MasterGo layer ID (e.g., 123:456). If provided, that layer is exported; otherwise the currently selected layer is exported.",
56
+ "targetNodeIds": "[Optional] Batch list of target layer IDs. When provided, previews are exported in list order."
57
+ },
58
+ "createComponent": {
59
+ "description": "Create a MasterGo master component or component set (variant). Only when creating master components/component sets, load get_guidelines(scope=[\"component-generate\"]) first, then call this tool. Do not use component-generate for team/component-library page generation. This tool only sends code to plugin and does not perform fallback rule validation.",
60
+ "code": "Pure HTML string of the component. Root node must include data-type=\"component\" or \"component-set\". For component-set, variant nodes must be direct children and variant attributes must be declared with flat data-variant-* fields.",
61
+ "projectDir": "[Optional] Absolute path of the user workspace root. When provided, the tool checks {{docDir}}/variable/ for the current file's variable snapshot; if found, the variable-import rules are loaded automatically so master components reference var(...) tokens instead of literal values, preserving design-system consistency."
62
+ },
63
+ "getDesignDiff": {
64
+ "description": "Get the difference between the local base file and the current MasterGo canvas design. Returns a JSON Diff result to help determine what layers or styles have changed.",
65
+ "projectDir": "[Required] The absolute path of the user's current workspace root directory.",
66
+ "targetNodeId": "[Optional] MasterGo layer ID (e.g., 123:456). If not provided, the code of the currently selected layer will be fetched for comparison by default.",
67
+ "filePath": "[Optional] The absolute path of the local base HTML file. If you have updated the base file via write_to_file, pass this path directly.",
68
+ "syncType": "[Optional] Sync direction, must be codeSyncDesign (code syncs to design) or designSyncCode (design syncs to code)."
69
+ },
70
+ "getCodeList": {
71
+ "description": "Get a list of all available code items",
72
+ "inputSchema": "Get code list without parameters"
73
+ },
74
+ "design": {
75
+ "description": "[PAGE DESIGN MAIN ENTRY · MUST be the first call] When the user expresses any page-level generation intent — \"design / create / make / build / draw / generate a page\" or the Chinese equivalents 设计 / 创建 / 做一个 / 帮我画 / 生成 一个页面 — you MUST call this tool first. NEVER call submit_page_to_canvas directly to skip this flow. This tool owns requirement decomposition, design-source selection, and HTML+CSS generation; the final HTML is then handed off to submit_page_to_canvas. Fixed flow: first let the user choose one of three design sources — free-draw / current-file-variables / component-library. Choosing current-file-variables enforces get_variables to persist the current file variables and then references them via variable-import.md. Choosing component-library asks for a team library and a build strategy. Only after these confirmations will the page be generated.",
76
+ "requirement": "Interface requirement description, e.g., \"a beautiful login page\", \"a modern dashboard interface\", etc.",
77
+ "code": "[Optional] If full code is already generated (can include Markdown + <main>), it will auto-extract <main> and submit directly to canvas.",
78
+ "projectDir": "[Optional] Absolute path of the user workspace root. Required when reading or writing {{docDir}} snapshots (variables / component library).",
79
+ "designSource": "[Required by workflow] Design source, one of: free-draw / current-file-variables / component-library. The user must explicitly choose each design_page call.",
80
+ "userConfirmedDesignSource": "[Required by workflow] Whether the user confirmation for the three-way design-source choice has been completed in this page-generation flow.",
81
+ "teamLibraryName": "[Required in component mode] User-confirmed team library name. Must be reconfirmed each time; assistant must not auto-pick.",
82
+ "teamLibraryId": "[Recommended in component mode] User-confirmed team library ID. When the ID is already known (e.g. from get_library_list), pass it alongside teamLibraryName; used to dedupe same-library checks accurately and avoid false reuse when two libraries normalize to the same name.",
83
+ "buildStrategy": "[Required in component mode] Build strategy: full-components / hybrid. full-components prioritizes library components; hybrid uses components only for key functional areas. Both strategies must follow component-import.md + variable-import.md. If omitted, ask the user to choose first."
84
+ },
85
+ "getUserInfo": {
86
+ "description": "Get current logged-in user information, including quotas, teams, etc.",
87
+ "inputSchema": "Get current user information"
88
+ },
89
+ "getCode": {
90
+ "description": "[Specific Scenario] Get code from the {{pluginName}} via contentId. For regular \"get selected code\" tasks, please prioritize using the get_selection_code tool.",
91
+ "contentId": "Instruction to copy layers from the {{pluginName}} (contentId)",
92
+ "documentId": "Current MasterGo document ID.",
93
+ "documentPageId": "Current MasterGo page ID.",
94
+ "projectDir": "[Required] The absolute path of the user's current workspace root directory.",
95
+ "outDir": "[Required] The absolute path to save code and resources"
96
+ },
97
+ "getLibraryList": {
98
+ "description": "Get team library list subscribed/loaded in current file (name, id, componentCount, styleCount). When user says \"generate page with xxx component library\", call this tool first.",
99
+ "inputSchema": "No parameters"
100
+ },
101
+ "getComponentInfo": {
102
+ "description": "Get component data of a specified team library and persist it as a local snapshot for component-library page generation. Each call with a specified team library re-fetches from remote and overwrites the local snapshot. Only call this when the user explicitly wants to generate with a team/component library; do not call it for regular design flows. If teamLibraryId is missing, return library choices first; after user confirmation, teamLibraryName can auto-match the id. Page generation rules live in component-import.md.",
103
+ "projectDir": "[Required] Absolute path of the user's workspace root (for persistence).",
104
+ "teamLibraryId": "[Optional] Team library ID. If provided, fetch directly.",
105
+ "teamLibraryName": "[Optional] Team library name. Used to auto-match ID when teamLibraryId is not provided.",
106
+ "includePropertyDetails": "[Optional] Include component property details. Default true."
107
+ },
108
+ "getVariables": {
109
+ "description": "Get all local variables in the current MasterGo file. This reads the current file only, not remote team libraries. Returns documentName, documentId, and variables (same batch array format as updateVariables); also accepts API responses that return a bare array. On success, writes the variables field to {{docDir}}/variable/{documentId}.json.",
110
+ "inputSchema": "Required: projectDir (absolute workspace root for writing the snapshot).",
111
+ "projectDir": "[Required] Absolute path of the workspace root; variables are written to {{docDir}}/variable/{documentId}.json."
112
+ },
113
+ "updateVariables": {
114
+ "description": "Update variables: create, modify, or reorder variables in the current MasterGo file. Deleting variables must use agent_remove_variable. Fixed flow: call get_variables first; when creating a token set, submit base variables first, call get_variables again, then submit semantic/reference variables, and finally call get_variables again. The first call auto-loads the variable-generate rules.",
115
+ "inputSchema": "Required: projectDir. Provide one data source: filePath, variables, or operations. If only documentId is provided, reads {{docDir}}/variable/{documentId}.json.",
116
+ "projectDir": "[Required] Absolute path of the user's workspace root.",
117
+ "documentId": "[Optional] Current MasterGo document ID; used to locate {{docDir}}/variable/{documentId}.json when filePath/variables/operations are omitted.",
118
+ "documentPageId": "[Optional] Current MasterGo page ID.",
119
+ "filePath": "[Optional] Absolute path of the variable JSON file, typically {{docDir}}/variable/{documentId}.json from get_variables.",
120
+ "variables": "[Optional] Variable array in the same format written by get_variables; { variables: [...] } is also accepted.",
121
+ "operations": "[Optional] Operation array for createVariable/updateVariable/moveVariable and other non-snapshot operations. Use agent_remove_variable for deletes."
122
+ },
123
+ "removeNode": {
124
+ "description": "Delete nodes in the MasterGo canvas. Supports specifying an ID via targetNodeId, or defaults to the currently selected layer if no ID is provided.",
125
+ "documentId": "Current MasterGo document ID.",
126
+ "documentPageId": "Current MasterGo page ID.",
127
+ "targetNodeId": "[Optional] The target layer ID to delete (e.g., 123:456). If not provided, the currently selected layer in MasterGo will be deleted by default."
128
+ }
129
+ }