@sassoftware/sas-score-mcp-serverjs 0.4.1-20 → 0.4.1-22

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.
@@ -1,127 +0,0 @@
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 exists using the `sas-find-library-smart` 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: *"Would you like to list available libraries?"* (suggest `sas-score-list-libraries`)
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
-
58
- ---
59
-
60
- ## Smart server detection logic
61
-
62
- ```
63
- IF server specified by user
64
- → IF server is "sas"
65
- → uppercase lib
66
- → use that server
67
- ELSE
68
- → TRY sas-score-list-tables(lib, server="cas")
69
- IF tables found
70
- → success, return tables
71
- ELSE
72
- → uppercase lib
73
- → TRY sas-score-list-tables(lib.toUpperCase(), server="sas")
74
- IF tables found
75
- → success, return tables
76
- ELSE
77
- → inform user library not found in either server
78
- ```
79
-
80
- ---
81
-
82
- ## Common patterns
83
-
84
- **Pattern 1 — List tables, server unspecified**
85
- > "List tables in Public"
86
-
87
- 1. Try CAS: `sas-score-list-tables({ lib: "Public", server: "cas" })`
88
- 2. If empty, try SAS with uppercase: `sas-score-list-tables({ lib: "PUBLIC", server: "sas" })`
89
- 3. If still empty → inform user
90
-
91
- **Pattern 2 — List tables with explicit server (SAS)**
92
- > "List tables in sashelp in sas"
93
-
94
- 1. Skip server detection
95
- 2. Call with uppercase lib: `sas-score-list-tables({ lib: "SASHELP", server: "sas" })`
96
-
97
- **Pattern 3 — List tables with explicit server (CAS)**
98
- > "List tables in Public in cas"
99
-
100
- 1. No uppercase needed for CAS
101
- 2. Call: `sas-score-list-tables({ lib: "Public", server: "cas" })`
102
-
103
- **Pattern 4 — Pagination**
104
- > "Show me 25 tables in Samples, then the next batch"
105
-
106
- 1. First call: `sas-score-list-tables({ lib: "Samples", limit: 25, start: 1 })`
107
- 2. Next call: `sas-score-list-tables({ lib: "Samples", limit: 25, start: 26 })`
108
-
109
- **Pattern 5 — Library not found**
110
- > "List tables in foo"
111
-
112
- 1. Try CAS: empty
113
- 2. Try SAS with uppercase: empty
114
- 3. Response: *"The library 'foo' was not found in CAS or SAS. Please verify the library name."*
115
-
116
- ---
117
-
118
- ## Error handling
119
-
120
- | Scenario | Action |
121
- |---|---|
122
- | Library not found in either server | Inform user and ask to verify library name |
123
- | Empty result on first server | Automatically check second server |
124
- | User specifies invalid server | Return error; ask user to clarify: `"cas"` or `"sas"` |
125
- | Missing library name | Ask: *"Which library should I list tables from?"* |
126
- | Library verification needed | Use `sas-find-library-smart` skill to verify library exists first |
127
-
@@ -1,111 +0,0 @@
1
- ---
2
- name: sas-read-and-score
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-library-smart` to check the library in CAS first, then SAS if needed
24
- 2. **Verify table exists**: Use `sas-score-find-table` to confirm the table is in the library
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
45
- - Validate against model's input schema
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
- - Fetch raw rows (possibly filtered: "where status='active'")
55
- - Validate model compatibility with input columns
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
- - Validate model expects these input columns
67
- - Invoke scoring
68
- - Merge predictions with summary data
69
- - Display results
70
-
71
- ---
72
-
73
- ## Scenario: User unfamiliar with model
74
-
75
- If the user specifies a model name that's new/unknown:
76
- - Check if model exists
77
- - Retrieve model schema (inputs, outputs)
78
- - Show user what inputs the model expects
79
- - Confirm before proceeding with scoring
80
-
81
- ---
82
-
83
- ## Rules
84
-
85
- - Always validate table/library existence before attempting to read
86
- - Always check model exists before invoking `sas-score-model-score`
87
- - Match table columns to model input variables; warn on mismatch
88
- - If multiple records: score batch if possible; fall back to row-by-row
89
- - Merge predictions with original data using row index or key column
90
- - Present results as table with original columns + new prediction columns
91
-
92
- ---
93
-
94
- ## Error handling
95
-
96
- | Problem | Action |
97
- |---|---|
98
- | Table not found | Ask for correct lib.tablename |
99
- | Model not found | Inform user; suggest verifying model name |
100
- | Field/column mismatch | Show mismatch, ask user to confirm or adjust query |
101
- | Scoring error | Return structured error, suggest checking model inputs |
102
- | Empty read result | Inform user, ask if they want to adjust the query/filter |
103
- | Data type mismatch | Warn user about type conversion, proceed or ask for clarification |
104
-
105
- ---
106
-
107
- ## Integration with other skills
108
-
109
- - **Before this workflow**: Use `sas-find-library-smart` to verify the library exists
110
- - **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
@@ -1,178 +0,0 @@
1
- ---
2
- name: sas-read-strategy
3
- description: >
4
- Guide the user in choosing the right data retrieval tool: sas-score-read-table (for raw row access with filters)
5
- or sas-score-sas-query (for analytical queries, aggregations, joins). Use this skill when the user wants to
6
- fetch records from a SAS/CAS table. Trigger phrases include: "read records from", "get data where",
7
- "fetch rows from", "query the table", "give me the first N records", "aggregate by", "join tables",
8
- or any request that starts with data retrieval.
9
- ---
10
-
11
- # SAS Read Strategy
12
-
13
- Guides the decision between `sas-score-read-table` and `sas-score-sas-query` based on the user's intent and the nature
14
- of the data operation. Determines which server contains the data and which retrieval tool is most appropriate.
15
-
16
- ## Determine the server location
17
-
18
- Before retrieving data, locate the table and determine which server contains it:
19
-
20
- **Smart table lookup with server detection**
21
-
22
- Use `sas-score-find-table` with intelligent server detection:
23
-
24
- 1. **First attempt**: Check CAS server (`server: "cas"`)
25
- - If table exists → return table and server to caller
26
- - If table not found → proceed to step 2
27
-
28
- 2. **Second attempt**: Check SAS server (`server: "sas"`)
29
- - If table exists → return table and server to caller
30
- - If table not found in either server → inform user and suggest verifying the library and table names
31
-
32
- **Possible outcomes:**
33
- - Table found in CAS → use `server: "cas"` for subsequent read operations
34
- - Table found in SAS → use `server: "sas"` for subsequent read operations
35
- - Table not found in either server → inform user: *"The table 'lib.table' was not found in CAS or SAS. Please verify the library and table names."*
36
-
37
- ---
38
-
39
- ## Determine the read strategy
40
-
41
- Ask yourself: does the user already have the data in hand?
42
-
43
- - **Yes (user pasted values, or data is already in context)** → skip this strategy; data is ready to use.
44
- - **No** → choose the read tool based on intent:
45
-
46
- | User's Intent | Tool | Example |
47
- |---|---|---|
48
- | Get specific raw rows, apply simple filter, retrieve first N records | `sas-score-read-table` | "Show me 10 rows from customers where status='active'" |
49
- | Aggregate/summarize, calculate, join tables, analytical question | `sas-score-sas-query` | "Average salary by department", "Count orders by region" |
50
-
51
- ---
52
-
53
- ## Using read-table
54
-
55
- **When:**
56
- - User asks for raw records, row-by-row data
57
- - Simple WHERE filtering (e.g., "where status = 'active'")
58
- - Pagination needed ("first 50 rows", "next 10 rows")
59
-
60
- **How:**
61
- ```
62
- sas-score-find-table({
63
- lib: "libraryname",
64
- table: "tablename",
65
- server: "cas" // start with CAS
66
- })
67
- // if not found, repeat with server: "sas"
68
-
69
- sas-score-read-table({
70
- table: "tablename",
71
- lib: "libraryname",
72
- server: "cas" or "sas", // REQUIRED: determined from sas-score-find-table check
73
- start: 1, // REQUIRED: 1-based row offset (default: 1)
74
- limit: N, // REQUIRED: max rows to retrieve (default: 10, max: 1000)
75
- where: "..." // optional SQL WHERE clause
76
- })
77
- ```
78
-
79
- **Rules:**
80
- - Always determine the server first using `sas-score-find-table` with smart detection (CAS → SAS)
81
- - **ALWAYS set `server` parameter** — never omit it; use the result from `sas-score-find-table` to determine "cas" or "sas"
82
- - **ALWAYS set `start` parameter** — use 1 for the first call, or the offset for pagination
83
- - **ALWAYS set `limit` parameter** — keep batch size ≤ 50 rows unless the user explicitly requests more; cap at 1000
84
- - If table name is missing, ask: *"Which table should I read from? (format: lib.tablename)"*
85
- - If library is missing, ask: *"Which library contains the table?"*
86
- - If table exists in both servers, prefer CAS (already determined by smart detection)
87
- - Return raw column values; do not transform or aggregate
88
-
89
- ---
90
-
91
- ## Using sas-query
92
-
93
- **When:**
94
- - User asks for aggregation (SUM, AVG, COUNT, GROUP BY)
95
- - User asks for joins, calculations, or analytical insights
96
- - User's question is phrased analytically ("compare", "analyze", "breakdown", "trend")
97
-
98
- **How:**
99
- ```
100
- sas-score-find-table({
101
- lib: "libraryname",
102
- table: "tablename",
103
- server: "cas" // start with CAS
104
- })
105
- // if not found, repeat with server: "sas"
106
-
107
- sas-query({
108
- table: "lib.tablename",
109
- query: "user's natural language question",
110
- sql: "SELECT ... FROM ... WHERE ... GROUP BY ..." // generated from query
111
- })
112
- ```
113
-
114
- **Rules:**
115
- - Check which server contains the table using `sas-score-find-table` with smart detection (CAS → SAS) first
116
- - If table exists in CAS, query from CAS; if only in SAS, query from SAS
117
- - Parse the user's natural language question into a PROC SQL SELECT statement
118
- - Ensure SELECT statement is valid SQL syntax
119
- - Do not add trailing semicolons to the SQL string
120
- - If table name is missing, ask: *"Which table should I query? (format: lib.tablename)"*
121
- - If the intent is unclear, ask for clarification: *"Do you want raw rows, or an aggregated summary?"*
122
-
123
- ---
124
-
125
- ## Common patterns
126
-
127
- **Pattern A — Raw row retrieval**
128
- > "Show me the first 5 rows from Public.customers"
129
-
130
- → `sas-score-read-table({ table: "customers", lib: "Public", server: "cas", start: 1, limit: 5 })`
131
-
132
- **Pattern B — Filtered retrieval**
133
- > "Get all high-value orders (amount > 5000) from mylib.orders"
134
-
135
- → `sas-score-read-table({ table: "orders", lib: "mylib", server: "sas", start: 1, limit: 50, where: "amount > 5000" })`
136
-
137
- **Pattern C — Aggregation**
138
- > "What is the average price by make in Public.cars?"
139
-
140
- → `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" })`
141
-
142
- **Pattern D — Join + analysis**
143
- > "Show me total sales by customer in the sales and customers tables"
144
-
145
- → `sas-score-sas-query()` with a JOIN in the generated SQL
146
-
147
- ---
148
-
149
- ## Error handling
150
-
151
- | Problem | Action |
152
- |---|---|
153
- | Table not found in CAS | Try SAS server using `sas-score-find-table` with `server: "sas"` |
154
- | Table not found in either server | Inform user: *"The table 'lib.table' was not found in CAS or SAS. Please verify the library and table names."* |
155
- | Table exists only in CAS | Use `server: "cas"` automatically for read operations |
156
- | Table exists only in SAS | Use `server: "sas"` automatically for read operations |
157
- | Table name missing entirely | Ask: *"Which table should I read from? (format: lib.tablename)"* |
158
- | Library name missing | Ask: *"Which library contains the table?"* |
159
- | Ambiguous intent (raw vs aggregate) | Ask: *"Do you want individual rows or a summary by some field?"* |
160
- | Empty result | Inform user, ask to adjust filter or query |
161
-
162
- ---
163
-
164
- ## Integration with other skills
165
-
166
- - **Before this skill**: Use `sas-score-find-table` to verify the table exists and determine the server location
167
- - **After this skill**: Use `sas-read-and-score` to score the retrieved data
168
-
169
- ---
170
-
171
- ## Next steps
172
-
173
- Once data is retrieved, typical follow-ups include:
174
- - **Visualize** — present as table or chart
175
- - **Export** — format and offer download
176
- - **Analyze further** — ask clarifying questions
177
- - **Score** — run predictions on the data
178
- - **Combine** — join with other datasets