flipped-aurora/gin-vue-admin · error

fieldDesc 参数是必需的

Error message

fieldDesc 参数是必需的

What it means

Thrown by DictionaryOptionsGenerator's Handle when the "fieldDesc" argument is missing, empty, or not a string. fieldDesc is the human-readable description of the dictionary field and is mandatory for generation output.

Source

Thrown at server/mcp/dictionary_generator.go:75

		mcp.WithString("dictName",
			mcp.Description("字典名称,如果不提供将自动生成"),
		),
		mcp.WithString("description",
			mcp.Description("字典描述"),
		),
	)
}

func (d *DictionaryOptionsGenerator) Handle(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
	args := request.GetArguments()

	dictType, ok := args["dictType"].(string)
	if !ok || dictType == "" {
		return nil, errors.New("dictType 参数是必需的")
	}
	fieldDesc, ok := args["fieldDesc"].(string)
	if !ok || fieldDesc == "" {
		return nil, errors.New("fieldDesc 参数是必需的")
	}
	optionsStr, ok := args["options"].(string)
	if !ok || optionsStr == "" {
		return nil, errors.New("options 参数是必需的")
	}

	var options []DictionaryOption
	if err := json.Unmarshal([]byte(optionsStr), &options); err != nil {
		return nil, fmt.Errorf("options 参数格式错误: %v", err)
	}
	if len(options) == 0 {
		return nil, errors.New("options 不能为空")
	}

	req := &DictionaryGenerateRequest{
		DictType:    dictType,
		FieldDesc:   fieldDesc,
		Options:     options,

View on GitHub (pinned to 3136500ef3)

Solutions

  1. Add a non-empty "fieldDesc" string describing the field (e.g. "用户状态").
  2. Ensure upstream code does not drop fieldDesc when assembling arguments.
  3. If using templates, verify the placeholder bound to fieldDesc resolves to text.

Example fix

// before
{"arguments": {"dictType": "sys_user_status", "options": "[{\"label\":\"启用\",\"value\":1}]"}}
// after
{"arguments": {"dictType": "sys_user_status", "fieldDesc": "用户状态", "options": "[{\"label\":\"启用\",\"value\":1}]"}}
Defensive patterns

Strategy: validation

Validate before calling

const fieldDesc = args["fieldDesc"]
if (typeof fieldDesc !== "string" || fieldDesc === "") {
  throw new Error("fieldDesc must be a non-empty string before calling dictionary_generator")
}

Type guard

function hasFieldDesc(args) {
  return typeof args.fieldDesc === "string" && args.fieldDesc.length > 0
}

Try / catch

try {
  await callTool("dictionary_generator", { dictType, fieldDesc, options })
} catch (e) {
  if (e.message.includes("fieldDesc 参数是必需的")) {
    // supply fieldDesc and retry
  }
}

Prevention

When it happens

Trigger: Invoking dictionary_generator with "dictType" and "options" present but no "fieldDesc" string, an empty string, or a non-string.

Common situations: Agents skipping the description field; blank descriptions submitted by forms; renamed keys in argument-building code.

Understand the failure class

Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.

Related errors


AI-assisted analysis of flipped-aurora/gin-vue-admin@3136500ef3 (2026-08-31). Data as JSON: /api/errors/8a2c8a450de1aaef. Report an issue: GitHub.