Multi Account Query logo

Multi Account Query

Organization
aliyun
multi-account-query

Query Alibaba Cloud resources across multiple accounts in a Resource Directory. Resolves member account aliases to UIDs via ResourceDirectory ListAccounts, then uses x_assume_account_id to assume into the target account for CLI calls. Use when the user references a member account by display name or alias, or explicitly asks to query resources in another account under the same RD. MUST be loaded for any cross-account or member-account operation before calling AlibabaCloud___CallCLI with x_assume_account_id.

Overview

Publisheraliyun
Repositoryalibabacloud-agent-toolkit
Skill namemulti-account-query
Stars
29
Forks
13
Bundled files
Instructions only
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by aliyun on GitHub. Read the source before you install it.

Installation

Install the Multi Account Query AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/aliyun/alibabacloud-agent-toolkit/tree/main/plugins/alibabacloud-core/skills/multi-account-query
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/aliyun/alibabacloud-agent-toolkit.git /tmp/alibabacloud-agent-toolkit
mkdir -p .claude/skills
cp -r /tmp/alibabacloud-agent-toolkit/plugins/alibabacloud-core/skills/multi-account-query .claude/skills/multi-account-query
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Multi Account Query in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Multi Account Query on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Multi Account Query is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Multi-Account Resource Query

Query Alibaba Cloud resources across member accounts in a Resource Directory (RD) organization. When the user refers to an account by its display name (alias) rather than its UID, this skill resolves the alias first, then assumes into the target account to execute the actual resource query.

Scope Check Before You Start

This skill resolves the cross-account routing layer only — alias→UID, plus the assume-role hop. If the user's actual request is a multi-account solution pattern — key rotation across all members, drift / cost / RAM audits, billing aggregation, organization-wide compliance scans — invoke alibabacloud-find-skills first; a packaged multi-account-ops skill captures the full workflow (iteration, error rollup, reporting), not just the cross-account hop. Use this skill directly only when the user just needs the routing primitive for a single-shot query. Full trigger conditions are in mcp-core-best-practices → Skill Discovery.

Prerequisites

  • The current credentials must belong to an RD management account (or a delegated administrator) with resourcedirectory:ListAccounts permission.
  • A cross-account assume role (default: ResourceDirectoryAccountAccessRole) must exist in target member accounts.

Workflow

1. Determine Whether Cross-Account Access Is Needed

If the user explicitly provides an account ID (UID), skip to step 3.

If the user refers to an account by display name, alias, or any non-numeric identifier, proceed to step 2 to resolve it.

2. Resolve Account Alias to UID

Use AlibabaCloud___CallCLI to list member accounts. The API returns at most 100 accounts per page, so always set --page-size 100 and handle pagination when the organization has more than 100 accounts:

aliyun resourcedirectorymaster list-accounts --page-size 100 --page-number 1

From the response, find the account whose DisplayName matches the user's input. Extract its AccountId field — this is the UID needed for cross-account access.

If the target is not found in the first page, increment --page-number and continue fetching until the target is found or all pages are exhausted (total account count is returned in the response's TotalCount field).

If no match is found, report to the user and ask for clarification. Do not guess account IDs.

3. Execute the Resource Query in the Target Account

When calling AlibabaCloud___CallCLI for the actual resource query, pass the x_assume_account_id parameter with the resolved UID. This tells the MCP server to assume into the target account before executing the command.

Example — list ECS instances in member account "dev-team":

# Step 1: Resolve "dev-team" to its UID
AlibabaCloud___CallCLI(command="aliyun resourcedirectorymaster list-accounts --page-size 100 --page-number 1")
# → find AccountId where DisplayName == "dev-team", e.g. "1234567890123456"
# → if not found and TotalCount > 100, continue with --page-number 2, 3, ...

# Step 2: Query resources in that account
AlibabaCloud___CallCLI(
  command="aliyun ecs describe-instances --region cn-hangzhou",
  x_assume_account_id="1234567890123456"
)

4. Present Results

Return the query results to the user. If the user asks about multiple accounts, repeat steps 2–3 for each account, or iterate over all accounts from the ListAccounts response.

Parameter Reference

ParameterDescription
x_assume_account_idTarget member account UID. The MCP server assumes into this account using the default cross-account role.
x_assume_role_nameOverride the default role name if the target account uses a custom role (default: ResourceDirectoryAccountAccessRole).
x_assume_role_arnFull ARN of the role to assume. Takes highest priority over account_id + role_name.

Error Handling

  • AccessDenied on ListAccounts: The current credentials lack RD read permission. Ask the user to verify they are using the management account.
  • AssumeRole failed: The target account may not have the expected role, or the role trust policy does not allow the current account. Report the error and suggest the user check the role configuration.
  • Account not found: The display name does not match any member account. List available account names to help the user pick the correct one.

Guardrails

  • Always resolve aliases via the ListAccounts API. Never guess or hardcode account IDs.
  • Do not cache account lists across conversations — accounts can be added or removed at any time.
  • When iterating over multiple accounts, include the account display name and ID in the output so the user can verify correctness.
  • Respect the principle of least privilege: only query the resources the user asked about, do not enumerate all resources in all accounts unless explicitly requested.

Frequently asked questions

What does the Multi Account Query AI skill do?

Query Alibaba Cloud resources across multiple accounts in a Resource Directory. Resolves member account aliases to UIDs via ResourceDirectory ListAccounts, then uses x_assume_account_id to assume into the target account for CLI calls. Use when the user references a member account by display name or alias, or explicitly asks to query resources in another account under the same RD. MUST be loaded for any cross-account or member-account operation before calling AlibabaCloud___CallCLI with x_assume_account_id.

Why use Multi Account Query on TypingMind?

Because you install it once and use it with any model. Multi Account Query is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Multi Account Query in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/aliyun/alibabacloud-agent-toolkit/tree/main/plugins/alibabacloud-core/skills/multi-account-query. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Multi Account Query?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Multi Account Query?

As many as you like. As long as a model supports skills, you can use Multi Account Query with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Multi Account Query AI skill free?

Yes. It is published on GitHub by aliyun under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇