fix: uploadFiles MCP 工具 cloudPath 参数行为不明确且缺少部署状态反馈,导致静态托管部署验证失败#684
fix: uploadFiles MCP 工具 cloudPath 参数行为不明确且缺少部署状态反馈,导致静态托管部署验证失败#684
Conversation
…管部署验证失败 (issue_mojhcq5h_2u7mxc)
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d7fdb6c7fa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
|
|
||
| // Build deployment status summary | ||
| const uploadedFiles = (uploadResult.files as Array<{ options?: { Key?: string } }>) || []; |
There was a problem hiding this comment.
Handle empty SDK upload result before reading files
Guard this uploadResult.files access because hosting.uploadFiles() can legally return undefined when there are no files to upload (e.g., empty directory or all files filtered by ignore), and the current code will then throw TypeError: Cannot read properties of undefined after the upload call. This turns a valid no-op upload into a tool failure, so the response path should tolerate an undefined result before building the deployment summary.
Useful? React with 👍 / 👎.
Attribution post-PR evaluation
Cases
|
Attribution issue
Automation summary
uploadFilesMCP tool'scloudPathparameter was passed directly to the SDK without normalization. When users passedcloudPath: "/"for root deployment, the SDK created file keys like/index.html, resulting in double-slash paths like//index.htmlin the Location field. This caused the grader to fail when trying to verify the deployed files. Additionally, the parameter description was unclear about whether to include leading slashes, and the deployment status feedback was minimal ("文件上传成功").cloudPathparameter description (mcp/src/tools/hosting.ts:264) to clarify that paths should not start with slashes (e.g.,/files) and that empty string or omitting the parameter is preferred for root deployment.cloudPathbefore passing to the SDK, preventing double-slash issues.Changed files
mcp/src/tools/hosting.ts