/alibabacloud-core:mcp-core-best-practicesfrom alibabacloud-core
Canonical reference for using the Alibaba Cloud OpenAPI MCP Server Core. Covers API exploration, CLI command generation, scripted execution, async task polling, IaC (RunIaC), cross-account access, and safety policy configuration.
Ships in alibabacloud-core. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
This skill documents the canonical patterns for using the alibabacloud-core MCP
server — the generalized OpenAPI MCP Server Core that covers all Alibaba Cloud
APIs without requiring pre-selection of specific operations.
| Tool | Purpose |
|---|---|
AlibabaCloud___SearchApis | Natural language search for APIs matching a requirement |
AlibabaCloud___CallCLI | Execute a single CLI command remotely |
AlibabaCloud___GetApiDefinition | Get full API definition (params, response, errors) by product/version/name |
AlibabaCloud___ListApis | List all APIs for a product, optionally filtered |
AlibabaCloud___ListProductRegions | List regions where a product is available |
AlibabaCloud___GenerateCLICommand | Generate a CLI command from API definition + parameters |
AlibabaCloud___ListProducts | List all Alibaba Cloud products |
AlibabaCloud___SearchDocuments | Search Alibaba Cloud official documentation by keyword, with optional product/language/site filters |
AlibabaCloud___GetDocument | Get full Markdown content of a document by doc_id (preferred) or URL |
AlibabaCloud___GetDocumentTree | Browse a product's document directory tree to discover available docs |
AlibabaCloud___GrepDocuments | Search within a specific product's documents by keyword pattern |
AlibabaCloud___RunScript | Start a restricted Python task with structured Alibaba Cloud OpenAPI access |
AlibabaCloud___GetTask | Long-poll a RunScript task until approval, execution, or failure reaches a terminal state |
AlibabaCloud___RunIaC | Run Terraform / IaC (action=plan/apply/destroy) to provision or tear down a multi-resource stack; plan-before-apply, sync or async, HITL approval |
AlibabaCloud___GetPresignedUrl | Get a time-limited OSS presigned URL (default upload) + presignToken to feed RunIaC; no credentials exposed |
When the target API is unknown, use AlibabaCloud___SearchApis with a natural
language description of the requirement. Each query should be granular enough to
map to a single API call.
For known products, use AlibabaCloud___ListApis with a filter keyword to browse
available operations.
Once the target API is identified, use AlibabaCloud___GetApiDefinition to
retrieve the full definition including:
Use AlibabaCloud___GenerateCLICommand to produce a correct CLI command from the
API definition and user-provided parameters. This avoids manual CLI syntax errors.
Use AlibabaCloud___CallCLI for one known aliyun ... command when no later
call depends on its response. Verified example:
AlibabaCloud___CallCLI(command="aliyun ecs DescribeRegions --region cn-hangzhou").
Use AlibabaCloud___RunScript when the answer needs structured OpenAPI
call_cli(...): pagination, List-to-Describe enrichment, cross-resource
comparison, multi-region/multi-product collection, permission checks, OSS
body/bytes handling, response-driven follow-up calls, or custom result shaping.
Example: fetch identity, list resources, and perform follow-up Describe/Get
calls in one script instead of separate tool round-trips.
Do not split one user task across multiple RunScript submissions just to
inspect intermediate data. Put discovery, pagination, filtering, and follow-up
Describe/Get calls in one self-contained script and return via result.
Chargeable operations: quote before executing. If the command creates,
resizes, renews, or otherwise changes billable resources, first run the same
command with --estimate-cost appended (quote only, no execution) and include
the quoted amount in the user-facing confirmation. See
Cost Estimation Before Execution and the
alibabacloud-cli-cost-estimation skill.
Use AlibabaCloud___CallCLI to execute the generated command. Key constraints:
aliyunAlibabaCloud___RunScript starts a sandboxed Python task and waits up to 20
seconds. It may return result directly; otherwise use the returned processID
and nextAction with AlibabaCloud___GetTask. The script's OpenAPI access goes
through injected call_cli() only:
identity = await call_cli(product='Sts', action='GetCallerIdentity',
params={}, version='2015-04-01')
result = {'has_account_id': 'AccountId' in identity}
RunScript essentials:
call_cli() is structured OpenAPI, not CLI text. Never pass aliyun ....AlibabaCloud___GetApiDefinition separately.params keys must match OpenMeta parameters[].name. RPC APIs
often use RegionId; OSS APIs often use bucket, max-keys, x-oss-acl,
or body.PutObject accepts bytes in params['body'] and
GetObject returns bytes in Body.version, region, and endpoint are optional; still pass API region fields
such as RegionId when the API defines them.result. Do not pass credentials, profiles, shell
flags, or host file paths. Use /tmp only for small sandbox scratch files.call_cli(); pure Python
payloads fail validation.import or comments. Safe modules such as asyncio, json,
math, re, time, and uuid are pre-imported.eval, exec, compile, __import__,
globals, locals, getattr, setattr, or vars; do not use private or
dunder attributes, dynamic .format() tricks, subprocesses, or network code.configure, plugin, ossutil,
ossutil64, upgrade, or mock. Some OSS APIs are unsupported; if the
validator returns UnsupportedOssApi, choose a supported OSS OpenAPI action
or another tool.{"Instances":{"Instance":[...]}}.asyncio.gather(..., return_exceptions=True) for parallel calls. Treat
expected NotFound as "not configured" for optional features.OSS object read/write example (use a user-approved temporary bucket/key):
bucket = '<approved-bucket>'
key = 'run-script-probe/example.txt'
content = b'hello-from-run-script\n'
put = await call_cli(product='Oss', action='PutObject',
params={'bucket': bucket, 'key': key, 'body': content},
version='2019-05-17', region='cn-hangzhou')
got = await call_cli(product='Oss', action='GetObject',
params={'bucket': bucket, 'key': key},
version='2019-05-17', region='cn-hangzhou')
result = {'put_ok': isinstance(put, dict), 'round_trip_ok': got.get('Body') == content}
After AlibabaCloud___RunScript, inspect nextAction:
nextAction | Meaning | Agent action |
|---|---|---|
None | Task succeeded | Use result |
CallGetTask | Initial call is not terminal | Call AlibabaCloud___GetTask with the same processID |
CallGetTaskAgain | Poll timed out and task is still not terminal | Call AlibabaCloud___GetTask again with the same processID |
Stop | Validation failed, approval rejected/expired, task expired, or process missing | Stop; do not retry automatically |
InspectError | Execution failed | Inspect error; failed OpenAPI calls appear in error.failedCall when available |
AlibabaCloud___GetTask parameters:
processID: required, from RunScript.waitTimeoutSeconds: optional, capped at 30 seconds by the server. Use 0
for an immediate status check.pollIntervalSeconds: optional polling interval, between 1 and 10 seconds.Human approval handling:
ApprovalPending with approvalReqId means external approval is required.
Ask the user to complete approval or rejection out of band, then call
AlibabaCloud___GetTask again with the same processID.AlibabaCloud___RunScript again while waiting for approval or
execution; that creates a new process instead of continuing the current one.ApprovalRejected and ApprovalExpired are terminal. Stop and report the
approval result.IMPORTANT: For any operation involving member accounts, cross-account queries,
or Resource Directory account resolution, you MUST first load the
multi-account-query skill (invoke it via the Skill tool) before proceeding.
That skill contains the complete workflow for alias-to-UID resolution, pagination
handling, and proper use of x_assume_account_id. Do not attempt cross-account
operations without reading it first.
For Resource Directory member accounts, pass additional parameters to
AlibabaCloud___CallCLI:
| Parameter | Usage |
|---|---|
x_assume_account_id | Target member account UID |
x_assume_role_name | Custom role name (default: ResourceDirectoryAccountAccessRole) |
x_assume_role_arn | Full role ARN (highest priority) |
Priority: x_assume_role_arn > x_assume_account_id + x_assume_role_name >
default configuration.
The CLI (≥ 3.4.2) can return an exact price quote for a supported operation without executing it — the quoted amount equals the order amount the execution would produce. The best-practice loop for any chargeable operation:
aliyun list-supported-pricing-apis--estimate-cost to the exact command (safe — never executes)--estimate-cost removedWhen one user request maps to multiple API calls, quote all chargeable
steps up front (using --estimate-cost-context to simulate the state earlier
steps will produce), present a single consolidated cost plan, and ask one
confirmation for the whole sequence — do not execute-and-ask step by step.
For usage-based quotes and multi-step workflows (quoting a later step against
the state an earlier step will produce), pass assumptions via
--estimate-cost-context Key=Value. Full guidance — reading the quote JSON
(pricingMode / pricingUnit / delta amounts), PricingContext usage, and
bill reconciliation — lives in the dedicated
alibabacloud-cli-cost-estimation skill.
AlibabaCloud___RunIaC runs Terraform/IaC so a single call can stand up several
interdependent resources, then later tear them down. It takes action
(plan default / apply / destroy), code (only on plan) or presignToken,
and previousProcessId. Prefer it over CallCLI whenever the request is more than
a one-off read or single mutation.
Use RunIaC | Use CallCLI |
|---|---|
| Multiple resources at once (e.g. VPC + vSwitch + ECS) | A single, one-shot query or describe |
| Resources have dependencies / ordering | A stateless mutation that needs no rollback |
| You want a destroyable, tracked stack | No lifecycle to manage afterward |
| Repeatable, idempotent provisioning | Quick fact lookup or --region check |
If you find yourself chaining several CallCLI create calls and worrying about
cleanup, switch to RunIaC.
action=plan with code (or presignToken). It returns a
processId plus the diff and status=Planned. Surface the diff to the user.action=apply with previousProcessId (no code) to run the
exact plan that was reviewed; template and state stay identical. If the plan has
changes, the call may return ApprovalPending + approvalReqId — wait for
approval, do not retry. Remind the user to review the plan first when
resources involve cost, data deletion, or security-sensitive config.action=destroy with previousProcessId to release the
resources from that plan.RunIaC returns a processId immediately and runs the task in the background.
Use nextAction to drive follow-up: CallGetTask / CallGetTaskAgain means poll
AlibabaCloud___GetTask with that processID until a terminal state. Plan rests
at Planned; apply ends at Succeeded (or Failed). Read the structured outputs
from the apply / GetTask result — do not block waiting on the first call.
To release resources, call RunIaC with action=destroy and the
previousProcessId of the plan that created them.
For complex or slow code, keep polling AlibabaCloud___GetTask by processID
until terminal instead of one long blocking wait; do not loop aggressively (a
few-second cadence is enough).
Both plan and apply emit structured output. Read the plan to confirm the resource
set before applying, and read the apply / GetTask result outputs (e.g. region,
zone, instance name, public IP) to report results — do not guess at IDs/addresses;
pull them from the returned outputs.
When using AlibabaCloud___CallCLI, the following are NOT supported:
|) or shell operatorsgrep, awk, sed, or other shell tools>, >>, <)$())file://, fileb://)For commands that need local file access (e.g., ossutil cp), use the Bash tool
directly instead of MCP.
The MCP server is remote, so CallCLI rejects local paths (file://, fileb://)
and tools never see your filesystem. To move bytes in — IaC bundles or large
script inputs — stage them in OSS with AlibabaCloud___GetPresignedUrl.
It defaults to upload (PUT) against a platform-managed bucket and returns a
presignToken; the URL carries its own auth, so credentials are never embedded in
commands. Download (GET) is only for the user's own OSS bucket.
Typical flow:
GetPresignedUrl (default upload) to get an upload URL + presignToken.PUT the local bundle to that URL.presignToken to RunIaC instead of inlining code.AlibabaCloud___ListProductRegions to check product availability in a
specific region before making calls.--region when operating across regions or when the default
region may not match the target.AlibabaCloud___SearchDocuments: Find relevant docs by keyword. Supports
product, limit, website, and language filters.AlibabaCloud___GetDocument: Read full content by doc_id (preferred) or
URL. Supports max_length to cap response size, plus website and language.AlibabaCloud___GetDocumentTree: Browse a product's doc tree by alias
(e.g. ecs, oss). Use to discover what documents exist, then fetch via
GetDocument.AlibabaCloud___GrepDocuments: Search within a specific product's docs by
keyword pattern (matches title/description). Useful when you know the product
but not the exact document name.Use these to verify behavior, understand quotas, or find configuration guides that are not captured in API definitions alone.
GetApiDefinition output.ListProductRegions to find valid regions.status and result; fix the HCL, plan
again, and apply the new previousProcessId. To roll back, action=destroy with
the prior previousProcessId rather than chaining manual CallCLI cleanup.AlibabaCloud___GetTask by processID
until terminal; do not retry the whole apply (re-bind via previousProcessId).RunScript.call_cli(); pure Python
scripts are rejected.error; if the script needs
correction, submit one new corrected RunScript.The in-plugin skills (alibabacloud-sdk-usage, alibabacloud-cli-guidance,
alibabacloud-terraform-code-generation, multi-account-query) cover SDK
codegen, CLI guidance, Terraform HCL, and cross-account queries. They do not cover
purpose-built operational solutions, less common products, or end-to-end
workflows that the Alibaba Cloud team publishes as standalone skills.
When the user's request falls outside the in-plugin coverage, defer to
alibabacloud-find-skills instead of forcing a generic SDK or CLI synthesis.
alibabacloud-find-skills when ANY of the following is truealibabacloud-find-skills whenCallCLI / GetApiDefinition / one-shot SDK call
(use the in-plugin skills directly)find-skills earlier in this
conversation and returned no match — don't re-search the same intentalibabacloud-find-skills via the Skill tool — it handles
search, presentation, and install in its own workflowWhen building stable workflows:
SearchApis to identify the correct API during development.GenerateCLICommand to produce validated commands.RunScript for workflows that require complete pagination,
List-to-Describe enrichment, or multi-call analysis.This progression — explore, validate, codify, restrict — ensures both flexibility during development and safety in production.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
2 plugins in one repository ship this exact skill · first indexed Aug 12, 2026
10 skills in this plugin
/alibabacloud-cli-cost-estimationPre-execution cost estimation for Alibaba Cloud CLI operations. Use this skill whenever a user asks "how much will this cost", before executing any chargeable operation (create / resize / renew / bandwidth change), or when planning a multi-step workflow whose total cost should be known up front. Covers the --estimate-cost flag (quote without executing), --estimate-cost-context (usage assumptions and future-state overrides for multi-step workflows), reading the quote JSON correctly (pricingMode, pricingUnit, delta amounts), and reconciling quotes against actual bills.
/alibabacloud-cli-guidanceGuide for Alibaba Cloud CLI (aliyun) command syntax, plugin system, parameter naming, and best practices. Use this skill to generate correct CLI commands, understand plugin vs built-in command differences, structured parameter syntax, output filtering, pagination, and error troubleshooting. This skill is a CLI knowledge reference — when MCP tools (AlibabaCloud___CallCLI, etc.) are available, always prefer MCP tools for execution rather than running aliyun commands locally in the shell.
/alibabacloud-find-skillsUse this skill when users want to search, discover, browse, or find Alibaba Cloud (阿里云) agent skills. Triggers include: "find a skill for X", "search alicloud skills", "阿里云有什么 skill","阿里云", "搜索阿里云技能", "有没有管理 ECS/RDS/OSS 的 skill", "阿里云 skills 有哪些类目", "帮我找一个 skill", "browse alicloud skills", "list alicloud skill categories", "is there an alicloud skill that can...", "what alicloud skills are available", "XX Skill 的内容是什么", "我想了解阿里云 XX Skill 具体做什么","帮我安装阿里云 Skill","使用阿里云相关的skill", "阿里云 agent skill 市场", "搜一下阿里云的 skill", "建一个数据分析项目有没有相关 skill".
npx claudepluginhub aliyun/alibabacloud-agent-toolkit --plugin alibabacloud-coreOther plugins' skills for the same job