Skip to content

Commit fffd16a

Browse files
committed
fix: function install Deps
1 parent a4f9e92 commit fffd16a

1 file changed

Lines changed: 10 additions & 15 deletions

File tree

mcp/src/tools/functions.ts

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export function registerFunctionTools(server: McpServer) {
3939
subnetId: z.string()
4040
}).optional().describe("私有网络配置"),
4141
runtime: z.string().optional().describe("运行时环境"),
42-
installDependency: z.boolean().optional().describe("是否安装依赖"),
42+
installDependency: z.boolean().optional().describe("是否安装依赖,建议传 true"),
4343
triggers: z.array(z.object({
4444
name: z.string(),
4545
type: z.string(),
@@ -54,18 +54,14 @@ export function registerFunctionTools(server: McpServer) {
5454
})).optional().describe("Layer配置")
5555
}).describe("函数配置"),
5656
functionRootPath: z.string().optional().describe("函数根目录(云函数目录的父目录),这里需要传操作系统上文件的绝对路径,指定之后可以自动上传这部分的文件作为代码"),
57-
force: z.boolean().describe("是否覆盖"),
58-
base64Code: z.string().optional().describe("base64编码的代码,一般不采用这种方式"),
59-
codeSecret: z.string().optional().describe("代码保护密钥,一般无需配置")
57+
force: z.boolean().describe("是否覆盖")
6058
},
61-
async ({ func, functionRootPath, force, base64Code, codeSecret }) => {
59+
async ({ func, functionRootPath, force }) => {
6260
const cloudbase = await getCloudBaseManager()
6361
const result = await cloudbase.functions.createFunction({
6462
func,
6563
functionRootPath,
66-
force,
67-
base64Code,
68-
codeSecret
64+
force
6965
});
7066
return {
7167
content: [
@@ -86,17 +82,16 @@ export function registerFunctionTools(server: McpServer) {
8682
func: z.object({
8783
name: z.string().describe("函数名称")
8884
}).describe("函数配置"),
89-
functionRootPath: z.string().optional().describe("函数根目录(云函数目录的父目录),这里需要传操作系统上文件的绝对路径,指定之后可以自动上传这部分的文件作为代码"),
90-
base64Code: z.string().optional().describe("base64编码的代码,这种方式也可以更新代码,不推荐使用"),
91-
codeSecret: z.string().optional().describe("代码保护密钥,一般无需配置")
85+
functionRootPath: z.string().optional().describe("函数根目录(云函数目录的父目录),这里需要传操作系统上文件的绝对路径,指定之后可以自动上传这部分的文件作为代码")
9286
},
93-
async ({ func, functionRootPath, base64Code, codeSecret }) => {
87+
async ({ func, functionRootPath }) => {
9488
const cloudbase = await getCloudBaseManager()
9589
const result = await cloudbase.functions.updateFunctionCode({
96-
func,
90+
func: {
91+
...func,
92+
installDependency: true // 默认安装依赖
93+
},
9794
functionRootPath,
98-
base64Code,
99-
codeSecret
10095
});
10196
return {
10297
content: [

0 commit comments

Comments
 (0)