delete-function-version
Remove specific versions of serverless functions in Alibaba Cloud Function Compute to manage deployments and control function lifecycle.
Instructions
删除函数计算的函数版本
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| functionName | Yes | 函数名称,函数名称在每个region必须是唯一的。 | |
| region | No | 部署的区域,当前可选的区域是cn-hangzhou, cn-shanghai, cn-beijing, cn-shenzhen, cn-hongkong, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-5, ap-northeast-1, eu-central-1, eu-west-1, us-west-1, us-east-1, ap-south-1, me-east-1, cn-chengdu, cn-wulanchabu, cn-guangzhou,默认是cn-hangzhou | cn-hangzhou |
| versionId | Yes | 函数版本ID |
Implementation Reference
- src/index.ts:869-887 (handler)Handler function that validates inputs, creates FC client, and calls deleteFunctionVersion API.const { functionName, region, versionId } = args; const accessKeyId = process.env.ALIBABA_CLOUD_ACCESS_KEY_ID; const accessKeySecret = process.env.ALIBABA_CLOUD_ACCESS_KEY_SECRET; if (!accessKeyId || !accessKeySecret) { return { isError: true, content: [{ type: "text", text: `执行失败,请设置ALIBABA_CLOUD_ACCESS_KEY_ID, ALIBABA_CLOUD_ACCESS_KEY_SECRET, ALIBABA_CLOUD_SECURITY_TOKEN环境变量` }] }; } const accountId = await getAccountId(); if (!accountId) { return { isError: true, content: [{ type: "text", text: `执行失败,获取accountId异常` }] }; } const fcClient = createFcClient(region); try { const result = await fcClient.deleteFunctionVersion(functionName, versionId); return { content: [{ type: "text", text: `删除函数版本成功。result: ${JSON.stringify(result)}` }] }; } catch (error) { return { isError: true, content: [{ type: "text", text: `删除函数版本失败:${JSON.stringify(error as any)}` }] }; } } )
- src/index.ts:860-889 (registration)Registration of the delete-function-version tool using server.tool, including schema and inline handler.server.tool( "delete-function-version", "删除函数计算的函数版本", { functionName: functionNameSchema, region: regionSchema, versionId: versionIdSchema, }, async (args) => { const { functionName, region, versionId } = args; const accessKeyId = process.env.ALIBABA_CLOUD_ACCESS_KEY_ID; const accessKeySecret = process.env.ALIBABA_CLOUD_ACCESS_KEY_SECRET; if (!accessKeyId || !accessKeySecret) { return { isError: true, content: [{ type: "text", text: `执行失败,请设置ALIBABA_CLOUD_ACCESS_KEY_ID, ALIBABA_CLOUD_ACCESS_KEY_SECRET, ALIBABA_CLOUD_SECURITY_TOKEN环境变量` }] }; } const accountId = await getAccountId(); if (!accountId) { return { isError: true, content: [{ type: "text", text: `执行失败,获取accountId异常` }] }; } const fcClient = createFcClient(region); try { const result = await fcClient.deleteFunctionVersion(functionName, versionId); return { content: [{ type: "text", text: `删除函数版本成功。result: ${JSON.stringify(result)}` }] }; } catch (error) { return { isError: true, content: [{ type: "text", text: `删除函数版本失败:${JSON.stringify(error as any)}` }] }; } } ) // 部署函数自定义运行时runtime的提示词
- src/index.ts:864-867 (schema)Input schema definition for the tool using imported Zod schemas.functionName: functionNameSchema, region: regionSchema, versionId: versionIdSchema, },
- src/schema.ts:182-182 (schema)Zod schema for versionId parameter used in the tool.export const versionIdSchema = z.string().describe("函数版本ID");