Skip to main content
Glama
aliyun

Alibaba Cloud FC MCP Server

Official
by aliyun

delete-function

Remove serverless functions from Alibaba Cloud Function Compute to manage resources and maintain clean deployments.

Instructions

删除函数计算的函数

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
functionNameYes函数名称,函数名称在每个region必须是唯一的。
regionNo部署的区域,当前可选的区域是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-hangzhoucn-hangzhou

Implementation Reference

  • The handler function that implements the logic to delete the specified Alibaba Cloud Function Compute function and its associated custom domain configuration.
    async (args) => {
        const { functionName, region } = 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 {
            await fcClient.deleteFunction(functionName);
        } catch (error) {
            return { isError: true, content: [{ type: "text", text: `删除函数失败:${JSON.stringify(error as any)}` }] };
        }
        const autoCustomDomainName = getAutoCustomDomainName(accountId, functionName, region);
        try {
            await fcClient.deleteCustomDomain(autoCustomDomainName);
        } catch (error) {
            return { isError: true, content: [{ type: "text", text: `删除函数域名路由配置失败:${JSON.stringify(error as any)}` }] };
        }
        return { content: [{ type: "text", text: `删除函数成功` }] };
    }
  • src/index.ts:610-642 (registration)
    The server.tool registration for the 'delete-function' MCP tool, including name, description, input schema, and handler.
    server.tool(
        "delete-function",
        "删除函数计算的函数",
        {
            functionName: functionNameSchema,
            region: regionSchema,
        },
        async (args) => {
            const { functionName, region } = 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 {
                await fcClient.deleteFunction(functionName);
            } catch (error) {
                return { isError: true, content: [{ type: "text", text: `删除函数失败:${JSON.stringify(error as any)}` }] };
            }
            const autoCustomDomainName = getAutoCustomDomainName(accountId, functionName, region);
            try {
                await fcClient.deleteCustomDomain(autoCustomDomainName);
            } catch (error) {
                return { isError: true, content: [{ type: "text", text: `删除函数域名路由配置失败:${JSON.stringify(error as any)}` }] };
            }
            return { content: [{ type: "text", text: `删除函数成功` }] };
        }
    )
  • Zod schema validation for the 'functionName' input parameter used in delete-function.
    // function name schema
    export const functionNameSchema = z.string().describe("函数名称,函数名称在每个region必须是唯一的。")
        .regex(/^[a-zA-Z0-9_][a-zA-Z0-9_-]{0,63}$/);
  • Zod schema validation for the 'region' input parameter used in delete-function.
    export const regionSchema = z.enum(['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'])
        .default('cn-hangzhou')
        .describe("部署的区域,当前可选的区域是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");
  • Helper function to generate the auto-generated custom domain name for deletion.
    function getAutoCustomDomainName(uid: string, functionName: string, regionID: string) {
        const normalizedFunctionName = functionName.replace(/_/g, '-').toLowerCase();
        return `${normalizedFunctionName}.fcv3.${uid}.${regionID}.fc.devsapp.net`;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It states the destructive action ('delete') but lacks critical behavioral details: whether deletion is permanent, if it requires specific permissions, what happens to associated resources (e.g., versions, triggers), error conditions, or response format. For a destructive tool with zero annotation coverage, this is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence in Chinese with zero waste. It's front-loaded with the core action and resource, making it immediately understandable. No extraneous information or redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a destructive tool with no annotations and no output schema, the description is incomplete. It lacks behavioral context (permanence, side effects), usage guidelines, and output expectations. Given the complexity of deletion operations and the absence of structured safety hints, the description should provide more guidance to ensure safe and correct use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with both parameters ('functionName', 'region') well-documented in the schema. The description adds no parameter semantics beyond what's in the schema (e.g., doesn't explain relationships between parameters or usage nuances). Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description '删除函数计算的函数' (delete function compute function) clearly states the action (delete) and target resource (function compute function). It's specific about what gets deleted, though it doesn't explicitly distinguish from sibling tools like 'delete-function-version' or 'delete-custom-domain-config' beyond the resource type.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., function must exist), when not to use it (e.g., if versions exist), or refer to related tools like 'delete-function-version' or 'list-functions' for verification. The agent must infer usage from the name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aliyun/alibabacloud-fc-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server