@sassoftware/sas-score-mcp-serverjs 1.0.0 → 1.0.1-10
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/agents/sas-viya-scoring-expert.md → .agents/sas-score-mcp-serverjs-agent.md} +1 -1
- package/{.skills → .instructions}/copilot-instructions.md +56 -2
- package/.instructions/enforce-find-resource-strategy.md +35 -0
- package/.skills/{skills/sas-find-library-smart → sas-find-library-smart}/SKILL.md +10 -9
- package/.skills/sas-find-resource-strategy/SKILL.md +105 -0
- package/.skills/sas-list-resource-strategy/SKILL.md +124 -0
- package/.skills/{skills/sas-list-tables-smart → sas-list-tables-smart}/SKILL.md +4 -3
- package/.skills/{skills/sas-read-and-score → sas-read-and-score-strategy}/SKILL.md +8 -6
- package/.skills/{skills/sas-read-strategy → sas-read-strategy}/SKILL.md +12 -14
- package/.skills/{skills/sas-request-classifier → sas-request-classifier}/SKILL.md +14 -9
- package/.skills/{skills/sas-score-workflow → sas-score-workflow-strategy}/SKILL.md +9 -9
- package/README.md +72 -207
- package/cli.js +58 -75
- package/package.json +7 -5
- package/scripts/setup-skills.js +2 -2
- package/src/oauthHandlers/callback.js +1 -1
- package/src/processHeaders.js +1 -1
- package/src/setupSkills.js +53 -11
- package/src/toolHelpers/_listLibrary.js +1 -1
- package/src/toolHelpers/_listTables.js +1 -1
- package/src/toolSet/.claude/settings.local.json +0 -13
package/{.skills/agents/sas-viya-scoring-expert.md → .agents/sas-score-mcp-serverjs-agent.md}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
2
|
+
name: sas-score-mcp-serverjs-agent
|
|
3
3
|
description: Specialized SAS and Viya agent that classifies requests, selects the right SAS skill, and uses MCP tools safely for jobs, CAS data, libraries, models, scoring, and content workflows.
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -5,6 +5,14 @@ This repository builds and maintains a SAS-focused agent experience on top of an
|
|
|
5
5
|
The MCP server exposes SAS and Viya capabilities such as jobs, code artifacts, CAS server resources, SAS server resources, MAS models, score/scoring assets, and related metadata.
|
|
6
6
|
Your job is to help users complete SAS-related tasks safely and accurately by selecting the right skill first, then using the right MCP tools.
|
|
7
7
|
|
|
8
|
+
## Available Agents
|
|
9
|
+
|
|
10
|
+
This repository includes specialized agents for SAS-focused workflows:
|
|
11
|
+
|
|
12
|
+
- **sas-score-mcp-serverjs-agent** — Specialized for SAS Viya scoring tasks. Classifies requests, selects the right SAS skill, and uses MCP tools safely for jobs, CAS data, libraries, models, scoring, and content workflows.
|
|
13
|
+
- **Explore** — General codebase exploration and Q&A agent. Use for discovering code patterns, reading documentation, or quick exploratory questions.
|
|
14
|
+
|
|
15
|
+
You can invoke these agents using the subagent feature. Type `/subagent` followed by your request or choose an agent from the dropdown when available.
|
|
8
16
|
|
|
9
17
|
## Operating model
|
|
10
18
|
Treat this repository as a domain-specialized SAS agent, not as a generic coding project.
|
|
@@ -98,8 +106,32 @@ Never make up SAS assets, job names, model identifiers, or CAS resources.
|
|
|
98
106
|
If a requested action depends on environment-specific details, verify those details first.
|
|
99
107
|
Prefer inspection and discovery over assumption.
|
|
100
108
|
|
|
109
|
+
---
|
|
110
|
+
# Read TableWorkflow Enforcement (MANDATORY)
|
|
111
|
+
|
|
112
|
+
For any request to read, fetch, or query a table (e.g., score a=1 with model abc", read maps.india", "get rows from lib.table", "show data from ..."), you MUST follow this workflow:
|
|
113
|
+
|
|
114
|
+
Step 1. **Always use the sas-find-resource-strategy**
|
|
115
|
+
|
|
116
|
+
- For tables:
|
|
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.
|
|
127
|
+
|
|
128
|
+
This workflow is mandatory for all table read requests. If you are unsure, always perform the find resource step before reading.
|
|
129
|
+
|
|
130
|
+
See also: `./enforce-find-resource-strategy.md` for details and examples.
|
|
131
|
+
|
|
101
132
|
---
|
|
102
133
|
|
|
134
|
+
|
|
103
135
|
# Available Skills
|
|
104
136
|
|
|
105
137
|
This repository provides specialized skills for SAS-focused workflows. Load the relevant skill for the user's request before using MCP tools.
|
|
@@ -111,6 +143,22 @@ This repository provides specialized skills for SAS-focused workflows. Load the
|
|
|
111
143
|
|
|
112
144
|
**Trigger phrases:** "find my model", "run scoring", "open the table", or any ambiguous request using domain terms.
|
|
113
145
|
|
|
146
|
+
## sas-find-resource-strategy
|
|
147
|
+
**Purpose:** Unified find-only strategy to verify existence of libraries, tables, models, jobs, and jobdefs using find tools.
|
|
148
|
+
|
|
149
|
+
**Use when:** User asks to find, verify, check existence of, or locate a resource.
|
|
150
|
+
|
|
151
|
+
**Trigger phrases:** "find library", "find table", "find model", "find job", "find jobdef", "does X exist".
|
|
152
|
+
|
|
153
|
+
## sas-list-resource-strategy
|
|
154
|
+
**Purpose:** Unified list strategy to list libraries, tables, models, jobs, and jobdefs with normalized pagination.
|
|
155
|
+
|
|
156
|
+
**Use when:** User asks to list, show, browse, or enumerate resources.
|
|
157
|
+
|
|
158
|
+
**Rule:** Always pass non-null `start` and `limit`; default to `start: 1` and `limit: 10` when not provided.
|
|
159
|
+
|
|
160
|
+
**Trigger phrases:** "list libraries", "list tables", "list models", "list jobs", "list jobdefs", "show resources".
|
|
161
|
+
|
|
114
162
|
## sas-find-library-smart
|
|
115
163
|
**Purpose:** Find a SAS Viya library (libref or caslib) with intelligent server detection. Automatically checks CAS first, then SAS if not found.
|
|
116
164
|
|
|
@@ -130,18 +178,24 @@ This repository provides specialized skills for SAS-focused workflows. Load the
|
|
|
130
178
|
|
|
131
179
|
**Use when:** User wants to fetch records from a SAS/CAS table.
|
|
132
180
|
|
|
181
|
+
**Pre-check:** Use `sas-find-resource-strategy` to verify library/table existence first.
|
|
182
|
+
|
|
133
183
|
**Trigger phrases:** "read records from", "get data where", "fetch rows from", "query the table", "give me the first N records", "aggregate by", "join tables".
|
|
134
184
|
|
|
135
|
-
## sas-read-and-score
|
|
185
|
+
## sas-read-and-score-strategy
|
|
136
186
|
**Purpose:** Guide the full read → score workflow in SAS Viya: reading records from a table and then scoring them with a MAS model.
|
|
137
187
|
|
|
138
188
|
**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.
|
|
139
189
|
|
|
190
|
+
**Pre-check:** Use `sas-find-resource-strategy` to verify library/table/model resources first.
|
|
191
|
+
|
|
140
192
|
**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".
|
|
141
193
|
|
|
142
|
-
## sas-score-workflow
|
|
194
|
+
## sas-score-workflow-strategy
|
|
143
195
|
**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.
|
|
144
196
|
|
|
145
197
|
**Use when:** User requests scoring with a model name that may require routing to different execution engines.
|
|
146
198
|
|
|
199
|
+
**Pre-check:** Use `sas-find-resource-strategy` to verify model/job/jobdef resources before execution.
|
|
200
|
+
|
|
147
201
|
**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.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Enforce Find Resource Strategy for Table Reads
|
|
2
|
+
|
|
3
|
+
## Table Read Workflow (Strict)
|
|
4
|
+
|
|
5
|
+
When handling any request to read, fetch, or query a table (e.g., "read maps.india", "get rows from lib.table", "show data from ..."), you MUST:
|
|
6
|
+
|
|
7
|
+
1. **Always use the find resource strategy first:**
|
|
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.
|
|
@@ -13,6 +13,8 @@ description: >
|
|
|
13
13
|
Intelligently locates a SAS Viya library by checking CAS first, then SAS if the library is not found
|
|
14
14
|
in CAS. Provides the user with clear information about library availability and location.
|
|
15
15
|
|
|
16
|
+
> Primary strategy: use `sas-find-resource-strategy` for all resource existence checks.
|
|
17
|
+
|
|
16
18
|
**If the user specifies the server explicitly** (e.g., "find library Public in cas"):
|
|
17
19
|
- Use the specified server: `server: "cas"` or `server: "sas"`
|
|
18
20
|
- Proceed directly to finding the library
|
|
@@ -22,7 +24,7 @@ in CAS. Provides the user with clear information about library availability and
|
|
|
22
24
|
2. **If not found in CAS**: Check SAS with uppercase library name (`server: "sas"`)
|
|
23
25
|
3. **If not found in either**:
|
|
24
26
|
- Inform user: *"The library '<lib>' was not found in CAS or SAS servers. Please verify the library name."*
|
|
25
|
-
|
|
27
|
+
- Ask for corrected library name or explicit server context
|
|
26
28
|
4. **If found**:
|
|
27
29
|
- Inform user which server contains the library: *"Found library '<lib>' in CAS"* or *"Found library '<lib>' in SAS"*
|
|
28
30
|
- Offer next steps: *"Would you like to list tables in this library?"* (suggest `sas-score-list-tables`)
|
|
@@ -50,8 +52,9 @@ sas-score-find-library({
|
|
|
50
52
|
- **For SAS server: always uppercase the library name** (e.g., "public" → "PUBLIC")
|
|
51
53
|
- If library name is missing, ask: *"Which library name would you like to find?"*
|
|
52
54
|
- Return the server where the library was found
|
|
53
|
-
- If not found in either server, clearly inform the user and
|
|
55
|
+
- If not found in either server, clearly inform the user and request corrected name or server context
|
|
54
56
|
- Do not proceed with table access until library existence is confirmed
|
|
57
|
+
- Do not use list tools to find whether a library exists
|
|
55
58
|
|
|
56
59
|
---
|
|
57
60
|
|
|
@@ -73,7 +76,7 @@ ELSE
|
|
|
73
76
|
→ success, inform user: library found in SAS
|
|
74
77
|
ELSE
|
|
75
78
|
→ inform user library not found in either server
|
|
76
|
-
→
|
|
79
|
+
→ ask for corrected name or explicit server
|
|
77
80
|
```
|
|
78
81
|
|
|
79
82
|
---
|
|
@@ -87,7 +90,7 @@ ELSE
|
|
|
87
90
|
2. If not found, try SAS with uppercase: `sas-score-find-library({ name: "PUBLIC", server: "sas" })`
|
|
88
91
|
3. If found in CAS → *"Found library 'Public' in CAS. Would you like to list tables in it?"*
|
|
89
92
|
4. If found in SAS → *"Found library 'PUBLIC' in SAS. Would you like to list tables in it?"*
|
|
90
|
-
5. If not found
|
|
93
|
+
5. If not found -> *"The library 'Public' was not found in CAS or SAS. Please confirm the name or specify a server."*
|
|
91
94
|
|
|
92
95
|
**Pattern 2 — Find library with explicit server (CAS)**
|
|
93
96
|
> "Find library MyData in cas"
|
|
@@ -110,9 +113,7 @@ ELSE
|
|
|
110
113
|
2. Try SAS: `sas-score-find-library({ name: "STAGING", server: "sas" })` → not found
|
|
111
114
|
3. Respond:
|
|
112
115
|
- *"The library 'staging' was not found in CAS or SAS."*
|
|
113
|
-
|
|
114
|
-
- *"List all available libraries? (use `sas-score-list-libraries`))"*
|
|
115
|
-
- *"Check a different library name?"*
|
|
116
|
+
- *"Please confirm the library name or specify the server (CAS or SAS)."*
|
|
116
117
|
|
|
117
118
|
**Pattern 5 — Library found, follow-up action**
|
|
118
119
|
> "Verify library samples exists"
|
|
@@ -141,7 +142,7 @@ Would you like to:
|
|
|
141
142
|
|
|
142
143
|
Suggestions:
|
|
143
144
|
• Check the spelling of the library name
|
|
144
|
-
•
|
|
145
|
+
• Specify the intended server (CAS or SAS)
|
|
145
146
|
• Try a different library name
|
|
146
147
|
```
|
|
147
148
|
|
|
@@ -149,6 +150,6 @@ Suggestions:
|
|
|
149
150
|
|
|
150
151
|
## Integration with other skills
|
|
151
152
|
|
|
153
|
+
- **Primary find strategy**: Use `sas-find-resource-strategy` for existence checks
|
|
152
154
|
- **After finding library → List tables**: Use `sas-list-tables-smart` skill to browse available tables
|
|
153
155
|
- **After finding library → Read data**: Use `sas-read-strategy` skill to retrieve data from tables
|
|
154
|
-
- **Library not found → Explore**: Use `sas-score-list-libraries` tool to see all available libraries
|
|
@@ -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 })`
|
|
@@ -13,7 +13,7 @@ description: >
|
|
|
13
13
|
Intelligently enumerates tables in a SAS Viya library, automatically determining the correct server
|
|
14
14
|
when not explicitly specified.
|
|
15
15
|
|
|
16
|
-
> **Pre-flight check**: Before listing tables, verify the library
|
|
16
|
+
> **Pre-flight check**: Before listing tables, verify the library and table context using the `sas-find-resource-strategy` skill.
|
|
17
17
|
> This ensures consistent server detection across all data operations.
|
|
18
18
|
|
|
19
19
|
**If the user specifies the server explicitly** (e.g., "list tables in Public in cas"):
|
|
@@ -25,7 +25,7 @@ when not explicitly specified.
|
|
|
25
25
|
2. **If no tables found in CAS**: Check SAS (`server: "sas"`)
|
|
26
26
|
3. **If no tables found in either**:
|
|
27
27
|
- Inform user: *"The library '<lib>' was not found in CAS or SAS. Please verify the library name is correct."*
|
|
28
|
-
|
|
28
|
+
- Ask for corrected library name or explicit server context
|
|
29
29
|
|
|
30
30
|
---
|
|
31
31
|
|
|
@@ -54,6 +54,7 @@ sas-score-list-tables({
|
|
|
54
54
|
- If returned table count equals the limit, suggest pagination: *"There may be more tables. Use `start: {next_offset}` to see more."*
|
|
55
55
|
- If no tables are found despite library existing, report: *"No tables found in {lib} on {server} server."*
|
|
56
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
|
|
57
58
|
|
|
58
59
|
---
|
|
59
60
|
|
|
@@ -123,5 +124,5 @@ ELSE
|
|
|
123
124
|
| Empty result on first server | Automatically check second server |
|
|
124
125
|
| User specifies invalid server | Return error; ask user to clarify: `"cas"` or `"sas"` |
|
|
125
126
|
| Missing library name | Ask: *"Which library should I list tables from?"* |
|
|
126
|
-
| Library verification needed | Use `sas-find-
|
|
127
|
+
| Library verification needed | Use `sas-find-resource-strategy` to verify the library exists first |
|
|
127
128
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: sas-read-and-score
|
|
2
|
+
name: sas-read-and-score-strategy
|
|
3
3
|
description: >
|
|
4
4
|
Guide the full read → score workflow in SAS Viya: reading records from a table and then scoring
|
|
5
5
|
them with a MAS model (using sas-score-model-score). Use this skill whenever the user wants to score records
|
|
@@ -20,9 +20,10 @@ with a deployed MAS model.
|
|
|
20
20
|
## Pre-flight verification
|
|
21
21
|
|
|
22
22
|
**Before attempting to read or score table data:**
|
|
23
|
-
1. **Verify library exists**: Use `sas-find-
|
|
24
|
-
2. **Verify table exists**: Use `sas-
|
|
25
|
-
3. **
|
|
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
|
|
26
27
|
|
|
27
28
|
This ensures consistent behavior with other data access operations.
|
|
28
29
|
|
|
@@ -85,6 +86,7 @@ If the user specifies a model name that's new/unknown:
|
|
|
85
86
|
- Always validate table/library existence before attempting to read
|
|
86
87
|
- Always check model exists before invoking `sas-score-model-score`
|
|
87
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
|
|
88
90
|
- If multiple records: score batch if possible; fall back to row-by-row
|
|
89
91
|
- Merge predictions with original data using row index or key column
|
|
90
92
|
- Present results as table with original columns + new prediction columns
|
|
@@ -106,6 +108,6 @@ If the user specifies a model name that's new/unknown:
|
|
|
106
108
|
|
|
107
109
|
## Integration with other skills
|
|
108
110
|
|
|
109
|
-
- **Before this workflow**: Use `sas-find-
|
|
111
|
+
- **Before this workflow**: Use `sas-find-resource-strategy` to verify library/table/model resources exist
|
|
110
112
|
- **For data retrieval**: Use `sas-read-strategy` to choose the right read tool (read-table vs sas-query)
|
|
111
|
-
- **For scoring**: Use `sas-score-workflow` for advanced scoring options beyond MAS models
|
|
113
|
+
- **For scoring**: Use `sas-score-workflow-strategy` for advanced scoring options beyond MAS models
|
|
@@ -15,15 +15,11 @@ of the data operation. Determines which server contains the data and which retri
|
|
|
15
15
|
|
|
16
16
|
## Determine the server location
|
|
17
17
|
|
|
18
|
-
Before retrieving data,
|
|
18
|
+
Before retrieving data, locate the specific table first and determine which server(s) contain it:
|
|
19
19
|
|
|
20
|
-
**Step 1:
|
|
21
|
-
- Use `sas-find-
|
|
22
|
-
-
|
|
23
|
-
- Informs the user which server contains the library
|
|
24
|
-
|
|
25
|
-
**Step 2: Locate the specific table**
|
|
26
|
-
- Use `sas-score-find-table` to check if the table exists in the library
|
|
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
|
|
27
23
|
- Possible outcomes:
|
|
28
24
|
- If table exists **only in CAS** → set `server: "cas"`
|
|
29
25
|
- If table exists **only in SAS** → set `server: "sas"`
|
|
@@ -58,19 +54,21 @@ Ask yourself: does the user already have the data in hand?
|
|
|
58
54
|
sas-score-read-table({
|
|
59
55
|
table: "tablename",
|
|
60
56
|
lib: "libraryname",
|
|
61
|
-
server: "cas" or "sas", // determined from sas-
|
|
57
|
+
server: "cas" or "sas", // determined from table-first lookup via sas-find-resource-strategy
|
|
62
58
|
limit: N, // default 10, adjust based on user request
|
|
63
59
|
where: "..." // optional SQL WHERE clause
|
|
64
60
|
})
|
|
65
61
|
```
|
|
66
62
|
|
|
67
63
|
**Rules:**
|
|
68
|
-
- Always determine the server first using `sas-
|
|
64
|
+
- Always determine the server first using `sas-find-resource-strategy`
|
|
69
65
|
- Keep batch size ≤ 50 rows unless the user explicitly requests more
|
|
70
66
|
- If table name is missing, ask: *"Which table should I read from? (format: lib.tablename)"*
|
|
71
67
|
- If library is missing, ask: *"Which library contains the table?"*
|
|
68
|
+
- Prefer table-first lookup (CAS first, then SAS) instead of a separate library lookup step
|
|
72
69
|
- If table exists in both servers, ask user which to use
|
|
73
70
|
- Return raw column values; do not transform or aggregate
|
|
71
|
+
- Do not use list tools to determine whether a resource exists
|
|
74
72
|
|
|
75
73
|
---
|
|
76
74
|
|
|
@@ -91,7 +89,7 @@ sas-query({
|
|
|
91
89
|
```
|
|
92
90
|
|
|
93
91
|
**Rules:**
|
|
94
|
-
- Check which server(s) contain the table using `sas-
|
|
92
|
+
- Check which server(s) contain the table using `sas-find-resource-strategy` first
|
|
95
93
|
- If table exists in both CAS and SAS, ask user which to query from
|
|
96
94
|
- Parse the user's natural language question into a PROC SQL SELECT statement
|
|
97
95
|
- Ensure SELECT statement is valid SQL syntax
|
|
@@ -129,7 +127,7 @@ sas-query({
|
|
|
129
127
|
|
|
130
128
|
| Problem | Action |
|
|
131
129
|
|---|---|
|
|
132
|
-
| Library
|
|
130
|
+
| Library missing or unclear | Ask the user which library contains the table |
|
|
133
131
|
| Table not found in either server | Inform user and suggest checking the table name |
|
|
134
132
|
| Table exists in both CAS and SAS | Ask: *"The table exists in both servers. Which would you prefer: CAS or SAS?"* |
|
|
135
133
|
| Table exists only in one server | Use that server automatically in your request |
|
|
@@ -141,8 +139,8 @@ sas-query({
|
|
|
141
139
|
|
|
142
140
|
## Integration with other skills
|
|
143
141
|
|
|
144
|
-
- **Before this skill**: Use `sas-find-
|
|
145
|
-
- **After this skill**: Use `sas-read-and-score` to score the retrieved data
|
|
142
|
+
- **Before this skill**: Use `sas-find-resource-strategy` for table-first resource lookup
|
|
143
|
+
- **After this skill**: Use `sas-read-and-score-strategy` to score the retrieved data
|
|
146
144
|
|
|
147
145
|
---
|
|
148
146
|
|
|
@@ -29,11 +29,13 @@ Map the user request to the most likely SAS domain and hand off to the correct d
|
|
|
29
29
|
|
|
30
30
|
## Classification targets
|
|
31
31
|
Classify the request into one or more of these categories:
|
|
32
|
+
- Resource existence lookup (library/table/model/job/jobdef) -> Route to **sas-find-resource-strategy**
|
|
33
|
+
- Resource listing (library/table/model/job/jobdef) -> Route to **sas-list-resource-strategy**
|
|
32
34
|
- Reading or querying tables → Route to **sas-read-strategy**
|
|
33
|
-
- CAS resource, caslib, or table discovery → Route to **sas-find-library-smart**
|
|
34
|
-
- SAS data, libref, or table discovery → Route to **sas-find-library-smart**
|
|
35
|
-
- Score model or scoring artifact → Route to **sas-score-workflow**
|
|
36
|
-
- Read data and score together → Route to **sas-read-and-score**
|
|
35
|
+
- CAS resource, SAS resource, caslib, or table discovery → Route to **sas-find-library-smart**
|
|
36
|
+
- SAS data, libref, or table discovery → Route to **sas-find-library-smart**
|
|
37
|
+
- Score model or scoring artifact → Route to **sas-score-workflow-strategy**
|
|
38
|
+
- Read data and score together → Route to **sas-read-and-score-strategy**
|
|
37
39
|
- SAS job or flow execution
|
|
38
40
|
- SAS code or program analysis
|
|
39
41
|
- General content or metadata lookup
|
|
@@ -45,21 +47,24 @@ Classify the request into one or more of these categories:
|
|
|
45
47
|
3. Decide the most likely SAS domain and matching skill.
|
|
46
48
|
4. If confidence is low, ask one focused clarifying question.
|
|
47
49
|
5. If confidence is high, load and use the relevant skill:
|
|
50
|
+
- **sas-find-resource-strategy** — Unified find-only strategy for library/table/model/job/jobdef
|
|
51
|
+
- **sas-list-resource-strategy** — Unified list strategy for library/table/model/job/jobdef with non-null pagination defaults
|
|
48
52
|
- **sas-find-library-smart** — Find CAS or SAS libraries
|
|
49
53
|
- **sas-list-tables-smart** — Browse tables in a library
|
|
50
54
|
- **sas-read-strategy** — Choose read-table vs. sas-query for data retrieval
|
|
51
|
-
- **sas-read-and-score** — Combine data reading with model scoring
|
|
52
|
-
- **sas-score-workflow** — Route scoring requests to correct execution engine
|
|
55
|
+
- **sas-read-and-score-strategy** — Combine data reading with model scoring
|
|
56
|
+
- **sas-score-workflow-strategy** — Route scoring requests to correct execution engine
|
|
53
57
|
6. Only after classification and skill guidance, use MCP tools.
|
|
54
58
|
|
|
55
59
|
## Disambiguation hints
|
|
56
60
|
- "Run" often implies job execution, but may also mean scoring or model invocation. Check for "score" or "model" context.
|
|
57
61
|
- "Model" may refer to MAS models, SAS jobs, jobdefs, or SCR models. Look for context or type suffix (e.g., `.job`, `.mas`, `.scr`).
|
|
58
62
|
- "Score" may refer to model scoring or job execution. Look for model name or context.
|
|
59
|
-
- "Table" usually suggests CAS
|
|
60
|
-
- "Find"
|
|
63
|
+
- "Table" usually suggests CAS or SAS but confirm library name and server context.
|
|
64
|
+
- "Find" — resource lookup. Route to sas-find-resource-strategy.
|
|
65
|
+
- "List" or "browse" — resource exploration. Route to sas-list-resource-strategy.
|
|
61
66
|
- "Read", "query", "fetch" — data retrieval. Route to sas-read-strategy.
|
|
62
|
-
- "Predict", "score records", "run model on data" — combined workflow. Route to sas-read-and-score
|
|
67
|
+
- "Predict", "score records", "run model on data" — combined workflow. Route to sas-read-and-score-strategy or sas-score-workflow-strategy.
|
|
63
68
|
|
|
64
69
|
## Output
|
|
65
70
|
When you finish classification, state:
|