{"record":{"id":"e82f3a0291759ecb","repo":"flipped-aurora/gin-vue-admin","slug":"path","errorCode":null,"errorMessage":"path 参数是必需的","messagePattern":"path 参数是必需的","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/mcp/api_creator.go","lineNumber":75,"sourceCode":"\t\t),\n\t\tmcp.WithString(\"apis\",\n\t\t\tmcp.Description(\"批量创建API的JSON字符串，格式：[{\\\"path\\\":\\\"/user/create\\\",\\\"description\\\":\\\"创建用户\\\",\\\"apiGroup\\\":\\\"用户管理\\\",\\\"method\\\":\\\"POST\\\"}]\"),\n\t\t),\n\t)\n}\n\nfunc (a *ApiCreator) Handle(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {\n\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,","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/flipped-aurora/gin-vue-admin/blob/3136500ef380842b0eb6c4daa87c3f8a47fcf9e0/server/mcp/api_creator.go#L57-L93","documentation":"This error is thrown by the ApiCreator MCP tool's Handle method when the tool is invoked in single-API mode and the \"path\" argument is missing, empty, or not a string. The tool requires path/description/apiGroup to build an ApiCreateRequest. It fails fast before any API record is created.","triggerScenarios":"Calling the api_creator tool without a \"path\" argument, with args[\"path\"] set to a non-string (e.g. number, null), or with an empty string, while not using the bulk \"apis\" JSON mode.","commonSituations":"LLM agents omitting required fields in tool calls; callers accidentally using the bulk \"apis\" argument style while individual fields are expected; empty path produced by upstream templating.","solutions":["Pass a non-empty string \"path\" argument (e.g. \"/user/list\") in the tool call arguments.","If creating multiple APIs, pass them all as JSON via the \"apis\" argument instead of individual fields.","Verify the argument value is a JSON string, not a number or null."],"exampleFix":"// before\n{\"name\": \"api_creator\", \"arguments\": {\"description\": \"list users\", \"apiGroup\": \"user\"}}\n// after\n{\"name\": \"api_creator\", \"arguments\": {\"path\": \"/user/list\", \"description\": \"list users\", \"apiGroup\": \"user\"}}","handlingStrategy":"validation","validationCode":"const path = args[\"path\"]\nif (typeof path !== \"string\" || path === \"\") {\n  throw new Error(\"path must be a non-empty string before calling api_creator\")\n}","typeGuard":"function hasPath(args) {\n  return typeof args.path === \"string\" && args.path.length > 0\n}","tryCatchPattern":"try {\n  await callTool(\"api_creator\", { path, description, apiGroup })\n} catch (e) {\n  if (e.message.includes(\"path 参数是必需的\")) {\n    // fix arguments and retry with a valid path\n  }\n}","preventionTips":["Always build tool arguments from a schema or typed object with required fields.","Validate path is a non-empty string before every api_creator call.","Prefer the bulk \"apis\" argument for multiple records so field requirements are explicit."],"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"}