{"record":{"id":"f7d78fcba55d69ae","repo":"flipped-aurora/gin-vue-admin","slug":"apigroup","errorCode":null,"errorMessage":"apiGroup 参数是必需的","messagePattern":"apiGroup 参数是必需的","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/mcp/api_creator.go","lineNumber":83,"sourceCode":"\targs := request.GetArguments()\n\n\tvar apis []ApiCreateRequest\n\tif apisStr, ok := args[\"apis\"].(string); ok && apisStr != \"\" {\n\t\tif err := json.Unmarshal([]byte(apisStr), &apis); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"apis 参数格式错误: %w\", err)\n\t\t}\n\t} else {\n\t\tpath, ok := args[\"path\"].(string)\n\t\tif !ok || path == \"\" {\n\t\t\treturn nil, errors.New(\"path 参数是必需的\")\n\t\t}\n\t\tdescription, ok := args[\"description\"].(string)\n\t\tif !ok || description == \"\" {\n\t\t\treturn nil, errors.New(\"description 参数是必需的\")\n\t\t}\n\t\tapiGroup, ok := args[\"apiGroup\"].(string)\n\t\tif !ok || apiGroup == \"\" {\n\t\t\treturn nil, errors.New(\"apiGroup 参数是必需的\")\n\t\t}\n\n\t\tmethod := \"POST\"\n\t\tif value, ok := args[\"method\"].(string); ok && value != \"\" {\n\t\t\tmethod = value\n\t\t}\n\n\t\tapis = append(apis, ApiCreateRequest{\n\t\t\tPath:        path,\n\t\t\tDescription: description,\n\t\t\tApiGroup:    apiGroup,\n\t\t\tMethod:      method,\n\t\t})\n\t}\n\n\tif len(apis) == 0 {\n\t\treturn nil, errors.New(\"没有要创建的API\")\n\t}","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/flipped-aurora/gin-vue-admin/blob/3136500ef380842b0eb6c4daa87c3f8a47fcf9e0/server/mcp/api_creator.go#L65-L101","documentation":"Thrown by ApiCreator's Handle when the \"apiGroup\" argument is missing, empty, or not a string in single-API mode. apiGroup determines which API group (gin route group) the new API record belongs to.","triggerScenarios":"Invoking api_creator with \"path\" and \"description\" supplied but no \"apiGroup\" string, an empty string, or a non-string value.","commonSituations":"Agents unaware apiGroup is mandatory; callers confusing apiGroup with the optional \"method\" argument; group names lost when arguments are programmatically assembled.","solutions":["Pass a non-empty \"apiGroup\" string matching an existing system API group (e.g. \"user\", \"authority\").","Check the API groups already registered in the system (sys_apis) and reuse one of their names.","If creating several APIs, move them into the \"apis\" JSON array argument where each object includes apiGroup."],"exampleFix":"// before\n{\"arguments\": {\"path\": \"/user/list\", \"description\": \"获取用户列表\"}}\n// after\n{\"arguments\": {\"path\": \"/user/list\", \"description\": \"获取用户列表\", \"apiGroup\": \"user\"}}","handlingStrategy":"validation","validationCode":"const apiGroup = args[\"apiGroup\"]\nif (typeof apiGroup !== \"string\" || apiGroup === \"\") {\n  throw new Error(\"apiGroup must be a non-empty string before calling api_creator\")\n}","typeGuard":"function hasApiGroup(args) {\n  return typeof args.apiGroup === \"string\" && args.apiGroup.length > 0\n}","tryCatchPattern":"try {\n  await callTool(\"api_creator\", { path, description, apiGroup })\n} catch (e) {\n  if (e.message.includes(\"apiGroup 参数是必需的\")) {\n    // resolve a valid group name and retry\n  }\n}","preventionTips":["Fetch valid group names from the system API list and pass one explicitly.","Never leave apiGroup blank hoping for a default — there is none.","Keep a shared helper that constructs api_creator arguments with all required fields."],"tags":["mcp","missing-argument","validation"],"backgroundTag":"missing-required-parameter","analyzedSha":"3136500ef380842b0eb6c4daa87c3f8a47fcf9e0","analyzedAt":"2026-08-31T13:50:02.721Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}