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.
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
/
- 1Download the file
s41-multi-entity-org-token.mdusing the button above. - 2Place 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 - 3Use 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