Skip to main content
Glama
aliyun

Alibaba Cloud FC MCP Server

Official
by aliyun

create-custom-domain-config

Configure custom domain routing for Alibaba Cloud Function Compute by setting up domain-to-function mappings with protocol, authentication, and TLS options.

Instructions

创建函数计算的域名路由配置,域名必须已经CNAME到函数计算的公网域名(格式为${uid}.${regionId}.fc.aliyuncs.com,例如14**49.cn-hangzhou.fc.aliyuncs.com)上,否则会创建失败。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
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
createCustomDomainConfigYes

Implementation Reference

  • src/index.ts:715-752 (registration)
    Registration of the 'create-custom-domain-config' tool, including the inline handler function that uses Alibaba Cloud FC SDK to create the custom domain configuration.
    server.tool(
        "create-custom-domain-config",
        "创建函数计算的域名路由配置,域名必须已经CNAME到函数计算的公网域名(格式为${uid}.${regionId}.fc.aliyuncs.com,例如14**49.cn-hangzhou.fc.aliyuncs.com)上,否则会创建失败。",
        {
            region: regionSchema,
            createCustomDomainConfig: createCustomDomainConfigSchema,
        },
        async (args) => {
            const { region, createCustomDomainConfig } = 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);
            const createCustomDomainRequest: CreateCustomDomainRequest = new CreateCustomDomainRequest({
                body: {
                    domainName: createCustomDomainConfig.domain,
                    protocol: createCustomDomainConfig.protocol,
                    routeConfig: createCustomDomainConfig.routeConfig,
                    authConfig: createCustomDomainConfig.authConfig,
                    certConfig: createCustomDomainConfig.certConfig,
                    tlsConfig: createCustomDomainConfig.tlsConfig,
                    wafConfig: createCustomDomainConfig.wafConfig,
                },
            });
            try {
                const result = await fcClient.createCustomDomain(createCustomDomainRequest);
                return { content: [{ type: "text", text: `创建域名路由配置成功。result: ${JSON.stringify(result)}` }] };
            } catch (error) {
                return { isError: true, content: [{ type: "text", text: `创建域名路由配置失败:${JSON.stringify(error as any)}` }] };
            }
        }
    )
  • The handler function that extracts arguments, creates FC client, prepares CreateCustomDomainRequest, and calls fcClient.createCustomDomain to implement the tool logic.
        async (args) => {
            const { region, createCustomDomainConfig } = 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);
            const createCustomDomainRequest: CreateCustomDomainRequest = new CreateCustomDomainRequest({
                body: {
                    domainName: createCustomDomainConfig.domain,
                    protocol: createCustomDomainConfig.protocol,
                    routeConfig: createCustomDomainConfig.routeConfig,
                    authConfig: createCustomDomainConfig.authConfig,
                    certConfig: createCustomDomainConfig.certConfig,
                    tlsConfig: createCustomDomainConfig.tlsConfig,
                    wafConfig: createCustomDomainConfig.wafConfig,
                },
            });
            try {
                const result = await fcClient.createCustomDomain(createCustomDomainRequest);
                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 input parameter 'createCustomDomainConfig', which defines the structure for creating custom domain config including domain, protocol, routes, auth, cert, tls, and waf.
    export const createCustomDomainConfigSchema = z.object({
        domain: domainSchema,
        protocol: protocolSchema.optional(),
        routeConfig: routeConfigSchema,
        authConfig: authConfigSchema,
        certConfig: certConfigSchema.optional(),
        tlsConfig: tlsConfigSchema.optional(),
        wafConfig: wafConfigSchema.optional(),
    });
  • Import of helper functions createFcClient and getAccountId used in the handler to create the FC client and get account ID.
    import { createFcClient, getAccountId } from "./utils/alibaba_cloud_sdk.js";
  • Supporting schema for routeConfig, which is part of createCustomDomainConfigSchema.
    export const routeConfigSchema = z.object({
        routes: z.array(pathConfigSchema).describe("路由配置"),
    });
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 mentions the CNAME prerequisite and failure condition, which is useful. However, it doesn't describe what happens on success (e.g., what gets created, response format), whether this is idempotent, what permissions are required, rate limits, or other operational characteristics. For a creation tool with complex nested parameters, this leaves significant behavioral gaps.

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

Conciseness4/5

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

The description is concise - just two sentences in Chinese. The first sentence states the purpose, and the second provides the critical prerequisite. There's no wasted text or redundancy. However, given the tool's complexity, this brevity comes at the cost of completeness.

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?

Given the tool's complexity (creation operation with 2 parameters, complex nested objects, no annotations, no output schema), the description is inadequate. It covers the basic purpose and one prerequisite but misses: parameter explanations, success behavior, error conditions beyond the CNAME check, relationship to sibling tools, and what the created configuration enables. For a tool that creates domain routing configurations with multiple sub-configurations, this leaves too much unexplained.

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 50%, so the description needs to compensate but doesn't. It mentions nothing about the parameters themselves - not even the existence of 'region' or 'createCustomDomainConfig' object. The description focuses only on a prerequisite (CNAME configuration) rather than explaining what parameters mean or how they interact. With 2 parameters and complex nested objects, this leaves significant gaps in understanding parameter purpose and usage.

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 tool's purpose: '创建函数计算的域名路由配置' (create domain routing configuration for function compute). It specifies the verb ('创建' - create) and resource ('域名路由配置' - domain routing configuration), making the intent unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'update-custom-domain-config' or 'get-custom-domain-config'.

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

Usage Guidelines3/5

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

The description provides some usage context by stating a prerequisite: '域名必须已经CNAME到函数计算的公网域名...否则会创建失败' (the domain must already be CNAME'd to the function compute public domain, otherwise creation will fail). This is helpful guidance about when the tool will work. However, it doesn't specify when to use this tool versus alternatives like 'update-custom-domain-config' or provide explicit exclusions.

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