{"record":{"id":"82e737127db5ac0c","repo":"flipped-aurora/gin-vue-admin","slug":"path-82e737","errorCode":null,"errorMessage":"path 参数是必需的","messagePattern":"path 参数是必需的","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/mcp/menu_creator.go","lineNumber":119,"sourceCode":"\t\t),\n\t\tmcp.WithString(\"activeName\",\n\t\t\tmcp.Description(\"高亮菜单名称\"),\n\t\t),\n\t\tmcp.WithString(\"parameters\",\n\t\t\tmcp.Description(\"路由参数JSON字符串，格式：[{\\\"type\\\":\\\"params\\\",\\\"key\\\":\\\"id\\\",\\\"value\\\":\\\"1\\\"}]\"),\n\t\t),\n\t\tmcp.WithString(\"menuBtn\",\n\t\t\tmcp.Description(\"菜单按钮JSON字符串，格式：[{\\\"name\\\":\\\"add\\\",\\\"desc\\\":\\\"新增\\\"}]\"),\n\t\t),\n\t)\n}\n\nfunc (m *MenuCreator) Handle(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {\n\targs := request.GetArguments()\n\n\tpath, ok := args[\"path\"].(string)\n\tif !ok || path == \"\" {\n\t\treturn nil, errors.New(\"path 参数是必需的\")\n\t}\n\tname, ok := args[\"name\"].(string)\n\tif !ok || name == \"\" {\n\t\treturn nil, errors.New(\"name 参数是必需的\")\n\t}\n\tcomponent, ok := args[\"component\"].(string)\n\tif !ok || component == \"\" {\n\t\treturn nil, errors.New(\"component 参数是必需的\")\n\t}\n\ttitle, ok := args[\"title\"].(string)\n\tif !ok || title == \"\" {\n\t\treturn nil, errors.New(\"title 参数是必需的\")\n\t}\n\n\t// 兼容 MCP 客户端把数字发成字符串的情况(parentId 允许 0=根,故用 parseOptionalUint;\n\t// 否则字符串 \"5\" 断言 float64 失败会静默回落 0,把菜单错挂到根)\n\tparentID := parseOptionalUint(args[\"parentId\"], 0)\n\thidden := parseOptionalBool(args[\"hidden\"], false)","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/flipped-aurora/gin-vue-admin/blob/3136500ef380842b0eb6c4daa87c3f8a47fcf9e0/server/mcp/menu_creator.go#L101-L137","documentation":"MenuCreator's Handle requires a 'path' argument (the frontend route path of the menu to create). It asserts args[\"path\"].(string) and additionally rejects the empty string; a missing key, a non-string value, or \"\" all produce this error before any menu creation happens.","triggerScenarios":"Calling the menu-creation MCP tool without 'path', with path as a non-string, or with path: \"\".","commonSituations":"LLM-driven tool call omitting a parameter the model considered optional; argument map built with wrong key casing ('Path'); upstream flow that derives path from another field which was empty.","solutions":["Provide a non-empty 'path' string, e.g. {\"path\": \"/system/user\"}.","Ensure the route path starts with '/' following Vue Router conventions if that is your project's convention.","Check the tool argument names against the schema: path, name, component, title are all required.","If path is derived programmatically, validate it is non-empty before invoking the tool."],"exampleFix":"// before\n{\"name\": \"user\", \"component\": \"view/system/user/user.vue\", \"title\": \"用户管理\"}\n// after\n{\"path\": \"/system/user\", \"name\": \"user\", \"component\": \"view/system/user/user.vue\", \"title\": \"用户管理\"}","handlingStrategy":"validation","validationCode":"path, _ := args[\"path\"].(string)\nif path == \"\" {\n    return errors.New(\"provide a non-empty route path, e.g. /system/user\")\n}","typeGuard":"func nonEmptyString(v any) bool {\n    s, ok := v.(string)\n    return ok && s != \"\"\n}","tryCatchPattern":null,"preventionTips":["Always supply path, name, component and title together when calling the menu tool.","Follow your project's route-path convention (leading slash) when constructing path.","Validate the argument map against the tool schema before invoking."],"tags":["mcp","validation","go","missing-argument"],"backgroundTag":"missing-required-parameter","analyzedSha":"3136500ef380842b0eb6c4daa87c3f8a47fcf9e0","analyzedAt":"2026-08-31T13:50:02.721Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}