From 2e7fa326535bf57111c6fc150645311fcb7eb6e3 Mon Sep 17 00:00:00 2001 From: CodeBuddy Attribution Bot Date: Tue, 28 Apr 2026 23:06:53 +0800 Subject: [PATCH] =?UTF-8?q?fix(attribution):=20MCP=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E6=8F=90=E7=A4=BA=E4=B8=8D=E6=B8=85=E6=99=B0?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E4=BA=91=E5=87=BD=E6=95=B0=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=20(issue=5Fmo8z05x3=5Faa5gtw)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mcp/src/tools/functions.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/mcp/src/tools/functions.ts b/mcp/src/tools/functions.ts index 08db62ce..c9c67b12 100644 --- a/mcp/src/tools/functions.ts +++ b/mcp/src/tools/functions.ts @@ -401,6 +401,30 @@ export function buildFunctionOperationErrorMessage( ); } + // Handle 400 invalid parameter value errors from CloudBase API + if (/400.*invalid.*parameter|invalid.*parameter.*value/i.test(baseMessage)) { + suggestions.push( + "云 API 返回参数错误,请检查以下常见问题:", + ); + suggestions.push( + "1. 函数名只能包含字母、数字、下划线和连字符,且不能以数字开头,长度不超过60个字符", + ); + suggestions.push( + "2. Runtime 必须为支持的版本(如 Nodejs20.19、Nodejs18.15、Python3.9 等)", + ); + suggestions.push( + "3. Handler 格式必须正确(对于 Node.js,格式为 文件名.导出函数名,如 index.main)", + ); + suggestions.push( + "4. Timeout 值必须在 1-300 秒之间", + ); + if (operation === "createFunction") { + suggestions.push( + `当前传入的参数:函数名=${functionName},请核对以上格式要求后重试。`, + ); + } + } + if (suggestions.length === 0) { suggestions.push("请检查函数名、目录结构和环境中的函数状态后重试。"); }