Multi-entity and org-level token management

Guides the use of multi-entity tools with the Spendesk org-level token. Explains entity context management for multi-company groups.

โ†“ Download skill (.md)
81/100ยท๐Ÿ” Ad hocยทExpertCFOController
Multi-entitylist_companies

๐ŸŽฏ Skill purpose

Guides the use of multi-entity tools with the Spendesk org-level token. Explains entity context management for multi-company groups.

๐Ÿ“Š What it produces

Group entity list with context switching examples and multi-entity call patterns.

โšก Benefit

Before

Manual multi-entity analysis by switching Spendesk accounts manually โ€” very time-consuming.

After

Consolidated group view with automatic entity switching in a single prompt.



# Instructions โ€” Multi-entity and token handling

## โš ๏ธ Behavior of list_companies depending on token type

| Token type | Number of entities | id | name |
|------------|-----------|-----|------|
| **org-level** | All active entities | โœ… present | โœ… present |
| **company-scoped** | 1 single entity | โœ… present | **โŒ null** |

If `company.name=null`: don't display "null" โ€” show "current entity" or use the id instead.

## Step 1 โ€” List the available entities

Call `list_companies` (no parameters).

**With an org-level token**: returns all active entities with id + name.
**With a company-scoped token**: returns 1 entity with id only.

Inspect the response:
- If 1 entity and `name=null` โ†’ company-scoped token โ†’ continue with this id
- If several entities with name โ†’ org-level token โ†’ select according to the need

## Step 2 โ€” Select the target entity or entities

**For a single-entity analysis**: choose the entity by name or by currency as needed.

**For a consolidated multi-entity analysis**:
- Iterate over each companyId
- Call the desired tool for each entity
- Combine the results **only after having all results** (never present partial results)

โš ๏ธ Functional currencies vary by entity โ€” **never sum across currencies**.
Use the `functionalAmount` specific to each entity and display them separately, or convert explicitly.

## Step 3 โ€” Available data (real org-level token example)

11 entities on this account, including:
```
B1stUp83     โ†’ SPENDESK (EUR)
Hx1N5m87M   โ†’ Spendesk Limited (GBP)
pD0gYhOK75T โ†’ Spendesk Inc. (USD)
RRbRgeIB7X  โ†’ Spendesk GmbH (EUR)
vvdk2xwqvktsjl โ†’ Spendesk USD Test (USD)
```

## Step 4 โ€” Consolidated multi-entity analysis (pattern)

```
For each companyId in list_companies.data:
  1. Call spendesk_analyze_spend(companyId, fromDate, toDate, groupBy)
  2. Extract summary.totalAmount (entity's functional currency)
  3. Store result + currency

Display:
  Entity A: X EUR (N payables)
  Entity B: Y GBP (N payables)
  Entity C: Z USD (N payables)
  โš ๏ธ Consolidated total in EUR = conversion needed (not provided by the MCP)
```

## Edge case: company-scoped token with a companyId already known

If the token is company-scoped, the tools accept an optional `companyId` (auto-filled).
Passing the companyId explicitly is unnecessary but harmless โ€” the token only accesses its own entity anyway.

## Example prompt

- "Show the spend for each entity in the group" โ†’ iterate over list_companies + analyze_spend
- "What's the wallet balance for all our subsidiaries?" โ†’ iterate over list_companies + get_wallet_summary
- "Compare France vs UK spend" โ†’ 2 calls to analyze_spend on B1stUp83 and Hx1N5m87M

How to install this skill

/
  1. 1
    Download the file s41-multi-entity-org-token.md using the button above.
  2. 2
    Place the file in the .claude/ directory of your project (or ~/.claude/ for a global install).
    cp s41-multi-entity-org-token.md .claude/s41-multi-entity-org-token.md
  3. 3
    Use in Claude Code โ€” the skill is automatically discovered. Describe your need in natural language and Claude will apply the skill instructions.
๐Ÿ’ก Make sure the Spendesk MCP is configured in your .claude/settings.json with the tools list_companies.

Similar skills

โ˜… Top
95/100ยท๐Ÿ” Ad hocยทExpert

MCP coverage audit & gap analysis

Probes all available MCP tools, re-evaluates coverage of 50 persona use cases, detects new fields or tools, and regenerates the gap analysis report.

CFOControllerAP Manager
90/100ยท๐Ÿ“… WeeklyยทBeginner

Card requests via get_requests

Explains how to use get_requests for card requests and why expense reimbursements don't appear there. Avoids a frequent source of confusion between two distinct workflows.

ControllerFinance Analyst
90/100ยท๐Ÿ” Ad hocยทIntermediate

Active vs archived cost centers

Distinguishes active cost centers from archived ones with correct use of get_cost_centers. Avoids the counter-intuitive isArchived vs isActive naming convention pitfall.

ControllerFinance Analyst