Skip to content

Commit ca0a125

Browse files
author
piexlMax(奇淼
committed
refactor(mcp): 修改execute定义
1 parent 709cdef commit ca0a125

File tree

1 file changed

+139
-5
lines changed

1 file changed

+139
-5
lines changed

server/mcp/gva_execute.go

Lines changed: 139 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ type ExecutionPlan struct {
5757

5858
// New 创建GVA代码生成执行器工具
5959
func (g *GVAExecutor) New() mcp.Tool {
60-
return mcp.NewTool("gva_execute",
60+
return mcp.NewTool("gva_execute",
6161
mcp.WithDescription(`**GVA代码生成执行器:直接执行代码生成,无需确认步骤**
6262
6363
**核心功能:**
@@ -194,10 +194,144 @@ func (g *GVAExecutor) New() mcp.Tool {
194194
- 当字段配置了dataSource且association=2(一对多关联)时,系统会自动将fieldType修改为'array'
195195
- 这确保了一对多关联数据的正确存储和处理
196196
- 修正操作会记录在日志中,便于开发者了解变更情况`),
197-
mcp.WithObject("executionPlan",
198-
mcp.Description("执行计划,包含包信息和模块信息"),
199-
mcp.Required(),
200-
),
197+
mcp.WithObject("executionPlan",
198+
mcp.Description("执行计划,包含包信息、模块与字典信息"),
199+
mcp.Required(),
200+
mcp.Properties(map[string]interface{}{
201+
"packageName": map[string]interface{}{
202+
"type": "string",
203+
"description": "包名(小写开头)",
204+
},
205+
"packageType": map[string]interface{}{
206+
"type": "string",
207+
"description": "package 或 plugin",
208+
"enum": []string{"package", "plugin"},
209+
},
210+
"needCreatedPackage": map[string]interface{}{
211+
"type": "boolean",
212+
"description": "是否需要创建包",
213+
},
214+
"needCreatedModules": map[string]interface{}{
215+
"type": "boolean",
216+
"description": "是否需要创建模块",
217+
},
218+
"needCreatedDictionaries": map[string]interface{}{
219+
"type": "boolean",
220+
"description": "是否需要创建字典",
221+
},
222+
"packageInfo": map[string]interface{}{
223+
"type": "object",
224+
"description": "包创建信息",
225+
"properties": map[string]interface{}{
226+
"desc": map[string]interface{}{"type": "string", "description": "包描述"},
227+
"label": map[string]interface{}{"type": "string", "description": "展示名"},
228+
"template": map[string]interface{}{"type": "string", "description": "package 或 plugin", "enum": []string{"package", "plugin"}},
229+
"packageName": map[string]interface{}{"type": "string", "description": "包名"},
230+
},
231+
},
232+
"modulesInfo": map[string]interface{}{
233+
"type": "array",
234+
"description": "模块配置列表",
235+
"items": map[string]interface{}{
236+
"type": "object",
237+
"properties": map[string]interface{}{
238+
"package": map[string]interface{}{"type": "string", "description": "包名(小写开头)"},
239+
"tableName": map[string]interface{}{"type": "string", "description": "数据库表名(蛇形命名)"},
240+
"businessDB": map[string]interface{}{"type": "string", "description": "业务数据库(可留空表示默认)"},
241+
"structName": map[string]interface{}{"type": "string", "description": "结构体名(大驼峰)"},
242+
"packageName": map[string]interface{}{"type": "string", "description": "文件名称"},
243+
"description": map[string]interface{}{"type": "string", "description": "中文描述"},
244+
"abbreviation": map[string]interface{}{"type": "string", "description": "简称"},
245+
"humpPackageName": map[string]interface{}{"type": "string", "description": "文件名称(小驼峰)"},
246+
"gvaModel": map[string]interface{}{"type": "boolean", "description": "是否使用GVA模型(固定为true)"},
247+
"autoMigrate": map[string]interface{}{"type": "boolean"},
248+
"autoCreateResource": map[string]interface{}{"type": "boolean"},
249+
"autoCreateApiToSql": map[string]interface{}{"type": "boolean"},
250+
"autoCreateMenuToSql": map[string]interface{}{"type": "boolean"},
251+
"autoCreateBtnAuth": map[string]interface{}{"type": "boolean"},
252+
"onlyTemplate": map[string]interface{}{"type": "boolean"},
253+
"isTree": map[string]interface{}{"type": "boolean"},
254+
"treeJson": map[string]interface{}{"type": "string"},
255+
"isAdd": map[string]interface{}{"type": "boolean"},
256+
"generateWeb": map[string]interface{}{"type": "boolean"},
257+
"generateServer": map[string]interface{}{"type": "boolean"},
258+
"fields": map[string]interface{}{
259+
"type": "array",
260+
"items": map[string]interface{}{
261+
"type": "object",
262+
"properties": map[string]interface{}{
263+
"fieldName": map[string]interface{}{"type": "string"},
264+
"fieldDesc": map[string]interface{}{"type": "string"},
265+
"fieldType": map[string]interface{}{"type": "string"},
266+
"fieldJson": map[string]interface{}{"type": "string"},
267+
"dataTypeLong": map[string]interface{}{"type": "string"},
268+
"comment": map[string]interface{}{"type": "string"},
269+
"columnName": map[string]interface{}{"type": "string"},
270+
"fieldSearchType": map[string]interface{}{"type": "string"},
271+
"fieldSearchHide": map[string]interface{}{"type": "boolean"},
272+
"dictType": map[string]interface{}{"type": "string"},
273+
"form": map[string]interface{}{"type": "boolean"},
274+
"table": map[string]interface{}{"type": "boolean"},
275+
"desc": map[string]interface{}{"type": "boolean"},
276+
"excel": map[string]interface{}{"type": "boolean"},
277+
"require": map[string]interface{}{"type": "boolean"},
278+
"defaultValue": map[string]interface{}{"type": "string"},
279+
"errorText": map[string]interface{}{"type": "string"},
280+
"clearable": map[string]interface{}{"type": "boolean"},
281+
"sort": map[string]interface{}{"type": "boolean"},
282+
"primaryKey": map[string]interface{}{"type": "boolean"},
283+
"dataSource": map[string]interface{}{
284+
"type": "object",
285+
"properties": map[string]interface{}{
286+
"dbName": map[string]interface{}{"type": "string"},
287+
"table": map[string]interface{}{"type": "string"},
288+
"label": map[string]interface{}{"type": "string"},
289+
"value": map[string]interface{}{"type": "string"},
290+
"association": map[string]interface{}{"type": "integer"},
291+
"hasDeletedAt": map[string]interface{}{"type": "boolean"},
292+
},
293+
},
294+
"checkDataSource": map[string]interface{}{"type": "boolean"},
295+
"fieldIndexType": map[string]interface{}{"type": "string"},
296+
},
297+
},
298+
},
299+
},
300+
},
301+
},
302+
"paths": map[string]interface{}{
303+
"type": "object",
304+
"description": "生成的文件路径映射",
305+
"additionalProperties": map[string]interface{}{"type": "string"},
306+
},
307+
"dictionariesInfo": map[string]interface{}{
308+
"type": "array",
309+
"description": "字典创建信息",
310+
"items": map[string]interface{}{
311+
"type": "object",
312+
"properties": map[string]interface{}{
313+
"dictType": map[string]interface{}{"type": "string"},
314+
"dictName": map[string]interface{}{"type": "string"},
315+
"description": map[string]interface{}{"type": "string"},
316+
"status": map[string]interface{}{"type": "boolean"},
317+
"fieldDesc": map[string]interface{}{"type": "string"},
318+
"options": map[string]interface{}{
319+
"type": "array",
320+
"items": map[string]interface{}{
321+
"type": "object",
322+
"properties": map[string]interface{}{
323+
"label": map[string]interface{}{"type": "string"},
324+
"value": map[string]interface{}{"type": "string"},
325+
"sort": map[string]interface{}{"type": "integer"},
326+
},
327+
},
328+
},
329+
},
330+
},
331+
},
332+
}),
333+
mcp.AdditionalProperties(false),
334+
),
201335
mcp.WithString("requirement",
202336
mcp.Description("原始需求描述(可选,用于日志记录)"),
203337
),

0 commit comments

Comments
 (0)