flipped-aurora/gin-vue-admin · error
path 参数是必需的
Error message
path 参数是必需的
What it means
This error is thrown by the ApiCreator MCP tool's Handle method when the tool is invoked in single-API mode and the "path" argument is missing, empty, or not a string. The tool requires path/description/apiGroup to build an ApiCreateRequest. It fails fast before any API record is created.
Source
Thrown at server/mcp/api_creator.go:75
),
mcp.WithString("apis",
mcp.Description("批量创建API的JSON字符串,格式:[{\"path\":\"/user/create\",\"description\":\"创建用户\",\"apiGroup\":\"用户管理\",\"method\":\"POST\"}]"),
),
)
}
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,View on GitHub (pinned to 3136500ef3)
Solutions
- Pass a non-empty string "path" argument (e.g. "/user/list") in the tool call arguments.
- If creating multiple APIs, pass them all as JSON via the "apis" argument instead of individual fields.
- Verify the argument value is a JSON string, not a number or null.
Example fix
// before
{"name": "api_creator", "arguments": {"description": "list users", "apiGroup": "user"}}
// after
{"name": "api_creator", "arguments": {"path": "/user/list", "description": "list users", "apiGroup": "user"}} Defensive patterns
Strategy: validation
Validate before calling
const path = args["path"]
if (typeof path !== "string" || path === "") {
throw new Error("path must be a non-empty string before calling api_creator")
} Type guard
function hasPath(args) {
return typeof args.path === "string" && args.path.length > 0
} Try / catch
try {
await callTool("api_creator", { path, description, apiGroup })
} catch (e) {
if (e.message.includes("path 参数是必需的")) {
// fix arguments and retry with a valid path
}
} Prevention
- Always build tool arguments from a schema or typed object with required fields.
- Validate path is a non-empty string before every api_creator call.
- Prefer the bulk "apis" argument for multiple records so field requirements are explicit.
When it happens
Trigger: Calling the api_creator tool without a "path" argument, with args["path"] set to a non-string (e.g. number, null), or with an empty string, while not using the bulk "apis" JSON mode.
Common situations: LLM agents omitting required fields in tool calls; callers accidentally using the bulk "apis" argument style while individual fields are expected; empty path produced by upstream templating.
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
- description 参数是必需的
- apiGroup 参数是必需的
- 参数错误:executionPlan 必须提供
- 参数错误:userRequirement 必须提供
- 参数错误:generatedFiles 必须提供
AI-assisted analysis of flipped-aurora/gin-vue-admin@3136500ef3 (2026-08-31).
Data as JSON: /api/errors/e82f3a0291759ecb.
Report an issue: GitHub.