flipped-aurora/gin-vue-admin · error

description 参数是必需的

Error message

description 参数是必需的

What it means

Thrown by ApiCreator's Handle when the "description" argument is missing, empty, or not a string in single-API mode. The description documents the API being created and is mandatory for the generated ApiCreateRequest.

Source

Thrown at server/mcp/api_creator.go:79

	)
}

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

	var apis []ApiCreateRequest
	if apisStr, ok := args["apis"].(string); ok && apisStr != "" {
		if err := json.Unmarshal([]byte(apisStr), &apis); err != nil {
			return nil, fmt.Errorf("apis 参数格式错误: %w", err)
		}
	} else {
		path, ok := args["path"].(string)
		if !ok || path == "" {
			return nil, errors.New("path 参数是必需的")
		}
		description, ok := args["description"].(string)
		if !ok || description == "" {
			return nil, errors.New("description 参数是必需的")
		}
		apiGroup, ok := args["apiGroup"].(string)
		if !ok || apiGroup == "" {
			return nil, errors.New("apiGroup 参数是必需的")
		}

		method := "POST"
		if value, ok := args["method"].(string); ok && value != "" {
			method = value
		}

		apis = append(apis, ApiCreateRequest{
			Path:        path,
			Description: description,
			ApiGroup:    apiGroup,
			Method:      method,
		})
	}

View on GitHub (pinned to 3136500ef3)

Solutions

  1. Add a non-empty "description" string argument describing the API's purpose.
  2. Use the bulk "apis" JSON argument (each entry still needs a description field).
  3. Check upstream code that builds the arguments map for a dropped/renamed description key.

Example fix

// before
{"arguments": {"path": "/user/list", "apiGroup": "user"}}
// after
{"arguments": {"path": "/user/list", "description": "获取用户列表", "apiGroup": "user"}}
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

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

Try / catch

try {
  await callTool("api_creator", { path, description, apiGroup })
} catch (e) {
  if (e.message.includes("description 参数是必需的")) {
    // supply description and retry
  }
}

Prevention

When it happens

Trigger: Invoking the api_creator tool with "path" and "apiGroup" set but no "description" string, or description = "" or a non-string value.

Common situations: Agents generating tool calls that skip the description field; frontend forms submitting blank descriptions; clients assuming description is optional.

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/732d43f99fc8108d. Report an issue: GitHub.