# Datasource

> Read-only discovery skill. Browse SmartCMP reference data such as service catalogs, business groups, tenant and project scopes, applications, OS templates, images, and generic resource details. Request, apply, create VM, or provisioning intent belongs to the request skill, whose request-projected aliases reuse the same logical-template and image scripts.

- Skill: `cloudchef/datasource` (Agent Skill, multi-file: 3 files)
- Install (CLI): `npx skillmds@latest add cloudchef/datasource`
- Raw SKILL.md: https://api.skillmd.com/api/skills/cloudchef/datasource/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Product & Planning
- Author: CloudChef (https://skillmd.com/u/cloudchef)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/cloudchef/datasource

---


# datasource

Reference data discovery skill (read-only).

## Purpose

Query and browse reference data as standalone read-only operations. Use when
user wants to explore available options without submitting a request. This
skill owns standalone business-group scope discovery. Dedicated
`resource-pool` and `resource` skills still handle standalone resource-pool
and resource browsing.

## Terminology Mapping

Treat SmartCMP `business group` as a generic organizational scope. Users may
describe the same concept as:

- tenant
- 租户
- 部门
- BU
- Department
- 项目
- Project

Resolve these terms against SmartCMP business-group data unless the user is
clearly referring to some other system-level tenant concept. Mirror the user's
wording in replies when it helps readability, but keep the SmartCMP field names
`businessGroupName` and `bgId` when calling scripts or building request data.

## Trigger Conditions

Activate this skill when user intent matches:

| Intent | Keywords |
|--------|----------|
| View business-group scopes | "show business groups", "show tenants", "查看租户", "查看部门", "查看项目" |
| List applications | "list applications", "show apps" |
| List OS templates | "list OS templates", "available OS" |
| List images | "list images", "available images" |

**NOT for**: Resource provisioning -> use `request` skill instead.
**NOT for**: Catalog discovery -> use `request`.
**NOT for**: Direct "查询资源池", "查看所有资源", "查看所有云主机", or
"查看某个云主机详情" requests -> use `resource-pool` or `resource`.

## Handlers

All five datasource Tool commands are co-located in `scripts/adapter.py`:

| Handler | Tool | Purpose |
|--------|------|---------|
| `list_all_business_groups` | `smartcmp_list_all_business_groups` | List standalone business-group scopes |
| `list_applications` | `smartcmp_list_applications` | List applications in a business group |
| `list_components` | `smartcmp_list_components` | List component metadata for a catalog source key |
| `list_logical_templates` | `smartcmp_query_logical_templates` | Query logical templates |
| `list_images` | `smartcmp_query_images` | Query cloud images |

Catalog list/detail belongs to the `request` Skill Adapter. Resource
list/detail belongs to the `resource` Skill Adapter. The request Skill's
logical-template and image Tools are aliases to the two owning datasource
handlers; they do not create forwarding Python files.

The Adapter receives the selected instance and Authentication Context from
AtlasClaw. SmartCMP Provider owns authentication, HTTP, pagination,
normalization, and resource/catalog domain rules.

## Workflow examples

- “Show available tenants or projects”: call
  `smartcmp_list_all_business_groups`.
- “List Linux logical templates”: call `smartcmp_query_logical_templates`
  with `os_type=Linux`.
- “List images for this pool and logical template”: call
  `smartcmp_query_images` with the exact three IDs/types required by the Tool
  schema.

Omit `resource_bundle_id` for a global logical-template directory query; pass
it to show only templates supported by one resource pool. A selected image
`id` is a `templateId`; it must never be serialized as `physicalTemplateId`.

## Critical Rules

> All operations are **read-only** - no data is created or modified.

> Request aliases reference the owning datasource handlers; no implementation
> is copied or proxied through another Python process.

> Standalone directory queries for all business-group scopes belong to
> `datasource`. Standalone resource-pool and resource browsing belong to
> `resource-pool` and `resource`.

> On error (`[ERROR]`), report to user immediately; do NOT self-debug.

## Error Handling

| Error | Resolution |
|-------|------------|
| `401` / Token expired | Ask user to refresh cookie |
| Missing arguments | Check script usage in docstring |

## References

- [WORKFLOW.md](references/WORKFLOW.md) - Detailed script usage and query flows

