@sassoftware/sas-score-mcp-serverjs 1.0.1-7 → 1.0.1-8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.skills/sas-find-library-smart/SKILL.md +155 -0
- package/.skills/sas-find-resource-strategy/SKILL.md +105 -0
- package/.skills/sas-list-resource-strategy/SKILL.md +124 -0
- package/.skills/sas-list-tables-smart/SKILL.md +128 -0
- package/.skills/sas-read-and-score-strategy/SKILL.md +113 -0
- package/.skills/sas-read-strategy/SKILL.md +154 -0
- package/.skills/sas-request-classifier/SKILL.md +74 -0
- package/.skills/sas-score-workflow-strategy/SKILL.md +314 -0
- package/.skills_claude/CLAUDE.md +201 -0
- package/.skills_claude/agents/sas-score-mcp-serverjs-agent.md +58 -0
- package/.skills_claude/enforce-find-resource-strategy.md +35 -0
- package/.skills_github/agents/sas-score-mcp-serverjs-agent.md +58 -0
- package/.skills_github/copilot-instructions.md +201 -0
- package/.skills_github/enforce-find-resource-strategy.md +35 -0
- package/cli.js +14 -0
- package/package.json +3 -1
- package/src/setupSkills.js +5 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sas-find-library-smart
|
|
3
|
+
description: >
|
|
4
|
+
Find a SAS Viya library (libref or caslib) with intelligent server detection. Automatically checks
|
|
5
|
+
CAS first, then SAS if not found. Use this skill when the user needs to verify a library exists,
|
|
6
|
+
before accessing tables within it. Trigger phrases include: "find library", "does library exist",
|
|
7
|
+
"check if library", "locate library", "is there a library named", "verify library", or any request
|
|
8
|
+
to confirm a library's availability across servers.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Smart Library Lookup (Find Library)
|
|
12
|
+
|
|
13
|
+
Intelligently locates a SAS Viya library by checking CAS first, then SAS if the library is not found
|
|
14
|
+
in CAS. Provides the user with clear information about library availability and location.
|
|
15
|
+
|
|
16
|
+
> Primary strategy: use `sas-find-resource-strategy` for all resource existence checks.
|
|
17
|
+
|
|
18
|
+
**If the user specifies the server explicitly** (e.g., "find library Public in cas"):
|
|
19
|
+
- Use the specified server: `server: "cas"` or `server: "sas"`
|
|
20
|
+
- Proceed directly to finding the library
|
|
21
|
+
|
|
22
|
+
**If the server is NOT specified:**
|
|
23
|
+
1. **First attempt**: Check CAS (`server: "cas"`)
|
|
24
|
+
2. **If not found in CAS**: Check SAS with uppercase library name (`server: "sas"`)
|
|
25
|
+
3. **If not found in either**:
|
|
26
|
+
- Inform user: *"The library '<lib>' was not found in CAS or SAS servers. Please verify the library name."*
|
|
27
|
+
- Ask for corrected library name or explicit server context
|
|
28
|
+
4. **If found**:
|
|
29
|
+
- Inform user which server contains the library: *"Found library '<lib>' in CAS"* or *"Found library '<lib>' in SAS"*
|
|
30
|
+
- Offer next steps: *"Would you like to list tables in this library?"* (suggest `sas-score-list-tables`)
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Using sas-score-find-library
|
|
35
|
+
|
|
36
|
+
**When:**
|
|
37
|
+
- User wants to verify a library exists
|
|
38
|
+
- User needs to determine which server contains a library
|
|
39
|
+
- User wants to check library availability before accessing it
|
|
40
|
+
- User wants to explore available libraries (before querying)
|
|
41
|
+
|
|
42
|
+
**How:**
|
|
43
|
+
```
|
|
44
|
+
sas-score-find-library({
|
|
45
|
+
name: "libraryname", // required
|
|
46
|
+
server: "cas" or "sas" // optional; determined by server check if not specified
|
|
47
|
+
})
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Rules:**
|
|
51
|
+
- Always determine the correct server first (cas → sas → neither)
|
|
52
|
+
- **For SAS server: always uppercase the library name** (e.g., "public" → "PUBLIC")
|
|
53
|
+
- If library name is missing, ask: *"Which library name would you like to find?"*
|
|
54
|
+
- Return the server where the library was found
|
|
55
|
+
- If not found in either server, clearly inform the user and request corrected name or server context
|
|
56
|
+
- Do not proceed with table access until library existence is confirmed
|
|
57
|
+
- Do not use list tools to find whether a library exists
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Smart server detection logic
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
IF server specified by user
|
|
65
|
+
→ IF server is "sas"
|
|
66
|
+
→ uppercase lib
|
|
67
|
+
→ use that server, call sas-score-find-library
|
|
68
|
+
ELSE
|
|
69
|
+
→ TRY sas-score-find-library(lib, server="cas")
|
|
70
|
+
IF library found
|
|
71
|
+
→ success, inform user: library found in CAS
|
|
72
|
+
ELSE
|
|
73
|
+
→ uppercase lib
|
|
74
|
+
→ TRY sas-score-find-library(lib.toUpperCase(), server="sas")
|
|
75
|
+
IF library found
|
|
76
|
+
→ success, inform user: library found in SAS
|
|
77
|
+
ELSE
|
|
78
|
+
→ inform user library not found in either server
|
|
79
|
+
→ ask for corrected name or explicit server
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Common patterns
|
|
85
|
+
|
|
86
|
+
**Pattern 1 — Find library, server unspecified**
|
|
87
|
+
> "Find library Public"
|
|
88
|
+
|
|
89
|
+
1. Try CAS: `sas-score-find-library({ name: "Public", server: "cas" })`
|
|
90
|
+
2. If not found, try SAS with uppercase: `sas-score-find-library({ name: "PUBLIC", server: "sas" })`
|
|
91
|
+
3. If found in CAS → *"Found library 'Public' in CAS. Would you like to list tables in it?"*
|
|
92
|
+
4. If found in SAS → *"Found library 'PUBLIC' in SAS. Would you like to list tables in it?"*
|
|
93
|
+
5. If not found -> *"The library 'Public' was not found in CAS or SAS. Please confirm the name or specify a server."*
|
|
94
|
+
|
|
95
|
+
**Pattern 2 — Find library with explicit server (CAS)**
|
|
96
|
+
> "Find library MyData in cas"
|
|
97
|
+
|
|
98
|
+
1. Skip server detection
|
|
99
|
+
2. Call: `sas-score-find-library({ name: "MyData", server: "cas" })`
|
|
100
|
+
3. Result → *"Found library 'MyData' in CAS"* or *"Library 'MyData' not found in CAS"*
|
|
101
|
+
|
|
102
|
+
**Pattern 3 — Find library with explicit server (SAS)**
|
|
103
|
+
> "Does library SASHELP exist in sas"
|
|
104
|
+
|
|
105
|
+
1. Skip server detection
|
|
106
|
+
2. Uppercase lib: `sas-score-find-library({ name: "SASHELP", server: "sas" })`
|
|
107
|
+
3. Result → *"Found library 'SASHELP' in SAS"* or *"Library 'SASHELP' not found in SAS"*
|
|
108
|
+
|
|
109
|
+
**Pattern 4 — Library not found, offer next steps**
|
|
110
|
+
> "Check if library staging exists"
|
|
111
|
+
|
|
112
|
+
1. Try CAS: `sas-score-find-library({ name: "staging", server: "cas" })` → not found
|
|
113
|
+
2. Try SAS: `sas-score-find-library({ name: "STAGING", server: "sas" })` → not found
|
|
114
|
+
3. Respond:
|
|
115
|
+
- *"The library 'staging' was not found in CAS or SAS."*
|
|
116
|
+
- *"Please confirm the library name or specify the server (CAS or SAS)."*
|
|
117
|
+
|
|
118
|
+
**Pattern 5 — Library found, follow-up action**
|
|
119
|
+
> "Verify library samples exists"
|
|
120
|
+
|
|
121
|
+
1. Try CAS: `sas-score-find-library({ name: "samples", server: "cas" })` → found
|
|
122
|
+
2. Respond:
|
|
123
|
+
- *"Found library 'samples' in CAS."*
|
|
124
|
+
- *"Would you like to list tables in this library? (use `sas-score-list-tables`))"*
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Output presentation
|
|
129
|
+
|
|
130
|
+
**When library is found:**
|
|
131
|
+
```
|
|
132
|
+
✓ Found library '<lib>' in <SERVER>
|
|
133
|
+
|
|
134
|
+
Would you like to:
|
|
135
|
+
• List tables in this library (use sas-list-tables-smart skill)
|
|
136
|
+
• Read data from a specific table (use sas-read-strategy skill)
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
**When library is not found:**
|
|
140
|
+
```
|
|
141
|
+
✗ Library '<lib>' not found in either CAS or SAS
|
|
142
|
+
|
|
143
|
+
Suggestions:
|
|
144
|
+
• Check the spelling of the library name
|
|
145
|
+
• Specify the intended server (CAS or SAS)
|
|
146
|
+
• Try a different library name
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Integration with other skills
|
|
152
|
+
|
|
153
|
+
- **Primary find strategy**: Use `sas-find-resource-strategy` for existence checks
|
|
154
|
+
- **After finding library → List tables**: Use `sas-list-tables-smart` skill to browse available tables
|
|
155
|
+
- **After finding library → Read data**: Use `sas-read-strategy` skill to retrieve data from tables
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sas-find-resource-strategy
|
|
3
|
+
description: >
|
|
4
|
+
Unified strategy for finding SAS Viya resources using find tools only. Supports library, table,
|
|
5
|
+
model, job, and jobdef lookup with server-aware behavior for CAS/SAS resources. Use this skill
|
|
6
|
+
whenever the task is to verify whether a resource exists.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# SAS Find Resource Strategy
|
|
10
|
+
|
|
11
|
+
Use this skill to verify resource existence without using list tools.
|
|
12
|
+
|
|
13
|
+
## Scope
|
|
14
|
+
|
|
15
|
+
Supported resource types:
|
|
16
|
+
- library
|
|
17
|
+
- table
|
|
18
|
+
- model
|
|
19
|
+
- job
|
|
20
|
+
- jobdef
|
|
21
|
+
|
|
22
|
+
## Mandatory rule
|
|
23
|
+
|
|
24
|
+
- Use the sas-find-resource strategy to check for the existence of a resource before attempting to read or use it. This ensures that follow-up actions are based on accurate information about resource availability.
|
|
25
|
+
- Do not use list tools to find a resource.
|
|
26
|
+
|
|
27
|
+
## Tool mapping
|
|
28
|
+
|
|
29
|
+
- Library -> `sas-score-find-library`
|
|
30
|
+
- Table -> `sas-score-find-table`
|
|
31
|
+
- Model -> `sas-score-find-model`
|
|
32
|
+
- Job -> `sas-score-find-job`
|
|
33
|
+
- Jobdef -> `sas-score-find-jobdef`
|
|
34
|
+
|
|
35
|
+
## Strategy by resource type
|
|
36
|
+
|
|
37
|
+
### Find library
|
|
38
|
+
|
|
39
|
+
If server is provided:
|
|
40
|
+
- CAS: `sas-score-find-library({ name: "<lib>", server: "cas" })`
|
|
41
|
+
- SAS: uppercase first, then `sas-score-find-library({ name: "<LIB>", server: "sas" })`
|
|
42
|
+
|
|
43
|
+
If server is not provided:
|
|
44
|
+
1. Check CAS first - `sas-score-find-library({ name: "<lib>", server: "cas" })`
|
|
45
|
+
2. If not found, check SAS with uppercase library name - `sas-score-find-library({ name: "<LIB>", server: "sas" })`
|
|
46
|
+
3. Report where found, or report not found in either.
|
|
47
|
+
|
|
48
|
+
### Find table
|
|
49
|
+
|
|
50
|
+
Required inputs:
|
|
51
|
+
- library name
|
|
52
|
+
- table name
|
|
53
|
+
|
|
54
|
+
If server is provided:
|
|
55
|
+
- CAS: `sas-score-find-table({ lib: "<lib>", name: "<table>", server: "cas" })`
|
|
56
|
+
- SAS: uppercase library first, then `sas-score-find-table({ lib: "<LIB>", name: "<table>", server: "sas" })`
|
|
57
|
+
|
|
58
|
+
If server is not provided:
|
|
59
|
+
1. Check CAS first - `sas-score-find-table({ lib: "<lib>", name: "<table>", server: "cas" })`
|
|
60
|
+
2. If not found, check SAS (uppercase library) - `sas-score-find-table({ lib: "<LIB>", name: "<table>", server: "sas" })`
|
|
61
|
+
3. If found in both, report both and ask user which server to use for follow-up reads.
|
|
62
|
+
|
|
63
|
+
### Find model
|
|
64
|
+
|
|
65
|
+
Use:
|
|
66
|
+
- `sas-score-find-model({ name: "<model>" })`
|
|
67
|
+
|
|
68
|
+
If a model type suffix is provided (for example `.mas`, `.job`, `.jobdef`, `.scr`):
|
|
69
|
+
- For MAS model discovery, strip suffix and look up base name with `sas-score-find-model`.
|
|
70
|
+
- For `.job` and `.jobdef`, use job and jobdef find tools instead of model find.
|
|
71
|
+
|
|
72
|
+
### Find job
|
|
73
|
+
|
|
74
|
+
Use:
|
|
75
|
+
- `sas-score-find-job({ name: "<job>" })`
|
|
76
|
+
|
|
77
|
+
### Find jobdef
|
|
78
|
+
|
|
79
|
+
Use:
|
|
80
|
+
- `sas-score-find-jobdef({ name: "<jobdef>" })`
|
|
81
|
+
|
|
82
|
+
## Clarifying prompts
|
|
83
|
+
|
|
84
|
+
Ask one focused question if required fields are missing:
|
|
85
|
+
- Library missing for table lookup: "Which library contains the table?"
|
|
86
|
+
- Table name missing: "Which table name should I check?"
|
|
87
|
+
- Resource type ambiguous: "Do you want me to find a library, table, model, job, or jobdef?"
|
|
88
|
+
|
|
89
|
+
## Output format
|
|
90
|
+
|
|
91
|
+
For found resources:
|
|
92
|
+
- Confirm exact resource name returned by the tool.
|
|
93
|
+
- Confirm server when applicable (CAS/SAS).
|
|
94
|
+
|
|
95
|
+
For not found resources:
|
|
96
|
+
- State that the resource was not found.
|
|
97
|
+
- Ask for corrected name or server context.
|
|
98
|
+
|
|
99
|
+
## Examples
|
|
100
|
+
|
|
101
|
+
- "find library Samples" -> CAS first, then SAS fallback using uppercase.
|
|
102
|
+
- "find table costchange in Samples" -> CAS first, then SAS fallback using uppercase library.
|
|
103
|
+
- "find model breastcancer" -> `sas-score-find-model`.
|
|
104
|
+
- "find job simplejob" -> `sas-score-find-job`.
|
|
105
|
+
- "find jobdef daily_run" -> `sas-score-find-jobdef`.
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sas-list-resource-strategy
|
|
3
|
+
description: >
|
|
4
|
+
Unified strategy for listing SAS Viya resources using list tools. Supports libraries,
|
|
5
|
+
tables, models, jobs, and jobdefs. Always normalize pagination so start and limit are
|
|
6
|
+
never null: default start=1 and limit=10 when not provided.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# SAS List Resource Strategy
|
|
10
|
+
|
|
11
|
+
Use this skill to list resources with consistent pagination defaults.
|
|
12
|
+
|
|
13
|
+
## Scope
|
|
14
|
+
|
|
15
|
+
Supported resource types:
|
|
16
|
+
- library
|
|
17
|
+
- table
|
|
18
|
+
- model
|
|
19
|
+
- job
|
|
20
|
+
- jobdef
|
|
21
|
+
|
|
22
|
+
## Mandatory pagination rule
|
|
23
|
+
|
|
24
|
+
For every list operation:
|
|
25
|
+
- `start` must never be null
|
|
26
|
+
- `limit` must never be null
|
|
27
|
+
- If `start` is missing or null, set `start: 1`
|
|
28
|
+
- If `limit` is missing or null, set `limit: 10`
|
|
29
|
+
|
|
30
|
+
Normalization pattern:
|
|
31
|
+
```
|
|
32
|
+
start = (start == null) ? 1 : start
|
|
33
|
+
limit = (limit == null) ? 10 : limit
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Tool mapping
|
|
37
|
+
|
|
38
|
+
- Library -> `sas-score-list-libraries`
|
|
39
|
+
- Table -> `sas-score-list-table`
|
|
40
|
+
- Model -> `sas-score-list-models`
|
|
41
|
+
- Job -> `sas-score-list-jobs`
|
|
42
|
+
- Jobdef -> `sas-score-list-jobdefs`
|
|
43
|
+
|
|
44
|
+
## Strategy by resource type
|
|
45
|
+
|
|
46
|
+
### List libraries
|
|
47
|
+
|
|
48
|
+
Use:
|
|
49
|
+
```
|
|
50
|
+
sas-score-list-libraries({
|
|
51
|
+
server: "all" | "cas" | "sas", // optional based on user intent
|
|
52
|
+
start: 1,
|
|
53
|
+
limit: 10
|
|
54
|
+
})
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
If user provides server, honor it. If not, use default server behavior.
|
|
58
|
+
|
|
59
|
+
### List tables
|
|
60
|
+
|
|
61
|
+
Required input:
|
|
62
|
+
- library name (`lib`)
|
|
63
|
+
|
|
64
|
+
Use:
|
|
65
|
+
```
|
|
66
|
+
sas-score-list-tables({
|
|
67
|
+
lib: "libraryname",
|
|
68
|
+
server: "cas" | "sas", // optional if strategy/tool supports detection
|
|
69
|
+
start: 1,
|
|
70
|
+
limit: 10
|
|
71
|
+
})
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
If `lib` is missing, ask: "Which library should I list tables from?"
|
|
75
|
+
|
|
76
|
+
### List models
|
|
77
|
+
|
|
78
|
+
Use:
|
|
79
|
+
```
|
|
80
|
+
sas-score-list-models({
|
|
81
|
+
start: 1,
|
|
82
|
+
limit: 10
|
|
83
|
+
})
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### List jobs
|
|
87
|
+
|
|
88
|
+
Use:
|
|
89
|
+
```
|
|
90
|
+
sas-score-list-jobs({
|
|
91
|
+
start: 1,
|
|
92
|
+
limit: 10
|
|
93
|
+
})
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### List jobdefs
|
|
97
|
+
|
|
98
|
+
Use:
|
|
99
|
+
```
|
|
100
|
+
sas-score-list-jobdefs({
|
|
101
|
+
start: 1,
|
|
102
|
+
limit: 10
|
|
103
|
+
})
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Clarifying prompts
|
|
107
|
+
|
|
108
|
+
Ask one focused question if required context is missing:
|
|
109
|
+
- Resource type unclear: "Do you want libraries, tables, models, jobs, or jobdefs?"
|
|
110
|
+
- Listing tables without library: "Which library should I list tables from?"
|
|
111
|
+
|
|
112
|
+
## Output and paging
|
|
113
|
+
|
|
114
|
+
- Return the listed resources from the selected tool.
|
|
115
|
+
- If result count equals `limit`, suggest next page with `start + limit`.
|
|
116
|
+
- Keep using normalized pagination defaults unless user overrides.
|
|
117
|
+
|
|
118
|
+
## Examples
|
|
119
|
+
|
|
120
|
+
- "list jobs" -> `sas-score-list-jobs({ start: 1, limit: 10 })`
|
|
121
|
+
- "list models" -> `sas-score-list-models({ start: 1, limit: 10 })`
|
|
122
|
+
- "list jobdefs" -> `sas-score-list-jobdefs({ start: 1, limit: 10 })`
|
|
123
|
+
- "list tables in Public" -> `sas-score-list-tables({ lib: "Public", start: 1, limit: 10 })`
|
|
124
|
+
- "next jobs" after `{ start: 1, limit: 10 }` -> `sas-score-list-jobs({ start: 11, limit: 10 })`
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sas-list-tables-smart
|
|
3
|
+
description: >
|
|
4
|
+
List all tables in a SAS Viya library with intelligent server detection. When the server is not
|
|
5
|
+
specified, automatically checks CAS first, then SAS if not found. Informs the user if the library
|
|
6
|
+
does not exist in either server. Use this skill when the user wants to browse or explore available
|
|
7
|
+
tables. Trigger phrases include: "list tables in", "show tables in", "what tables are in",
|
|
8
|
+
"browse tables in", "tables in library", "enumerate tables", or any request to explore data sources.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Smart Data Access in SAS Library (List, Read, Query)
|
|
12
|
+
|
|
13
|
+
Intelligently enumerates tables in a SAS Viya library, automatically determining the correct server
|
|
14
|
+
when not explicitly specified.
|
|
15
|
+
|
|
16
|
+
> **Pre-flight check**: Before listing tables, verify the library and table context using the `sas-find-resource-strategy` skill.
|
|
17
|
+
> This ensures consistent server detection across all data operations.
|
|
18
|
+
|
|
19
|
+
**If the user specifies the server explicitly** (e.g., "list tables in Public in cas"):
|
|
20
|
+
- Use the specified server: `server: "cas"` or `server: "sas"`
|
|
21
|
+
- Proceed directly to listing tables
|
|
22
|
+
|
|
23
|
+
**If the server is NOT specified:**
|
|
24
|
+
1. **First attempt**: Check CAS (`server: "cas"`)
|
|
25
|
+
2. **If no tables found in CAS**: Check SAS (`server: "sas"`)
|
|
26
|
+
3. **If no tables found in either**:
|
|
27
|
+
- Inform user: *"The library '<lib>' was not found in CAS or SAS. Please verify the library name is correct."*
|
|
28
|
+
- Ask for corrected library name or explicit server context
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Using sas-score-list-tables
|
|
33
|
+
|
|
34
|
+
**When:**
|
|
35
|
+
- User wants to browse all tables in a library
|
|
36
|
+
- User wants to see what data is available
|
|
37
|
+
- User wants to explore library contents before querying
|
|
38
|
+
|
|
39
|
+
**How:**
|
|
40
|
+
```
|
|
41
|
+
sas-score-list-tables({
|
|
42
|
+
lib: "libraryname", // required
|
|
43
|
+
server: "cas" or "sas", // required; determined by server check
|
|
44
|
+
limit: 10, // optional; default 10, adjust for pagination
|
|
45
|
+
start: 1 // optional; default 1, use for pagination
|
|
46
|
+
})
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**Rules:**
|
|
50
|
+
- Always determine the correct server first (cas → sas → neither)
|
|
51
|
+
- **For SAS server: always uppercase the library name** (e.g., "maps" → "MAPS")
|
|
52
|
+
- If library name is missing, ask: *"Which library should I list tables from?"*
|
|
53
|
+
- Default page size is 10; adjust based on user request ("show me all", "25 tables", etc.)
|
|
54
|
+
- If returned table count equals the limit, suggest pagination: *"There may be more tables. Use `start: {next_offset}` to see more."*
|
|
55
|
+
- If no tables are found despite library existing, report: *"No tables found in {lib} on {server} server."*
|
|
56
|
+
- Return table names only; do not fetch table metadata unless explicitly requested
|
|
57
|
+
- Do not use list tools to determine whether a specific resource exists
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Smart server detection logic
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
IF server specified by user
|
|
65
|
+
→ IF server is "sas"
|
|
66
|
+
→ uppercase lib
|
|
67
|
+
→ use that server
|
|
68
|
+
ELSE
|
|
69
|
+
→ TRY sas-score-list-tables(lib, server="cas")
|
|
70
|
+
IF tables found
|
|
71
|
+
→ success, return tables
|
|
72
|
+
ELSE
|
|
73
|
+
→ uppercase lib
|
|
74
|
+
→ TRY sas-score-list-tables(lib.toUpperCase(), server="sas")
|
|
75
|
+
IF tables found
|
|
76
|
+
→ success, return tables
|
|
77
|
+
ELSE
|
|
78
|
+
→ inform user library not found in either server
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Common patterns
|
|
84
|
+
|
|
85
|
+
**Pattern 1 — List tables, server unspecified**
|
|
86
|
+
> "List tables in Public"
|
|
87
|
+
|
|
88
|
+
1. Try CAS: `sas-score-list-tables({ lib: "Public", server: "cas" })`
|
|
89
|
+
2. If empty, try SAS with uppercase: `sas-score-list-tables({ lib: "PUBLIC", server: "sas" })`
|
|
90
|
+
3. If still empty → inform user
|
|
91
|
+
|
|
92
|
+
**Pattern 2 — List tables with explicit server (SAS)**
|
|
93
|
+
> "List tables in sashelp in sas"
|
|
94
|
+
|
|
95
|
+
1. Skip server detection
|
|
96
|
+
2. Call with uppercase lib: `sas-score-list-tables({ lib: "SASHELP", server: "sas" })`
|
|
97
|
+
|
|
98
|
+
**Pattern 3 — List tables with explicit server (CAS)**
|
|
99
|
+
> "List tables in Public in cas"
|
|
100
|
+
|
|
101
|
+
1. No uppercase needed for CAS
|
|
102
|
+
2. Call: `sas-score-list-tables({ lib: "Public", server: "cas" })`
|
|
103
|
+
|
|
104
|
+
**Pattern 4 — Pagination**
|
|
105
|
+
> "Show me 25 tables in Samples, then the next batch"
|
|
106
|
+
|
|
107
|
+
1. First call: `sas-score-list-tables({ lib: "Samples", limit: 25, start: 1 })`
|
|
108
|
+
2. Next call: `sas-score-list-tables({ lib: "Samples", limit: 25, start: 26 })`
|
|
109
|
+
|
|
110
|
+
**Pattern 5 — Library not found**
|
|
111
|
+
> "List tables in foo"
|
|
112
|
+
|
|
113
|
+
1. Try CAS: empty
|
|
114
|
+
2. Try SAS with uppercase: empty
|
|
115
|
+
3. Response: *"The library 'foo' was not found in CAS or SAS. Please verify the library name."*
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Error handling
|
|
120
|
+
|
|
121
|
+
| Scenario | Action |
|
|
122
|
+
|---|---|
|
|
123
|
+
| Library not found in either server | Inform user and ask to verify library name |
|
|
124
|
+
| Empty result on first server | Automatically check second server |
|
|
125
|
+
| User specifies invalid server | Return error; ask user to clarify: `"cas"` or `"sas"` |
|
|
126
|
+
| Missing library name | Ask: *"Which library should I list tables from?"* |
|
|
127
|
+
| Library verification needed | Use `sas-find-resource-strategy` to verify the library exists first |
|
|
128
|
+
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sas-read-and-score-strategy
|
|
3
|
+
description: >
|
|
4
|
+
Guide the full read → score workflow in SAS Viya: reading records from a table and then scoring
|
|
5
|
+
them with a MAS model (using sas-score-model-score). Use this skill whenever the user wants to score records
|
|
6
|
+
from a table, run a model against query results, predict outcomes for a set of rows, or any
|
|
7
|
+
combination of fetching data and scoring it. Trigger phrases include: "score these records",
|
|
8
|
+
"score results of my query", "run the model on this table", "predict for these customers",
|
|
9
|
+
"fetch and score", "read and score", "score rows from", "run model on table data", or any request
|
|
10
|
+
that combines reading/querying table data with model prediction.
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# SAS Read → Score Workflow
|
|
14
|
+
|
|
15
|
+
Orchestrates the full two-step pattern of reading records from a SAS/CAS table and scoring them
|
|
16
|
+
with a deployed MAS model.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Pre-flight verification
|
|
21
|
+
|
|
22
|
+
**Before attempting to read or score table data:**
|
|
23
|
+
1. **Verify library exists**: Use `sas-find-resource-strategy` for library lookup (CAS first, then SAS if needed)
|
|
24
|
+
2. **Verify table exists**: Use `sas-find-resource-strategy` for table lookup in the selected library/server
|
|
25
|
+
3. **Verify model exists**: Use `sas-find-resource-strategy` for model lookup before scoring
|
|
26
|
+
4. **Confirm server location**: Ensure you know which server (CAS or SAS) contains the data
|
|
27
|
+
|
|
28
|
+
This ensures consistent behavior with other data access operations.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Workflow overview
|
|
33
|
+
|
|
34
|
+
The typical flow involves:
|
|
35
|
+
1. **Fetch data** — Identify which table/query will provide input records
|
|
36
|
+
2. **Validate model** — Confirm the model exists and understand its input schema
|
|
37
|
+
3. **Score** — Invoke the model on the fetched records
|
|
38
|
+
4. **Present results** — Merge predictions with original data and display
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Scenario: User already has data
|
|
43
|
+
|
|
44
|
+
If the user provides scenario data directly (e.g., "Score age=45, income=60000 with model X"):
|
|
45
|
+
- Extract the scenario values
|
|
46
|
+
- Validate against model's input schema
|
|
47
|
+
- Invoke scoring
|
|
48
|
+
- Return prediction
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Scenario: User wants to score table rows
|
|
53
|
+
|
|
54
|
+
If the user specifies a table (e.g., "Score all customers in Public.customers with model X"):
|
|
55
|
+
- Fetch raw rows (possibly filtered: "where status='active'")
|
|
56
|
+
- Validate model compatibility with input columns
|
|
57
|
+
- Invoke scoring on each row
|
|
58
|
+
- Merge results with original data
|
|
59
|
+
- Display combined table
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Scenario: User wants to score query results
|
|
64
|
+
|
|
65
|
+
If the user wants to score aggregated/filtered results (e.g., "Score high-value customers (spend > 5000) with model X"):
|
|
66
|
+
- Determine which records meet criteria (aggregation/filtering)
|
|
67
|
+
- Validate model expects these input columns
|
|
68
|
+
- Invoke scoring
|
|
69
|
+
- Merge predictions with summary data
|
|
70
|
+
- Display results
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Scenario: User unfamiliar with model
|
|
75
|
+
|
|
76
|
+
If the user specifies a model name that's new/unknown:
|
|
77
|
+
- Check if model exists
|
|
78
|
+
- Retrieve model schema (inputs, outputs)
|
|
79
|
+
- Show user what inputs the model expects
|
|
80
|
+
- Confirm before proceeding with scoring
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Rules
|
|
85
|
+
|
|
86
|
+
- Always validate table/library existence before attempting to read
|
|
87
|
+
- Always check model exists before invoking `sas-score-model-score`
|
|
88
|
+
- Match table columns to model input variables; warn on mismatch
|
|
89
|
+
- Use find tools only for resource existence checks; do not use list tools to find resources
|
|
90
|
+
- If multiple records: score batch if possible; fall back to row-by-row
|
|
91
|
+
- Merge predictions with original data using row index or key column
|
|
92
|
+
- Present results as table with original columns + new prediction columns
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Error handling
|
|
97
|
+
|
|
98
|
+
| Problem | Action |
|
|
99
|
+
|---|---|
|
|
100
|
+
| Table not found | Ask for correct lib.tablename |
|
|
101
|
+
| Model not found | Inform user; suggest verifying model name |
|
|
102
|
+
| Field/column mismatch | Show mismatch, ask user to confirm or adjust query |
|
|
103
|
+
| Scoring error | Return structured error, suggest checking model inputs |
|
|
104
|
+
| Empty read result | Inform user, ask if they want to adjust the query/filter |
|
|
105
|
+
| Data type mismatch | Warn user about type conversion, proceed or ask for clarification |
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Integration with other skills
|
|
110
|
+
|
|
111
|
+
- **Before this workflow**: Use `sas-find-resource-strategy` to verify library/table/model resources exist
|
|
112
|
+
- **For data retrieval**: Use `sas-read-strategy` to choose the right read tool (read-table vs sas-query)
|
|
113
|
+
- **For scoring**: Use `sas-score-workflow-strategy` for advanced scoring options beyond MAS models
|