@sassoftware/sas-score-mcp-serverjs 1.0.1-14 → 1.0.1-16
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/.instructions/copilot-instructions.md +25 -103
- package/.instructions/enforce-find-resource-strategy.md +2 -30
- package/.skills/sas-find-library-smart/SKILL.md +12 -138
- package/.skills/sas-find-resource-strategy/SKILL.md +32 -6
- package/.skills/sas-list-resource-strategy/SKILL.md +6 -0
- package/.skills/sas-list-tables-smart/SKILL.md +14 -112
- package/.skills/sas-read-and-score-strategy/SKILL.md +14 -90
- package/.skills/sas-read-strategy/SKILL.md +14 -142
- package/.skills/sas-request-classifier/SKILL.md +15 -60
- package/.skills/sas-score-workflow-strategy/SKILL.md +1 -8
- package/package.json +1 -1
- package/src/toolSet/modelScore.js +1 -1
|
@@ -33,6 +33,9 @@ Before using SAS MCP tools, classify the request into one of these categories:
|
|
|
33
33
|
|
|
34
34
|
If the request could belong to multiple categories, ask one clarifying question unless lightweight discovery can resolve it safely.
|
|
35
35
|
|
|
36
|
+
## Viya server and library baseline
|
|
37
|
+
Use `sas-find-resource-strategy` as the canonical source for default CAS/SAS library lists and server fallback rules. Reuse a table location once it has already been established in the conversation.
|
|
38
|
+
|
|
36
39
|
## Skill-first behavior
|
|
37
40
|
Before invoking MCP tools, decide whether one or more SAS skills should be used.
|
|
38
41
|
Prefer loading the most relevant SAS skill for the request category.
|
|
@@ -109,115 +112,34 @@ Prefer inspection and discovery over assumption.
|
|
|
109
112
|
---
|
|
110
113
|
# Read TableWorkflow Enforcement (MANDATORY)
|
|
111
114
|
|
|
112
|
-
For any request to read, fetch, or query a table
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
- Use the `sas-find-resource-strategy` skill to locate the table and determine which server (CAS or SAS) contains it.
|
|
118
|
-
- Do not assume the server or skip this step, even if the library or table is commonly found in one server.
|
|
119
|
-
- If the table exists in both, ask the user which server to use.
|
|
120
|
-
- If the table is not found, inform the user and do not attempt to read.
|
|
121
|
-
|
|
122
|
-
Step 2. **Only after confirming the table location:**
|
|
123
|
-
- Use the correct `sas-score-read-table` or `sas-score-sas-query` tool, specifying the server explicitly.
|
|
124
|
-
|
|
125
|
-
3. **If you see a direct read-table/tool call without a prior find step:**
|
|
126
|
-
- Correct the workflow and restart from the find resource step.
|
|
115
|
+
For any request to read, fetch, or query a table:
|
|
116
|
+
1. Use `sas-find-resource-strategy` first to confirm the table and server.
|
|
117
|
+
2. If the table location is already known from earlier context, reuse it.
|
|
118
|
+
3. Then call `sas-score-read-table` or `sas-score-sas-query` with an explicit server.
|
|
119
|
+
4. If a direct read/query call appears without a prior find step, restart from the find step.
|
|
127
120
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
See also: `./enforce-find-resource-strategy.md` for details and examples.
|
|
121
|
+
See also: `./enforce-find-resource-strategy.md`.
|
|
131
122
|
|
|
132
123
|
---
|
|
133
124
|
|
|
134
125
|
# Scoring workflow envforcement (MANDATORY)
|
|
135
126
|
|
|
136
|
-
For any request to score with a model
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
- Do not assume the model exists or skip this step, even if the model name is commonly used.
|
|
142
|
-
- If a table is used as data source for scoring, use the `sas-find-resource-strategy` skill to locate the table and determine which server (CAS or SAS) contains it.
|
|
143
|
-
- Do not assume the server or skip this step, even if the library or table is commonly found in one server.
|
|
144
|
-
- If the table exists in both, ask the user which server to use.
|
|
145
|
-
- If the table is not found, inform the user and do not attempt to read.
|
|
146
|
-
|
|
147
|
-
Step 2. **Only after confirming the table location:**
|
|
148
|
-
- Use the correct `sas-score-read-table` or `sas-score-sas-query` tool, specifying the server explicitly.
|
|
127
|
+
For any request to score with a model:
|
|
128
|
+
1. Use `sas-find-resource-strategy` first for MAS, job, or jobdef models. SCR models do not require a prior existence check.
|
|
129
|
+
2. If table data is involved, resolve the table with `sas-find-resource-strategy` and reuse any previously known location.
|
|
130
|
+
3. Then route to the correct scoring tool for the model type.
|
|
131
|
+
4. If a direct read/query call appears without the find step, restart from the find step.
|
|
149
132
|
|
|
150
|
-
|
|
151
|
-
- Correct the workflow and restart from the find resource step.
|
|
152
|
-
|
|
153
|
-
This workflow is mandatory for all score requests. If you are unsure, always perform the find resource step before scoring.
|
|
133
|
+
This workflow is mandatory for all score requests.
|
|
154
134
|
|
|
155
135
|
---
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
**Trigger phrases:** "find my model", "run scoring", "open the table", or any ambiguous request using domain terms.
|
|
167
|
-
|
|
168
|
-
## sas-find-resource-strategy
|
|
169
|
-
**Purpose:** Unified find-only strategy to verify existence of libraries, tables, models, jobs, and jobdefs using find tools.
|
|
170
|
-
|
|
171
|
-
**Use when:** User asks to find, verify, check existence of, or locate a resource.
|
|
172
|
-
|
|
173
|
-
**Trigger phrases:** "find library", "find table", "find model", "find job", "find jobdef", "does X exist".
|
|
174
|
-
|
|
175
|
-
## sas-list-resource-strategy
|
|
176
|
-
**Purpose:** Unified list strategy to list libraries, tables, models, jobs, and jobdefs with normalized pagination.
|
|
177
|
-
|
|
178
|
-
**Use when:** User asks to list, show, browse, or enumerate resources.
|
|
179
|
-
|
|
180
|
-
**Rule:** Always pass non-null `start` and `limit`; default to `start: 1` and `limit: 10` when not provided.
|
|
181
|
-
|
|
182
|
-
**Trigger phrases:** "list libraries", "list tables", "list models", "list jobs", "list jobdefs", "show resources".
|
|
183
|
-
|
|
184
|
-
## sas-find-library-smart
|
|
185
|
-
**Purpose:** Find a SAS Viya library (libref or caslib) with intelligent server detection. Automatically checks CAS first, then SAS if not found.
|
|
186
|
-
|
|
187
|
-
**Use when:** User needs to verify a library exists, before accessing tables within it.
|
|
188
|
-
|
|
189
|
-
**Trigger phrases:** "find library", "does library exist", "check if library", "locate library", "is there a library named", "verify library".
|
|
190
|
-
|
|
191
|
-
## sas-list-tables-smart
|
|
192
|
-
**Purpose:** List all tables in a SAS Viya library with intelligent server detection. When the server is not specified, automatically checks CAS first, then SAS if not found.
|
|
193
|
-
|
|
194
|
-
**Use when:** User wants to browse or explore available tables.
|
|
195
|
-
|
|
196
|
-
**Trigger phrases:** "list tables in", "show tables in", "what tables are in", "browse tables in", "tables in library", "enumerate tables".
|
|
197
|
-
|
|
198
|
-
## sas-read-strategy
|
|
199
|
-
**Purpose:** Guide the user in choosing the right data retrieval tool: `sas-score-read-table` (for raw row access with filters) or `sas-score-sas-query` (for analytical queries, aggregations, joins).
|
|
200
|
-
|
|
201
|
-
**Use when:** User wants to fetch records from a SAS/CAS table.
|
|
202
|
-
|
|
203
|
-
**Pre-check:** Use `sas-find-resource-strategy` to verify library/table existence first.
|
|
204
|
-
|
|
205
|
-
**Trigger phrases:** "read records from", "get data where", "fetch rows from", "query the table", "give me the first N records", "aggregate by", "join tables".
|
|
206
|
-
|
|
207
|
-
## sas-read-and-score-strategy
|
|
208
|
-
**Purpose:** Guide the full read → score workflow in SAS Viya: reading records from a table and then scoring them with a MAS model.
|
|
209
|
-
|
|
210
|
-
**Use when:** User wants to score records from a table, run a model against query results, predict outcomes for a set of rows, or any combination of fetching data and scoring it.
|
|
211
|
-
|
|
212
|
-
**Pre-check:** Use `sas-find-resource-strategy` to verify library/table/model resources first.
|
|
213
|
-
|
|
214
|
-
**Trigger phrases:** "score these records", "score results of my query", "run the model on this table", "predict for these customers", "fetch and score", "read and score", "score rows from", "run model on table data".
|
|
215
|
-
|
|
216
|
-
## sas-score-workflow-strategy
|
|
217
|
-
**Purpose:** Mandatory routing logic for all scoring requests. Extracts model.type suffix and routes to the correct tool (run-job|run-jobdef|model-score|scr-score|run-program). Handles both MAS models and alternative scoring engines.
|
|
218
|
-
|
|
219
|
-
**Use when:** User requests scoring with a model name that may require routing to different execution engines.
|
|
220
|
-
|
|
221
|
-
**Pre-check:** Use `sas-find-resource-strategy` to verify model/job/jobdef resources before execution.
|
|
222
|
-
|
|
223
|
-
**Trigger phrases:** "score with model X.job", "score X.jobdef scenario", "score with model X.mas", "score with model X.scr", any request with "score" + model name containing a dot (.) + type suffix.
|
|
136
|
+
## Available Skills
|
|
137
|
+
|
|
138
|
+
- `sas-request-classifier` — classify ambiguous SAS/Viya requests
|
|
139
|
+
- `sas-find-resource-strategy` — verify libraries, tables, jobs, jobdefs, and MAS models
|
|
140
|
+
- `sas-list-resource-strategy` — list SAS/Viya resources with pagination
|
|
141
|
+
- `sas-find-library-smart` — library lookup with CAS/SAS fallback
|
|
142
|
+
- `sas-list-tables-smart` — list tables in a library
|
|
143
|
+
- `sas-read-strategy` — choose read-table vs sas-query
|
|
144
|
+
- `sas-read-and-score-strategy` — read data and score it
|
|
145
|
+
- `sas-score-workflow-strategy` — route scoring by model type
|
|
@@ -2,34 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
## Table Read Workflow (Strict)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Use `sas-find-resource-strategy` before any table read or query, then call `sas-score-read-table` or `sas-score-sas-query` with an explicit server. If the table location is already known, reuse it.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- Use the `sas-find-resource-strategy` skill to locate the table and determine which server (CAS or SAS) contains it.
|
|
9
|
-
- Do not assume the server or skip this step, even if the library or table is commonly found in one server.
|
|
10
|
-
- If the table exists in both, ask the user which server to use.
|
|
11
|
-
- If the table is not found, inform the user and do not attempt to read.
|
|
12
|
-
|
|
13
|
-
2. **Only after confirming the table location:**
|
|
14
|
-
- Use the correct `sas-score-read-table` or `sas-score-sas-query` tool, specifying the server explicitly.
|
|
15
|
-
|
|
16
|
-
3. **If you see a direct read-table/tool call without a prior find step:**
|
|
17
|
-
- Correct the workflow and restart from the find resource step.
|
|
18
|
-
|
|
19
|
-
## Example (Correct)
|
|
20
|
-
- User: "read maps.india"
|
|
21
|
-
- Agent:
|
|
22
|
-
1. Use `sas-find-resource-strategy` to check for `maps.india` in CAS, then SAS.
|
|
23
|
-
2. If found in SAS only, call `sas-score-read-table` with `server: 'sas'`.
|
|
24
|
-
|
|
25
|
-
## Example (Incorrect)
|
|
26
|
-
- User: "read maps.india"
|
|
27
|
-
- Agent: Calls `sas-score-read-table` with no server or with default server without checking table location first.
|
|
28
|
-
|
|
29
|
-
## Enforcement
|
|
30
|
-
- This workflow is mandatory for all table read requests.
|
|
31
|
-
- If you are unsure, always perform the find resource step before reading.
|
|
32
|
-
|
|
33
|
-
---
|
|
34
|
-
|
|
35
|
-
Add this section to your always-on agent instructions or as a dedicated enforcement section for table read workflows.
|
|
7
|
+
This file is the compact version of the mandatory table-read rule referenced from the main instructions.
|
|
@@ -10,146 +10,20 @@ description: >
|
|
|
10
10
|
|
|
11
11
|
# Smart Library Lookup (Find Library)
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
in CAS. Provides the user with clear information about library availability and location.
|
|
13
|
+
Use `sas-find-resource-strategy` as the canonical existence check for libraries.
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
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
|
-
---
|
|
15
|
+
## Behavior
|
|
16
|
+
- If the server is explicit, use it.
|
|
17
|
+
- If the server is omitted, follow the canonical CAS-first, then SAS fallback.
|
|
18
|
+
- For SAS, uppercase the library name.
|
|
19
|
+
- If found, report the server and offer table listing.
|
|
20
|
+
- If not found, ask for a corrected name or explicit server.
|
|
33
21
|
|
|
34
22
|
## Using sas-score-find-library
|
|
23
|
+
- Use when the user wants to verify a library exists or confirm which server contains it.
|
|
24
|
+
- Do not use list tools to check existence.
|
|
35
25
|
|
|
36
|
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
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
|
|
26
|
+
## Integration
|
|
27
|
+
- After finding a library, use `sas-list-tables-smart` to browse tables.
|
|
28
|
+
- After finding a library, use `sas-read-strategy` to read from a table in it.
|
|
152
29
|
|
|
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
|
|
@@ -13,6 +13,29 @@ Use this skill to verify resource existence without using list tools.
|
|
|
13
13
|
|
|
14
14
|
## Scope
|
|
15
15
|
|
|
16
|
+
Viya server baseline:
|
|
17
|
+
- CAS and SAS are the two servers.
|
|
18
|
+
|
|
19
|
+
Known default SAS libraries:
|
|
20
|
+
- MAPS
|
|
21
|
+
- MAPSGFK
|
|
22
|
+
- MAPSSAS
|
|
23
|
+
- SASDQREF
|
|
24
|
+
- SASHELP
|
|
25
|
+
- SASUSER
|
|
26
|
+
- WORK
|
|
27
|
+
|
|
28
|
+
Known default CAS libraries:
|
|
29
|
+
- Casuser
|
|
30
|
+
- Formats
|
|
31
|
+
- ModelPerformanceData
|
|
32
|
+
- Models
|
|
33
|
+
- Public
|
|
34
|
+
- Samples
|
|
35
|
+
- SystemData
|
|
36
|
+
|
|
37
|
+
Users can define additional libraries on CAS and SAS.
|
|
38
|
+
|
|
16
39
|
Supported resource types:
|
|
17
40
|
- library
|
|
18
41
|
- table
|
|
@@ -48,9 +71,10 @@ If server is provided:
|
|
|
48
71
|
- SAS: uppercase first, then `sas-score-find-library({ name: "<LIB>", server: "sas" })`
|
|
49
72
|
|
|
50
73
|
If server is not provided:
|
|
51
|
-
1.
|
|
52
|
-
2.
|
|
53
|
-
3.
|
|
74
|
+
1. If library location is already known from earlier conversation or if the library is one of the default libraries, reuse that known server and do not re-check.
|
|
75
|
+
2. Check CAS first - `sas-score-find-library({ name: "<lib>", server: "cas" })`
|
|
76
|
+
3. If not found, check SAS with uppercase library name - `sas-score-find-library({ name: "<LIB>", server: "sas" })`
|
|
77
|
+
4. Report where found, or report not found in either.
|
|
54
78
|
|
|
55
79
|
### Find table
|
|
56
80
|
|
|
@@ -63,9 +87,11 @@ If server is provided:
|
|
|
63
87
|
- SAS: uppercase library first, then `sas-score-find-table({ lib: "<LIB>", name: "<table>", server: "sas" })`
|
|
64
88
|
|
|
65
89
|
If server is not provided:
|
|
66
|
-
1.
|
|
67
|
-
2. If
|
|
68
|
-
3. If
|
|
90
|
+
1. If table location is already known from earlier conversation context, reuse that known server and do not re-check.
|
|
91
|
+
2. If `lib.table` uses a known default CAS library, check CAS first.
|
|
92
|
+
3. If `lib.table` uses a known default SAS library, check SAS first (uppercase library).
|
|
93
|
+
4. If library is unknown (not in known defaults), check CAS first, then SAS (uppercase library).
|
|
94
|
+
5. If found in both, report both and ask user which server to use for follow-up reads.
|
|
69
95
|
|
|
70
96
|
### Find models by type
|
|
71
97
|
|
|
@@ -79,6 +79,12 @@ sas-score-list-tables({
|
|
|
79
79
|
})
|
|
80
80
|
```
|
|
81
81
|
|
|
82
|
+
Table server inference when server is not provided:
|
|
83
|
+
- If library is a known default CAS library (Casuser, Formats, ModelPerformanceData, Models, Public, Samples, SystemData), use `server: "cas"` first.
|
|
84
|
+
- If library is a known default SAS library (MAPS, MAPSGFK, MAPSSAS, SASDQREF, SASHELP, SASUSER, WORK), use `server: "sas"` first.
|
|
85
|
+
- If library is unknown, check CAS first, then SAS.
|
|
86
|
+
- If table location is already known from earlier requests, reuse that known server.
|
|
87
|
+
|
|
82
88
|
If `lib` is missing, ask: "Which library should I list tables from?"
|
|
83
89
|
|
|
84
90
|
### List models
|
|
@@ -8,121 +8,23 @@ description: >
|
|
|
8
8
|
"browse tables in", "tables in library", "enumerate tables", or any request to explore data sources.
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
# Smart Data Access in SAS Library (List
|
|
11
|
+
# Smart Data Access in SAS Library (List Tables)
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
when not explicitly specified.
|
|
13
|
+
Use `sas-find-resource-strategy` to resolve the library and server, then call `sas-score-list-tables` with an explicit server.
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
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
|
-
---
|
|
15
|
+
## Behavior
|
|
16
|
+
- If the server is explicit, honor it.
|
|
17
|
+
- If the server is omitted, rely on the canonical CAS-first, then SAS fallback.
|
|
18
|
+
- For SAS, uppercase the library name.
|
|
19
|
+
- If the library is already known from earlier context, reuse it.
|
|
20
|
+
- If no tables are found, inform the user and ask for a corrected library or server.
|
|
21
|
+
- Do not use list tools to check whether a library exists.
|
|
31
22
|
|
|
32
23
|
## Using sas-score-list-tables
|
|
24
|
+
- Use when the user wants to browse or enumerate tables in a library.
|
|
25
|
+
- Keep page size small unless the user asks for more.
|
|
33
26
|
|
|
34
|
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
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 |
|
|
27
|
+
## Integration
|
|
28
|
+
- Use `sas-find-resource-strategy` for resource existence checks.
|
|
29
|
+
- Use `sas-read-strategy` after listing tables if the user wants rows.
|
|
128
30
|
|
|
@@ -12,99 +12,23 @@ description: >
|
|
|
12
12
|
|
|
13
13
|
# SAS Read → Score Workflow
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
with a deployed MAS model.
|
|
15
|
+
Use `sas-find-resource-strategy` to verify resources and server location before reading or scoring. Reuse any table location already established earlier in the conversation. SCR models do not require a prior existence check.
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
1. **Verify table exists**: Use `sas-find-resource-strategy` to confirm the library and table exist before trying to read
|
|
24
|
-
2. **Verify model exists**: Use `sas-find-resource-strategy` to confirm the model exists before scoring, except for SCR models
|
|
25
|
-
3. **Confirm server location**: Ensure you know which server (CAS or SAS) contains the data
|
|
26
|
-
|
|
27
|
-
This ensures consistent behavior with other data access operations.
|
|
28
|
-
|
|
29
|
-
---
|
|
30
|
-
|
|
31
|
-
## Workflow overview
|
|
32
|
-
|
|
33
|
-
The typical flow involves:
|
|
34
|
-
1. **Fetch data** — Identify which table/query will provide input records
|
|
35
|
-
2. **Validate model** — Confirm the model exists and understand its input schema
|
|
36
|
-
3. **Score** — Invoke the model on the fetched records
|
|
37
|
-
4. **Present results** — Merge predictions with original data and display
|
|
38
|
-
|
|
39
|
-
---
|
|
40
|
-
|
|
41
|
-
## Scenario: User already has data
|
|
42
|
-
|
|
43
|
-
If the user provides scenario data directly (e.g., "Score age=45, income=60000 with model X"):
|
|
44
|
-
- Extract the scenario values and format it as a json object(ex: a=10,b=20 → {"a":10,"b":20})
|
|
45
|
-
- Validate against model's input schema if model is mas or scr.
|
|
46
|
-
- Invoke scoring
|
|
47
|
-
- Return prediction
|
|
48
|
-
|
|
49
|
-
---
|
|
50
|
-
|
|
51
|
-
## Scenario: User wants to score table rows
|
|
52
|
-
|
|
53
|
-
If the user specifies a table (e.g., "Score all customers in Public.customers with model X"):
|
|
54
|
-
- Verify table exists using `sas-find-resource-strategy`
|
|
55
|
-
- Fetch raw rows (possibly filtered: "where status='active'")
|
|
56
|
-
- Invoke scoring on each row
|
|
57
|
-
- Merge results with original data
|
|
58
|
-
- Display combined table
|
|
59
|
-
|
|
60
|
-
---
|
|
61
|
-
|
|
62
|
-
## Scenario: User wants to score query results
|
|
63
|
-
|
|
64
|
-
If the user wants to score aggregated/filtered results (e.g., "Score high-value customers (spend > 5000) with model X"):
|
|
65
|
-
- Determine which records meet criteria (aggregation/filtering)
|
|
66
|
-
- Invoke scoring
|
|
67
|
-
- Merge predictions with summary data
|
|
68
|
-
- Display results
|
|
69
|
-
|
|
70
|
-
---
|
|
71
|
-
|
|
72
|
-
## Scenario: User unfamiliar with model
|
|
73
|
-
|
|
74
|
-
If the user specifies a model name that's new/unknown:
|
|
75
|
-
- Check if model exists
|
|
76
|
-
- Retrieve model schema (inputs, outputs)
|
|
77
|
-
- Show user what inputs the model expects
|
|
78
|
-
- Confirm before proceeding with scoring
|
|
79
|
-
|
|
80
|
-
---
|
|
17
|
+
## Workflow
|
|
18
|
+
1. Read rows with `sas-read-strategy`.
|
|
19
|
+
2. Validate the model or scoring target with `sas-find-resource-strategy` when required.
|
|
20
|
+
3. Score the records with the appropriate scoring tool.
|
|
21
|
+
4. Merge predictions back with the input rows.
|
|
81
22
|
|
|
82
23
|
## Rules
|
|
83
|
-
|
|
84
|
-
-
|
|
85
|
-
-
|
|
86
|
-
- Use find tools only for resource existence checks; do not use list tools to find resources
|
|
87
|
-
- If multiple records: score batch if possible; fall back to row-by-row
|
|
88
|
-
- Merge predictions with original data using row index or key column
|
|
89
|
-
- Present results as table with original columns + new prediction columns
|
|
90
|
-
|
|
91
|
-
---
|
|
24
|
+
- If the user already has scenario data, skip the read step.
|
|
25
|
+
- If column names do not match model inputs, ask for a mapping.
|
|
26
|
+
- Return raw field values plus prediction fields.
|
|
92
27
|
|
|
93
28
|
## Error handling
|
|
29
|
+
- Table not found -> ask for correct lib.table
|
|
30
|
+
- Model not found -> ask the user to verify the model name
|
|
31
|
+
- Empty result -> ask whether to adjust the filter
|
|
94
32
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
| Table not found | Ask for correct lib.tablename |
|
|
98
|
-
| Model not found | Inform user; suggest verifying model name |
|
|
99
|
-
| Field/column mismatch | Show mismatch, ask user to confirm or adjust query |
|
|
100
|
-
| Scoring error | Return structured error, suggest checking model inputs |
|
|
101
|
-
| Empty read result | Inform user, ask if they want to adjust the query/filter |
|
|
102
|
-
| Data type mismatch | Warn user about type conversion, proceed or ask for clarification |
|
|
103
|
-
|
|
104
|
-
---
|
|
105
|
-
|
|
106
|
-
## Integration with other skills
|
|
107
|
-
|
|
108
|
-
- **Before this workflow**: Use `sas-find-resource-strategy` to verify table/model resources exist
|
|
109
|
-
- **For data retrieval**: Use `sas-read-strategy` to choose the right read tool (read-table vs sas-query)
|
|
110
|
-
- **For scoring**: Use `sas-score-workflow-strategy` for advanced scoring options beyond MAS models
|
|
33
|
+
## Integration
|
|
34
|
+
- Use `sas-score-workflow-strategy` for advanced scoring routes.
|
|
@@ -10,152 +10,24 @@ description: >
|
|
|
10
10
|
|
|
11
11
|
# SAS Read Strategy
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
of the data operation. Determines which server contains the data and which retrieval tool is most appropriate.
|
|
13
|
+
Use `sas-find-resource-strategy` to confirm the table and server before reading. Reuse any location already established earlier in the conversation.
|
|
15
14
|
|
|
16
|
-
##
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
**Step 1: Locate the specific table (table-first)**
|
|
21
|
-
- Use `sas-find-resource-strategy` to check if the table exists in CAS first, then SAS if needed
|
|
22
|
-
- Do not perform a separate library-first lookup; table lookup already handles server-aware discovery
|
|
23
|
-
- Do not use list tools for existence checks; rely on find tools to determine if the resource exists and where it exists.
|
|
24
|
-
- Possible outcomes:
|
|
25
|
-
- If table exists **only in CAS** → set `server: "cas"`
|
|
26
|
-
- If table exists **only in SAS** → set `server: "sas"`
|
|
27
|
-
- If table exists **in both** → ask the user: *"The table exists in both CAS and SAS. Which server would you prefer to query from?"*
|
|
28
|
-
- If table exists **in neither** → inform user and suggest verifying the table name
|
|
29
|
-
|
|
30
|
-
---
|
|
31
|
-
|
|
32
|
-
## Determine the read strategy
|
|
33
|
-
|
|
34
|
-
Ask yourself: does the user already have the data in hand?
|
|
35
|
-
|
|
36
|
-
- **Yes (user pasted values, or data is already in context)** → skip this strategy; data is ready to use.
|
|
37
|
-
- **No** → choose the read tool based on intent:
|
|
38
|
-
|
|
39
|
-
| User's Intent | Tool | Example |
|
|
40
|
-
|---|---|---|
|
|
41
|
-
| Get specific raw rows, apply simple filter, retrieve first N records | `sas-score-read-table` | "Show me 10 rows from customers where status='active'" |
|
|
42
|
-
| Aggregate/summarize, calculate, join tables, analytical question | `sas-score-sas-query` | "Average salary by department", "Count orders by region" |
|
|
43
|
-
|
|
44
|
-
---
|
|
15
|
+
## Choose the tool
|
|
16
|
+
- Raw rows, simple filters, or pagination -> `sas-score-read-table`
|
|
17
|
+
- Aggregations, joins, calculations, or analytical questions -> `sas-score-sas-query`
|
|
45
18
|
|
|
46
19
|
## Using read-table
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
- Pagination needed ("first 50 rows", "next 10 rows")
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
**How:**
|
|
55
|
-
|
|
56
|
-
Step 1: Determine
|
|
57
|
-
```
|
|
58
|
-
sas-score-read-table({
|
|
59
|
-
table: "tablename",
|
|
60
|
-
lib: "libraryname",
|
|
61
|
-
server: "cas" or "sas", // determined from table-first lookup via sas-find-resource-strategy
|
|
62
|
-
limit: N, // default 10, adjust based on user request
|
|
63
|
-
where: "..." // optional SQL WHERE clause
|
|
64
|
-
})
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
**Rules:**
|
|
68
|
-
- Always determine the server first using `sas-find-resource-strategy`
|
|
69
|
-
- Keep batch size ≤ 50 rows unless the user explicitly requests more
|
|
70
|
-
- If table name is missing, ask: *"Which table should I read from? (format: lib.tablename)"*
|
|
71
|
-
- If library is missing, ask: *"Which library contains the table?"*
|
|
72
|
-
- Prefer table-first lookup (CAS first, then SAS) instead of a separate library lookup step
|
|
73
|
-
- If table exists in both servers, ask user which to use
|
|
74
|
-
- Return raw column values; do not transform or aggregate
|
|
75
|
-
- Do not use list tools to determine whether a resource exists
|
|
76
|
-
|
|
77
|
-
---
|
|
20
|
+
- Ask for `lib.table` if the table name is missing.
|
|
21
|
+
- Ask for the library if only the table name is known.
|
|
22
|
+
- Keep batch size at 50 rows or less unless the user asks for more.
|
|
23
|
+
- Return raw values only.
|
|
78
24
|
|
|
79
25
|
## Using sas-query
|
|
26
|
+
- Parse the request into valid SQL without a trailing semicolon.
|
|
27
|
+
- Ask whether the user wants raw rows or a summary if intent is unclear.
|
|
28
|
+
- Reuse the known server location.
|
|
80
29
|
|
|
81
|
-
|
|
82
|
-
-
|
|
83
|
-
-
|
|
84
|
-
- User's question is phrased analytically ("compare", "analyze", "breakdown", "trend")
|
|
85
|
-
|
|
86
|
-
**How:**
|
|
87
|
-
1. Use `sas-find-resource-strategy` to check if the table exists in CAS first, then SAS if needed
|
|
88
|
-
2. If table does not exist inform the user and suggest verifying the table name
|
|
89
|
-
3. If table exists run the sas-query tool with the appropriate server and a generated SQL statement based on the user's natural language question. For example:
|
|
90
|
-
```
|
|
91
|
-
sas-query({
|
|
92
|
-
table: "lib.tablename",
|
|
93
|
-
query: "user's natural language question",
|
|
94
|
-
sql: "SELECT ... FROM ... WHERE ... GROUP BY ..." // generated from query
|
|
95
|
-
})
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
**Rules:**
|
|
99
|
-
- Check which server(s) contain the table using `sas-find-resource-strategy` first
|
|
100
|
-
- If table exists in both CAS and SAS, ask user which to query from
|
|
101
|
-
- Parse the user's natural language question into a PROC SQL SELECT statement
|
|
102
|
-
- Ensure SELECT statement is valid SQL syntax
|
|
103
|
-
- Do not add trailing semicolons to the SQL string
|
|
104
|
-
- If table name is missing, ask: *"Which table should I query? (format: lib.tablename)"*
|
|
105
|
-
- If the intent is unclear, ask for clarification: *"Do you want raw rows, or an aggregated summary?"*
|
|
106
|
-
|
|
107
|
-
---
|
|
108
|
-
|
|
109
|
-
## Common patterns
|
|
110
|
-
|
|
111
|
-
**Pattern A — Raw row retrieval**
|
|
112
|
-
> "Show me the first 5 rows from Public.customers"
|
|
113
|
-
|
|
114
|
-
→ `sas-score-read-table({ table: "customers", lib: "Public", limit: 5 })`
|
|
115
|
-
|
|
116
|
-
**Pattern B — Filtered retrieval**
|
|
117
|
-
> "Get all high-value orders (amount > 5000) from mylib.orders"
|
|
118
|
-
|
|
119
|
-
→ `sas-score-read-table({ table: "orders", lib: "mylib", where: "amount > 5000" })`
|
|
120
|
-
|
|
121
|
-
**Pattern C — Aggregation**
|
|
122
|
-
> "What is the average price by make in Public.cars?"
|
|
123
|
-
|
|
124
|
-
→ `sas-score-sas-query({ table: "Public.cars", query: "average price by make", sql: "SELECT make, AVG(msrp) AS avg_price FROM Public.cars GROUP BY make" })`
|
|
125
|
-
|
|
126
|
-
**Pattern D — Join + analysis**
|
|
127
|
-
> "Show me total sales by customer in the sales and customers tables"
|
|
128
|
-
|
|
129
|
-
→ `sas-score-sas-query()` with a JOIN in the generated SQL
|
|
130
|
-
|
|
131
|
-
---
|
|
132
|
-
|
|
133
|
-
## Error handling
|
|
134
|
-
|
|
135
|
-
| Problem | Action |
|
|
136
|
-
|---|---|
|
|
137
|
-
| Library missing or unclear | Ask the user which library contains the table |
|
|
138
|
-
| Table not found in either server | Inform user and suggest checking the table name |
|
|
139
|
-
| Table exists in both CAS and SAS | Ask: *"The table exists in both servers. Which would you prefer: CAS or SAS?"* |
|
|
140
|
-
| Table exists only in one server | Use that server automatically in your request |
|
|
141
|
-
| Table name missing entirely | Ask: *"Which table should I read from?"* |
|
|
142
|
-
| Ambiguous intent (raw vs aggregate) | Ask: *"Do you want individual rows or a summary by some field?"* |
|
|
143
|
-
| Empty result | Inform user, ask to adjust filter or query |
|
|
144
|
-
|
|
145
|
-
---
|
|
146
|
-
|
|
147
|
-
## Integration with other skills
|
|
148
|
-
|
|
149
|
-
- **Before this skill**: Use `sas-find-resource-strategy` for table-first resource lookup
|
|
150
|
-
- **After this skill**: Use `sas-read-and-score-strategy` to score the retrieved data
|
|
151
|
-
|
|
152
|
-
---
|
|
153
|
-
|
|
154
|
-
## Next steps
|
|
30
|
+
## Integration
|
|
31
|
+
- Use `sas-find-resource-strategy` before this skill.
|
|
32
|
+
- Use `sas-read-and-score-strategy` when fetched rows must be scored.
|
|
155
33
|
|
|
156
|
-
Once data is retrieved, typical follow-ups include:
|
|
157
|
-
- **Visualize** — present as table or chart
|
|
158
|
-
- **Export** — format and offer download
|
|
159
|
-
- **Analyze further** — ask clarifying questions
|
|
160
|
-
- **Score** — run predictions on the data
|
|
161
|
-
- **Combine** — join with other datasets
|
|
@@ -5,71 +5,26 @@ description: Classify ambiguous SAS or Viya requests before using MCP tools. Use
|
|
|
5
5
|
|
|
6
6
|
# SAS Request Classifier
|
|
7
7
|
|
|
8
|
-
Use this skill to
|
|
8
|
+
Use this skill to map an ambiguous SAS/Viya request to the most likely downstream skill.
|
|
9
9
|
|
|
10
10
|
## When to use
|
|
11
|
-
Use this skill when the request contains ambiguous
|
|
12
|
-
- model
|
|
13
|
-
- mas
|
|
14
|
-
- score
|
|
15
|
-
- scoring
|
|
16
|
-
- read
|
|
17
|
-
- query
|
|
18
|
-
- job
|
|
19
|
-
- jobdef
|
|
20
|
-
- code
|
|
21
|
-
- table
|
|
22
|
-
- content
|
|
23
|
-
- asset
|
|
24
|
-
- resource
|
|
25
|
-
|
|
26
|
-
Use this skill before any execution-oriented tool call if there is a chance the request is referring to the wrong SAS domain.
|
|
27
|
-
|
|
28
|
-
## Goal
|
|
29
|
-
Map the user request to the most likely SAS domain and hand off to the correct downstream skill or tool path.
|
|
11
|
+
Use this skill when the request contains ambiguous terms such as model, score, read, query, job, jobdef, code, table, content, asset, or resource.
|
|
30
12
|
|
|
31
13
|
## Classification targets
|
|
32
|
-
|
|
33
|
-
- Resource
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
- SAS job or flow execution
|
|
41
|
-
- SAS code or program analysis
|
|
42
|
-
- General content or metadata lookup
|
|
43
|
-
- Environment, auth, or connectivity issue
|
|
44
|
-
|
|
45
|
-
## Procedure
|
|
46
|
-
1. Read the request and identify ambiguous nouns and verbs.
|
|
47
|
-
2. Infer whether the request is asking to discover, inspect, execute, deploy, score, compare, or troubleshoot.
|
|
48
|
-
3. Decide the most likely SAS domain and matching skill.
|
|
49
|
-
4. If confidence is low, ask one focused clarifying question.
|
|
50
|
-
5. If confidence is high, load and use the relevant skill:
|
|
51
|
-
- **sas-find-resource-strategy** — Unified find-only strategy for library/table/mas/job/jobdef, where "model" may mean mas, job, or jobdef
|
|
52
|
-
- **sas-list-resource-strategy** — Unified list strategy for library/table/mas/job/jobdef, where "model" may mean mas, job, or jobdef, with non-null pagination defaults
|
|
53
|
-
- **sas-find-library-smart** — Find CAS or SAS libraries
|
|
54
|
-
- **sas-list-tables-smart** — List tables in a library
|
|
55
|
-
- **sas-read-strategy** — Choose read-table vs. sas-query for data retrieval
|
|
56
|
-
- **sas-read-and-score-strategy** — Combine data reading with model scoring
|
|
57
|
-
- **sas-score-workflow-strategy** — Route scoring requests to correct execution engine
|
|
58
|
-
6. Only after classification and skill guidance, use MCP tools.
|
|
14
|
+
- Resource existence lookup -> sas-find-resource-strategy
|
|
15
|
+
- Resource listing -> sas-list-resource-strategy
|
|
16
|
+
- Reading or querying tables -> sas-read-strategy
|
|
17
|
+
- Library/caslib lookup -> sas-find-library-smart
|
|
18
|
+
- Table browsing -> sas-list-tables-smart
|
|
19
|
+
- Read plus score -> sas-read-and-score-strategy
|
|
20
|
+
- Scoring or score artifacts -> sas-score-workflow-strategy
|
|
21
|
+
- Job or flow execution, code analysis, content lookup, environment issues -> clarify or use the most relevant SAS workflow
|
|
59
22
|
|
|
60
23
|
## Disambiguation hints
|
|
61
|
-
- "
|
|
62
|
-
- "
|
|
63
|
-
- "
|
|
64
|
-
-
|
|
65
|
-
- "Find" — resource lookup. Route to sas-find-resource-strategy.
|
|
66
|
-
- "List" or "browse" — resource exploration. Route to sas-list-resource-strategy.
|
|
67
|
-
- "Read", "query", "fetch" — data retrieval. Route to sas-read-strategy.
|
|
68
|
-
- "Predict", "score records", "run model on data" — combined workflow. Route to sas-read-and-score-strategy or sas-score-workflow-strategy.
|
|
24
|
+
- "model" can mean MAS, job, or jobdef depending on context.
|
|
25
|
+
- "score" can mean scoring or job execution.
|
|
26
|
+
- "table" can be CAS or SAS; use server-aware find logic.
|
|
27
|
+
- Reuse a table location already established earlier in the conversation.
|
|
69
28
|
|
|
70
29
|
## Output
|
|
71
|
-
|
|
72
|
-
- the inferred SAS domain
|
|
73
|
-
- the confidence level
|
|
74
|
-
- the relevant skill(s) to load
|
|
75
|
-
- any remaining ambiguity or clarifying questions needed
|
|
30
|
+
State the inferred SAS domain, confidence, relevant skill(s), and any remaining ambiguity.
|
|
@@ -109,7 +109,7 @@ Accepted formats:
|
|
|
109
109
|
|
|
110
110
|
## Integration with other skills
|
|
111
111
|
|
|
112
|
-
- **Before scoring table data**: Use `sas-find-resource-strategy` to verify library/table/model resources, then `sas-read-strategy` to fetch records
|
|
112
|
+
- **Before scoring table data**: Use `sas-find-resource-strategy` to verify library/table/model resources, using known-library server mapping for `lib.table`, CAS-then-SAS fallback for unknown libraries, and prior-known table location reuse; then use `sas-read-strategy` to fetch records
|
|
113
113
|
- **For read + score workflows**: Use `sas-read-and-score-strategy` for the complete end-to-end pattern
|
|
114
114
|
|
|
115
115
|
---
|
|
@@ -306,10 +306,3 @@ Merge the scoring output back with the input records and present as a table wher
|
|
|
306
306
|
- **Confirm mappings:** If column names don't match model inputs, ask before scoring.
|
|
307
307
|
- **Show context:** Include key input columns in the result output so predictions make sense.
|
|
308
308
|
- **Limit output:** For large result sets (>10 rows), ask before showing all.
|
|
309
|
-
|
|
310
|
-
---
|
|
311
|
-
|
|
312
|
-
## Integration with other skills
|
|
313
|
-
|
|
314
|
-
- **Before scoring table data**: Use `sas-find-resource-strategy` to verify resources, then `sas-read-strategy` to fetch records
|
|
315
|
-
- **For read + score workflows**: Use `sas-read-and-score-strategy` for the complete end-to-end pattern
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@ DO NOT USE for: find model, model metadata, list models, run programs/jobs, quer
|
|
|
18
18
|
PARAMETERS
|
|
19
19
|
- model: string — model name (required, exact match)
|
|
20
20
|
- scenario: object — input data as JSON (optional, defaults to {}). Example: {age:45, income:60000}
|
|
21
|
-
- uflag: boolean (
|
|
21
|
+
- uflag: boolean (optional, defaults to false) — prefix model fields with underscore when true
|
|
22
22
|
|
|
23
23
|
ROUTING RULES
|
|
24
24
|
- "score with model X using a=1, b=2" → { model: "X", scenario: {a:1, b:2}, uflag: false }
|