From 1a1dba7b3133f99f17be91641f7707a349f99b1f Mon Sep 17 00:00:00 2001 From: CodeBuddy Attribution Bot Date: Tue, 28 Apr 2026 23:51:38 +0800 Subject: [PATCH] =?UTF-8?q?fix(attribution):=20MCP=20createCloudFunction?= =?UTF-8?q?=20=E5=B7=A5=E5=85=B7=E5=8F=82=E6=95=B0=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E4=B8=8D=E6=B8=85=E6=99=B0=E5=AF=BC=E8=87=B4=20HTTP=20?= =?UTF-8?q?=E4=BA=91=E5=87=BD=E6=95=B0=E5=88=9B=E5=BB=BA=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=20(issue=5Fmo8ywjss=5Fsiyh6g)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mcp/src/tools/functions.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/mcp/src/tools/functions.ts b/mcp/src/tools/functions.ts index 08db62ce..73a3129a 100644 --- a/mcp/src/tools/functions.ts +++ b/mcp/src/tools/functions.ts @@ -1449,14 +1449,23 @@ export function registerFunctionTools(server: ExtendedMcpServer) { action: z .enum(MANAGE_FUNCTION_ACTIONS) .describe("写操作类型,例如 createFunction、invokeFunction、attachLayer"), - func: CREATE_FUNCTION_SCHEMA.optional().describe("createFunction 操作的函数配置"), + func: CREATE_FUNCTION_SCHEMA.optional().describe( + "createFunction 操作的函数配置。" + + "\n\n创建 HTTP 函数时,至少需要指定:" + + "\n- name: 函数名称" + + "\n- type: \"HTTP\"" + + "\n- protocolType: \"HTTP\" (或 \"WS\" 用于 WebSocket)" + + "\n- runtime: 运行时环境(如 \"Nodejs18.15\")" + + "\n\n⚠️ 注意:HTTP 函数创建时必须同时提供 functionRootPath 或 zipFile 参数来定位函数代码。", + ), functionRootPath: z.string().optional().describe( "创建或更新函数代码时默认推荐的本地目录方式。" + "必须是直接包含函数文件夹的目录绝对路径(如 /abs/path/cloudfunctions 或 /abs/path/functions)," + "不要传项目根目录(如 /abs/path),也不要传到函数名子目录(如 /abs/path/cloudfunctions/hello)。" + "本地应按 cloudfunctions//index.js 或 functions//index.js 布局," + "此参数传 cloudfunctions 或 functions 目录的绝对路径。" + - "SDK 会自动拼接函数名子目录,无需预先压缩 zip 或 base64 编码。", + "SDK 会自动拼接函数名子目录,无需预先压缩 zip 或 base64 编码。" + + "\n\n⚠️ 创建 HTTP 函数时,此参数或 zipFile 是必需的(HTTP 函数需要通过此参数定位函数代码目录)。", ), force: z.boolean().optional().describe("createFunction 时是否覆盖"), functionName: z.string().optional().describe("函数名称。大多数 action 使用该字段作为统一目标"),