{"record":{"id":"4b1435efab62eea7","repo":"flipped-aurora/gin-vue-admin","slug":"executionplan","errorCode":null,"errorMessage":"参数错误：executionPlan 必须提供","messagePattern":"参数错误：executionPlan 必须提供","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/mcp/gva_execute.go","lineNumber":218,"sourceCode":"\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}),\n\t\t\tmcp.AdditionalProperties(false),\n\t\t),\n\t\tmcp.WithString(\"requirement\",\n\t\t\tmcp.Description(\"原始需求描述（可选，用于日志记录）\"),\n\t\t),\n\t)\n}\n\n// Handle 处理执行请求（移除确认步骤）\nfunc (g *GVAExecutor) Handle(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {\n\texecutionPlanData, ok := request.GetArguments()[\"executionPlan\"]\n\tif !ok {\n\t\treturn nil, errors.New(\"参数错误：executionPlan 必须提供\")\n\t}\n\n\t// 解析执行计划\n\tplanJSON, err := json.Marshal(executionPlanData)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"解析执行计划失败: %v\", err)\n\t}\n\n\tvar plan ExecutionPlan\n\terr = json.Unmarshal(planJSON, &plan)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"解析执行计划失败: %v\\n\\n请确保ExecutionPlan格式正确，参考工具描述中的结构体格式要求\", err)\n\t}\n\n\t// 验证执行计划的完整性\n\tif err := g.validateExecutionPlan(ctx, &plan); err != nil {\n\t\treturn nil, fmt.Errorf(\"执行计划验证失败: %v\", err)\n\t}","sourceCodeStart":200,"sourceCodeEnd":236,"githubUrl":"https://github.com/flipped-aurora/gin-vue-admin/blob/3136500ef380842b0eb6c4daa87c3f8a47fcf9e0/server/mcp/gva_execute.go#L200-L236","documentation":"GVAExecutor.Handle is the MCP tool handler for executing a code-generation plan. It reads the `executionPlan` argument from the incoming CallToolRequest via request.GetArguments(); if the argument map has no such key, it returns immediately with this error. The library requires every tool invocation to carry the full plan JSON, so a missing argument aborts before any parsing or validation happens.","triggerScenarios":"Calling the MCP tool without including the `executionPlan` key in the tool arguments — e.g. an empty argument object, a client-side typo like `execution_plan`, or the plan variable being undefined so it was dropped from the serialized arguments.","commonSituations":"MCP client misconfiguration where tool input schema is not enforced; an LLM agent invoking the tool with only partial arguments; hand-written test invocations omitting the argument; client library versions that strip undefined/null argument values during JSON serialization.","solutions":["Add `executionPlan` to the tool call arguments with the complete plan object.","Check the argument key spelling: it must be exactly `executionPlan` (camelCase), not `execution_plan` or `plan`.","Verify the MCP client serializes the full argument map (log request.GetArguments() to confirm what the server receives).","Ensure the plan object is not undefined/null at the call site before invoking the tool."],"exampleFix":"// before\ncallTool(\"gva_execute\", {})\n\n// after\ncallTool(\"gva_execute\", {\n  executionPlan: {\n    packageName: \"my-plugin\",\n    packageType: \"plugin\",\n    needCreatedPackage: true,\n    packageInfo: { /* ... */ }\n  }\n})","handlingStrategy":"validation","validationCode":"function validateToolArgs(args) {\n  if (args == null || !('executionPlan' in args) || args.executionPlan == null) {\n    throw new Error('gva_execute requires an executionPlan argument');\n  }\n  return true;\n}\n// call: validateToolArgs(toolArgs); await callTool('gva_execute', toolArgs);","typeGuard":"function hasExecutionPlan(args) {\n  return args != null && typeof args === 'object' && 'executionPlan' in args && args.executionPlan != null && typeof args.executionPlan === 'object';\n}","tryCatchPattern":"try {\n  const result = await callTool('gva_execute', { executionPlan: plan });\n} catch (err) {\n  if (String(err.message).includes('executionPlan 必须提供')) {\n    // retry with the plan attached\n    return callTool('gva_execute', { executionPlan: buildPlan() });\n  }\n  throw err;\n}","preventionTips":["Always build the argument object from a single buildPlan() factory so executionPlan is never forgotten","Enforce the tool input schema on the MCP client so missing arguments are rejected before the wire call","Keep the key exactly `executionPlan` (camelCase) in a shared constant"],"tags":["mcp","missing-argument","go","validation"],"backgroundTag":"missing-required-tool-argument","analyzedSha":"3136500ef380842b0eb6c4daa87c3f8a47fcf9e0","analyzedAt":"2026-08-31T13:50:02.721Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}