flipped-aurora/gin-vue-admin · error

参数错误:userRequirement 必须提供

Error message

参数错误:userRequirement 必须提供

What it means

The GVAReviewer MCP tool's Handle method requires a 'userRequirement' argument describing the user's requirement for the code review. If request.GetArguments() has no 'userRequirement' key, it returns this error immediately before any review work begins. It is a hard input contract of the tool: the review prompt cannot be generated without the requirement text.

Source

Thrown at server/mcp/gva_review.go:65

**重要提示:**
- 本工具只产出引导 prompt,不执行任何代码修改,也不替代 AI 的实际分析`),
		mcp.WithString("userRequirement",
			mcp.Description("经过requirement_analyze处理后的用户需求描述,包含详细的功能要求和字段信息"),
			mcp.Required(),
		),
		mcp.WithString("generatedFiles",
			mcp.Description("gva_execute创建的文件列表,JSON字符串格式,包含所有生成的后端和前端文件路径"),
			mcp.Required(),
		),
	)
}

// Handle 处理审查请求
func (g *GVAReviewer) Handle(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
	// 获取用户需求
	userRequirementData, ok := request.GetArguments()["userRequirement"]
	if !ok {
		return nil, errors.New("参数错误:userRequirement 必须提供")
	}

	userRequirement, ok := userRequirementData.(string)
	if !ok {
		return nil, errors.New("参数错误:userRequirement 必须是字符串类型")
	}

	// 获取生成的文件列表
	generatedFilesData, ok := request.GetArguments()["generatedFiles"]
	if !ok {
		return nil, errors.New("参数错误:generatedFiles 必须提供")
	}

	generatedFilesStr, ok := generatedFilesData.(string)
	if !ok {
		return nil, errors.New("参数错误:generatedFiles 必须是JSON字符串")
	}

View on GitHub (pinned to 3136500ef3)

Solutions

  1. Add 'userRequirement' (a non-empty string) to the tool call arguments.
  2. Check the MCP tool schema advertised by the server and make the client send all required arguments.
  3. If calling programmatically, populate request params via the standard MCP arguments structure rather than a raw map.
  4. Verify argument key spelling matches exactly: 'userRequirement' (camelCase).

Example fix

// before
args := map[string]any{"generatedFiles": "[]"}
// after
args := map[string]any{
  "userRequirement": "实现用户管理模块",
  "generatedFiles": "[\"server/api/user.go\"]",
}
Defensive patterns

Strategy: validation

Validate before calling

args := request.GetArguments()
v, ok := args["userRequirement"]
if !ok || v == nil || v == "" {
    return nil, errors.New("userRequirement must be a non-empty string before calling gva_review")
}

Type guard

func asString(v any) (string, bool) {
    s, ok := v.(string)
    return s, ok && s != ""
}

Prevention

When it happens

Trigger: Calling the gva_review MCP tool via mcp.CallToolRequest without including 'userRequirement' in the tool arguments map.

Common situations: An MCP client sends an empty or partially-populated arguments object; the caller omits the argument because it assumed defaults; a tool-schema mismatch where the client and server disagree on required parameters.

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/37480bae47a39de2. Report an issue: GitHub.