Skip to main content
Glama
ahmedselimmansor-ctrl

Alibaba Cloud MCP Server

aliyun_invoke_api

Invoke any Alibaba Cloud OpenAPI endpoint dynamically to manage all cloud resources and services.

Instructions

Invoke ANY Alibaba Cloud OpenAPI endpoint dynamically. This tool allows you to manage ALL of Alibaba Cloud. Use the OpenAPI documentation to find the correct endpoint, apiVersion, and action. Note: RPC requests are most common.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
endpointYesThe API endpoint (e.g., 'https://ecs.aliyuncs.com' or 'https://vpc.aliyuncs.com')
apiVersionYesThe API version (e.g., '2014-05-26')
actionYesThe action name (e.g., 'DescribeInstances', 'CreateVpc')
parametersNoThe parameters for the action, as a JSON object.
methodNoHTTP Method (POST/GET). Defaults to POST.

Implementation Reference

  • The handler function `handleUniversalTool` that executes the tool logic. It validates input with zod, creates an Alibaba Cloud API client, and makes the request to the specified endpoint/action.
    export async function handleUniversalTool(args: any) {
      const schema = z.object({
        endpoint: z.string(),
        apiVersion: z.string(),
        action: z.string(),
        parameters: z.record(z.string(), z.any()).default({}),
        method: z.enum(["GET", "POST"]).default("POST"),
      });
    
      const parsed = schema.parse(args);
    
      // @ts-ignore
      const client = new Core.default({
        accessKeyId: config.ALIBABA_CLOUD_ACCESS_KEY_ID,
        accessKeySecret: config.ALIBABA_CLOUD_ACCESS_KEY_SECRET,
        endpoint: parsed.endpoint,
        apiVersion: parsed.apiVersion,
      });
    
      const requestOption = {
        method: parsed.method
      };
    
      try {
        const result = await client.request(parsed.action, parsed.parameters, requestOption);
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(result, null, 2),
            },
          ],
        };
      } catch (error: any) {
        throw new Error(`Alibaba Cloud API Error: ${error.message}\nDetails: ${JSON.stringify(error.data || {})}`);
      }
    }
  • The registration function `registerUniversalTool` which includes the input schema definition for the tool: endpoint, apiVersion, action, parameters (optional), method (optional).
    export function registerUniversalTool() {
      return [
        {
          name: "aliyun_invoke_api",
          description: "Invoke ANY Alibaba Cloud OpenAPI endpoint dynamically. This tool allows you to manage ALL of Alibaba Cloud. Use the OpenAPI documentation to find the correct endpoint, apiVersion, and action. Note: RPC requests are most common.",
          inputSchema: {
            type: "object",
            properties: {
              endpoint: {
                type: "string",
                description: "The API endpoint (e.g., 'https://ecs.aliyuncs.com' or 'https://vpc.aliyuncs.com')"
              },
              apiVersion: {
                type: "string",
                description: "The API version (e.g., '2014-05-26')"
              },
              action: {
                type: "string",
                description: "The action name (e.g., 'DescribeInstances', 'CreateVpc')"
              },
              parameters: {
                type: "object",
                description: "The parameters for the action, as a JSON object."
              },
              method: {
                type: "string",
                description: "HTTP Method (POST/GET). Defaults to POST.",
                enum: ["GET", "POST"]
              }
            },
            required: ["endpoint", "apiVersion", "action"]
          }
        }
      ];
    }
  • src/index.ts:31-43 (registration)
    The tool registration in the ListToolsRequestSchema handler. `registerUniversalTool()` is called to return the tool definition including the 'aliyun_invoke_api' tool.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [
          ...registerUniversalTool(),
          ...registerEcsTools(),
          ...registerVpcTools(),
          ...registerRdsTools(),
          ...registerRamTools(),
          ...registerAckTools(),
          ...registerSlbTools()
        ],
      };
    });
  • src/index.ts:46-53 (registration)
    The tool dispatch in the CallToolRequestSchema handler. When tool name is 'aliyun_invoke_api', it calls `handleUniversalTool(args)`.
    server.setRequestHandler(CallToolRequestSchema, async (request) => {
      try {
        const name = request.params.name;
        const args = request.params.arguments;
    
        if (name === "aliyun_invoke_api") {
          return await handleUniversalTool(args);
        }
  • Auth configuration helper: loads ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET from environment, used by the universal tool handler to authenticate API calls.
    import dotenv from 'dotenv';
    import { z } from 'zod';
    
    dotenv.config();
    
    const configSchema = z.object({
      ALIBABA_CLOUD_ACCESS_KEY_ID: z.string().min(1, "Access Key ID is required"),
      ALIBABA_CLOUD_ACCESS_KEY_SECRET: z.string().min(1, "Access Key Secret is required"),
      ALIBABA_CLOUD_REGION_ID: z.string().default("cn-hangzhou"),
    });
    
    export const config = configSchema.parse(process.env);
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. It only mentions 'RPC requests are most common' as a behavioral hint, but lacks details on authentication, rate limits, error handling, or response format. This is insufficient for a tool that can invoke any API across all of Alibaba Cloud.

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?

Three sentences efficiently convey the tool's purpose, scope, and key usage hint (RPC common). Every sentence earns its place with no redundancy or filler.

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

Completeness3/5

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

Given the broad scope (all Alibaba Cloud) and no output schema, the description is somewhat incomplete. It does not explain return format, error handling, or complex parameter usage, but directs to OpenAPI docs. Adequate but not thorough for a tool of this scale.

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?

The input schema has 100% coverage with descriptions for all 5 parameters. The description adds no new parameter semantics beyond directing users to use OpenAPI documentation, which is helpful but does not exceed the baseline expected from schema coverage alone.

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

Purpose5/5

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

The description clearly states 'Invoke ANY Alibaba Cloud OpenAPI endpoint dynamically' and 'manage ALL of Alibaba Cloud', making the tool's purpose unmistakable. It distinguishes from sibling tools that are specific operations like ecs_list_instances or vpc_create.

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

Usage Guidelines4/5

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

The description advises to 'Use the OpenAPI documentation to find the correct endpoint, apiVersion, and action', which implies when to use it—for APIs not covered by specific tools. However, it does not explicitly state when not to use it or provide alternative tools, missing some 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/ahmedselimmansor-ctrl/Alibaba_cloud_MCP_server'

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