{"record":{"id":"123759c4216b704b","repo":"flipped-aurora/gin-vue-admin","slug":"dicttype","errorCode":null,"errorMessage":"dictType 参数是必需的","messagePattern":"dictType 参数是必需的","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/mcp/dictionary_generator.go","lineNumber":71,"sourceCode":"\t\tmcp.WithString(\"options\",\n\t\t\tmcp.Required(),\n\t\t\tmcp.Description(\"字典选项JSON字符串，格式：[{\\\"label\\\":\\\"显示名\\\",\\\"value\\\":\\\"值\\\",\\\"sort\\\":1}]\"),\n\t\t),\n\t\tmcp.WithString(\"dictName\",\n\t\t\tmcp.Description(\"字典名称，如果不提供将自动生成\"),\n\t\t),\n\t\tmcp.WithString(\"description\",\n\t\t\tmcp.Description(\"字典描述\"),\n\t\t),\n\t)\n}\n\nfunc (d *DictionaryOptionsGenerator) Handle(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {\n\targs := request.GetArguments()\n\n\tdictType, ok := args[\"dictType\"].(string)\n\tif !ok || dictType == \"\" {\n\t\treturn nil, errors.New(\"dictType 参数是必需的\")\n\t}\n\tfieldDesc, ok := args[\"fieldDesc\"].(string)\n\tif !ok || fieldDesc == \"\" {\n\t\treturn nil, errors.New(\"fieldDesc 参数是必需的\")\n\t}\n\toptionsStr, ok := args[\"options\"].(string)\n\tif !ok || optionsStr == \"\" {\n\t\treturn nil, errors.New(\"options 参数是必需的\")\n\t}\n\n\tvar options []DictionaryOption\n\tif err := json.Unmarshal([]byte(optionsStr), &options); err != nil {\n\t\treturn nil, fmt.Errorf(\"options 参数格式错误: %v\", err)\n\t}\n\tif len(options) == 0 {\n\t\treturn nil, errors.New(\"options 不能为空\")\n\t}\n","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/flipped-aurora/gin-vue-admin/blob/3136500ef380842b0eb6c4daa87c3f8a47fcf9e0/server/mcp/dictionary_generator.go#L53-L89","documentation":"Thrown by DictionaryOptionsGenerator's Handle when the \"dictType\" argument is missing, empty, or not a string. dictType identifies the dictionary type whose option values will be generated and is required to build the DictionaryGenerateRequest.","triggerScenarios":"Invoking the dictionary_generator MCP tool without \"dictType\", with an empty string, or with a non-string value.","commonSituations":"Agents omitting dictType in generated tool calls; clients assuming the field is optional; empty dictType produced by upstream form/template logic.","solutions":["Pass a non-empty \"dictType\" string (e.g. \"sys_user_status\") in the tool arguments.","Use an existing dictionary type name defined in the system dictionary management.","Fix the caller that builds the arguments map so dictType is always included."],"exampleFix":"// before\n{\"arguments\": {\"fieldDesc\": \"用户状态\", \"options\": \"[]\"}}\n// after\n{\"arguments\": {\"dictType\": \"sys_user_status\", \"fieldDesc\": \"用户状态\", \"options\": \"[{\\\"label\\\":\\\"启用\\\",\\\"value\\\":1}]\"}}","handlingStrategy":"validation","validationCode":"const dictType = args[\"dictType\"]\nif (typeof dictType !== \"string\" || dictType === \"\") {\n  throw new Error(\"dictType must be a non-empty string before calling dictionary_generator\")\n}","typeGuard":"function hasDictType(args) {\n  return typeof args.dictType === \"string\" && args.dictType.length > 0\n}","tryCatchPattern":"try {\n  await callTool(\"dictionary_generator\", { dictType, fieldDesc, options })\n} catch (e) {\n  if (e.message.includes(\"dictType 参数是必需的\")) {\n    // supply dictType and retry\n  }\n}","preventionTips":["Reuse existing dictionary type names from system dictionary management.","Validate dictType is a non-empty string before the call.","Include dictType in the tool's required-argument schema shown to agents."],"tags":["mcp","missing-argument","dictionary"],"backgroundTag":"missing-required-parameter","analyzedSha":"3136500ef380842b0eb6c4daa87c3f8a47fcf9e0","analyzedAt":"2026-08-31T13:50:02.721Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}