Skip to main content
Glama
aliyun

Alibaba Cloud FC MCP Server

Official
by aliyun

publish-function-version

Publish the latest function code as a new version in Alibaba Cloud Function Compute to enable version control and deployment management.

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
descriptionYes函数版本的描述,可以描述一下发布的函数版本的功能。

Implementation Reference

  • The handler function that implements the core logic for publishing a new version of the function using the Alibaba Cloud Function Compute SDK. It validates credentials, fetches account ID, creates FC client, and invokes publishFunctionVersion.
            const { functionName, region, description } = 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 request = new PublishFunctionVersionRequest({
                    description,
                })
                const result = await fcClient.publishFunctionVersion(functionName, request);
                return { content: [{ type: "text", text: `发布函数版本成功。result: ${JSON.stringify(result)}` }] };
            } catch (error) {
                return { isError: true, content: [{ type: "text", text: `发布函数版本失败:${JSON.stringify(error as any)}` }] };
            }
        }
    )
  • Zod schema definition for the 'region' parameter used in the tool.
    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");
  • Zod schema definition for the 'functionName' parameter used in the tool.
    export const functionNameSchema = z.string().describe("函数名称,函数名称在每个region必须是唯一的。")
        .regex(/^[a-zA-Z0-9_][a-zA-Z0-9_-]{0,63}$/);
  • Zod schema definition for the 'description' parameter used in the tool.
    export const functionVersionDescriptionSchema = z.string().describe("函数版本的描述,可以描述一下发布的函数版本的功能。");
  • src/index.ts:785-814 (registration)
    MCP server tool registration for 'publish-function-version', specifying name, description, input schema, and inline handler function.
        "publish-function-version",
        "将函数的最新代码发布为新版本",
        {
            functionName: functionNameSchema,
            region: regionSchema,
            description: functionVersionDescriptionSchema,
        },
        async (args) => {
            const { functionName, region, description } = 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 request = new PublishFunctionVersionRequest({
                    description,
                })
                const result = await fcClient.publishFunctionVersion(functionName, request);
                return { content: [{ type: "text", text: `发布函数版本成功。result: ${JSON.stringify(result)}` }] };
            } catch (error) {
                return { isError: true, content: [{ type: "text", text: `发布函数版本失败:${JSON.stringify(error as any)}` }] };
            }
        }
    )
  • Helper function to create the Alibaba Cloud Function Compute (FC) client instance used in the handler.
    export function createFcClient(regionId: string) {
      const config = new $OpenApi.Config({
        credential: getCredentialClient(),
        endpoint: `fcv3.${regionId}.aliyuncs.com`,
      });
      return new FCClient(config);
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool publishes a new version but doesn't explain what 'publish' entails (e.g., whether it deploys to production, requires specific permissions, affects existing versions, or has rate limits). This is a significant gap for a mutation tool with zero annotation coverage.

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 that directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, with every part contributing to clarity.

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 mutation tool with no annotations and no output schema, the description is incomplete. It lacks behavioral details (e.g., what 'publish' means operationally, error conditions, or response format) and usage context, leaving significant gaps for an AI agent to understand how to invoke it correctly.

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%, so the schema already documents all three parameters thoroughly. The description doesn't add any meaning beyond what the schema provides about 'functionName', 'region', or 'description'. 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 clearly states the action ('发布' meaning 'publish') and resource ('函数的最新代码' meaning 'function's latest code') to create a new version. It's specific about what the tool does but doesn't differentiate from siblings like 'update-custom-runtime-function' or 'put-custom-runtime-function' which might have overlapping purposes.

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., existing function code), exclusions, or comparisons to sibling tools like 'update-custom-runtime-function' or 'delete-function-version' that might be relevant in a versioning workflow.

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