@sassoftware/sas-score-mcp-serverjs 0.4.1-7 → 1.0.0
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 +58 -0
- package/.skills/copilot-instructions.md +147 -0
- package/.skills/skills/sas-find-library-smart/SKILL.md +154 -0
- package/.skills/skills/sas-list-tables-smart/SKILL.md +127 -0
- package/.skills/skills/sas-read-and-score/SKILL.md +111 -0
- package/{skills → .skills/skills}/sas-read-strategy/SKILL.md +43 -30
- package/.skills/skills/sas-request-classifier/SKILL.md +69 -0
- package/{skills → .skills/skills}/sas-score-workflow/SKILL.md +49 -35
- package/cli.js +222 -140
- package/package.json +5 -4
- package/scripts/docs/SCORE_SKILL_REFERENCE.md +142 -0
- package/scripts/docs/TOOL_DESCRIPTION_TEMPLATE.md +157 -0
- package/scripts/docs/TOOL_UPDATES_SUMMARY.md +208 -0
- package/scripts/docs/mcp-localhost-config-guide.md +184 -0
- package/scripts/docs/oauth-http-transport.md +96 -0
- package/scripts/docs/sas-mcp-tools-reference.md +600 -0
- package/scripts/getViyaca.sh +1 -0
- package/scripts/optimize_final.py +140 -0
- package/scripts/optimize_tools.py +99 -0
- package/scripts/setup-skills.js +34 -0
- package/scripts/update_descriptions.py +46 -0
- package/scripts/viyatls.sh +3 -0
- package/src/authpkce.js +219 -220
- package/src/createMcpServer.js +10 -5
- package/src/expressMcpServer.js +54 -186
- package/src/oauthHandlers/authorize.js +46 -0
- package/src/oauthHandlers/baseUrl.js +8 -0
- package/src/oauthHandlers/callback.js +96 -0
- package/src/oauthHandlers/getMetadata.js +27 -0
- package/src/oauthHandlers/index.js +7 -0
- package/src/oauthHandlers/token.js +37 -0
- package/src/processHeaders.js +88 -0
- package/src/setupSkills.js +37 -0
- package/src/toolHelpers/_listLibrary.js +0 -1
- package/src/toolHelpers/getLogonPayload.js +5 -1
- package/src/toolHelpers/refreshToken.js +3 -2
- package/src/toolHelpers/refreshTokenOauth.js +3 -3
- package/src/toolSet/.claude/settings.local.json +2 -1
- package/src/toolSet/findModel.js +1 -1
- package/src/toolSet/findTable.js +3 -3
- package/src/toolSet/modelScore.js +2 -2
- package/src/toolSet/runJob.js +81 -81
- package/src/toolSet/runJobdef.js +82 -82
- package/skills/mcp-tool-description-optimizer/SKILL.md +0 -129
- package/skills/mcp-tool-description-optimizer/references/examples.md +0 -123
- package/skills/sas-read-and-score/SKILL.md +0 -91
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
# Before / After Examples
|
|
2
|
-
|
|
3
|
-
## Example 1 — list-libraries (SAS Viya MCP)
|
|
4
|
-
|
|
5
|
-
### BEFORE (~620 tokens)
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
## list-libraries — enumerate CAS or SAS libraries
|
|
9
|
-
|
|
10
|
-
LLM Invocation Guidance (critical)
|
|
11
|
-
Use THIS tool when the user asks for: "list libs", "list libraries", "show cas libs", "show sas libs",
|
|
12
|
-
"what libraries are available", "list caslib(s)", "enumerate libraries", "libraries in cas", "libraries in sas".
|
|
13
|
-
DO NOT use this tool when the user asks for: tables inside a specific library (choose listTables),
|
|
14
|
-
columns/metadata of a table, job/program execution, models, or scoring.
|
|
15
|
-
|
|
16
|
-
Trigger Phrase → Parameter Mapping
|
|
17
|
-
- "cas libs" / "in cas" / "cas libraries" → { server: 'cas' }
|
|
18
|
-
- "sas libs" / "in sas" / "base sas libraries" → { server: 'sas' }
|
|
19
|
-
- "all libs" / "all libs" -> {server: 'all'}
|
|
20
|
-
→ { server: 'all' }
|
|
21
|
-
- "next" (after prior call) → { start: previous.start + previous.limit }
|
|
22
|
-
- "first 20 cas libs" → { server: 'cas', limit: 20 }
|
|
23
|
-
- If server unspecified: default to all.
|
|
24
|
-
|
|
25
|
-
Parameters
|
|
26
|
-
- server (cas|sas|all, default 'all')
|
|
27
|
-
- limit (integer > 0, default 10)
|
|
28
|
-
- start (1-based offset, default 1)
|
|
29
|
-
- where (optional filter expression, default '')
|
|
30
|
-
|
|
31
|
-
Response Contract
|
|
32
|
-
Return JSON-like structure from helper; consumers may extract an array of library objects/names.
|
|
33
|
-
If number of returned items === limit supply a pagination hint: start = start + limit.
|
|
34
|
-
|
|
35
|
-
Behavior Summary
|
|
36
|
-
- Pure listing; no side effects.
|
|
37
|
-
- If ambiguous short request like "list" or "libs" and no prior context: assume { server: 'cas' }.
|
|
38
|
-
- If user explicitly asks for ALL (e.g. "all cas libs") and count likely large, honor limit=50 unless
|
|
39
|
-
user supplies a value; include note about paging.
|
|
40
|
-
|
|
41
|
-
Disambiguation Rules
|
|
42
|
-
- If user mentions a singular library name plus desire for tables ("list tables in SASHELP") choose
|
|
43
|
-
listTables (not this tool).
|
|
44
|
-
- If user mixes "tables" and "libraries" ask for clarification unless clearly about libraries.
|
|
45
|
-
|
|
46
|
-
Examples
|
|
47
|
-
- "list libraries" → { server: 'all', start:1, limit:10 }
|
|
48
|
-
- "list libs" → { server: 'all', start:1, limit:10 }
|
|
49
|
-
- "list sas libs" → { server: 'sas' }
|
|
50
|
-
- "list cas libraries" → { server: 'cas' }
|
|
51
|
-
- "show me 25 cas libraries" → { server:'cas', limit:25 }
|
|
52
|
-
- "next" (after prior call {start:1,limit:10}) → { start:11, limit:10 }
|
|
53
|
-
- "filter cas libs" (no criterion) → ask: "Provide a filter or continue without one?"
|
|
54
|
-
|
|
55
|
-
Negative Examples (do not route here)
|
|
56
|
-
- "list tables in public" (route to list-tables)
|
|
57
|
-
- "list models, list tables, list jobs, list jobdef and similar request"
|
|
58
|
-
- "describe library" (likely list-tables or table-info depending on follow-up)
|
|
59
|
-
- "run program to make a lib" (run-sas-program tool)
|
|
60
|
-
|
|
61
|
-
Error Handling
|
|
62
|
-
- On backend error: return structured error with message field; do not hallucinate libraries.
|
|
63
|
-
- Empty result set → return empty list plus (if start>1) a hint that paging may have exceeded available items.
|
|
64
|
-
|
|
65
|
-
Rationale
|
|
66
|
-
Concise, signal-rich description increases probability this spec is selected for generic library
|
|
67
|
-
enumeration intents.
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
### AFTER (~210 tokens)
|
|
71
|
-
|
|
72
|
-
```
|
|
73
|
-
list-libraries — enumerate CAS or SAS libraries.
|
|
74
|
-
|
|
75
|
-
USE when: list/show/enumerate libraries, caslibs, sas libs, available libraries
|
|
76
|
-
DO NOT USE for: listing tables in a library (→ list-tables), column/table metadata, job execution, models, scoring
|
|
77
|
-
|
|
78
|
-
PARAMETERS
|
|
79
|
-
- server: 'cas' | 'sas' | 'all' (default: 'all')
|
|
80
|
-
- limit: integer > 0 (default: 10)
|
|
81
|
-
- start: 1-based offset (default: 1)
|
|
82
|
-
- where: optional filter expression (default: '')
|
|
83
|
-
|
|
84
|
-
ROUTING RULES
|
|
85
|
-
- "cas libs / cas libraries / in cas" → { server: 'cas' }
|
|
86
|
-
- "sas libs / sas libraries / in sas" → { server: 'sas' }
|
|
87
|
-
- "all libs / all libraries" → { server: 'all' }
|
|
88
|
-
- "all cas libs" with no limit given → { server: 'cas', limit: 50 } + paging note
|
|
89
|
-
- "next" after prior call (start:S, limit:L) → { start: S + L, limit: L }
|
|
90
|
-
- "filter cas libs" with no filter given → ask: "What filter expression should I apply?"
|
|
91
|
-
- server unspecified / ambiguous "list"/"libs" → { server: 'cas' }
|
|
92
|
-
|
|
93
|
-
EXAMPLES
|
|
94
|
-
- "list libraries" → { server: 'all', start: 1, limit: 10 }
|
|
95
|
-
- "list cas libraries" → { server: 'cas', start: 1, limit: 10 }
|
|
96
|
-
- "show me 25 sas libs" → { server: 'sas', limit: 25, start: 1 }
|
|
97
|
-
- "next" (prev: start:1,limit:10) → { server: <same>, start: 11, limit: 10 }
|
|
98
|
-
|
|
99
|
-
NEGATIVE EXAMPLES (do not route here)
|
|
100
|
-
- "list tables in SASHELP" → list-tables
|
|
101
|
-
- "list models / jobs / jobdefs" → respective tools
|
|
102
|
-
- "run a program to create a lib" → run-sas-program
|
|
103
|
-
|
|
104
|
-
PAGINATION
|
|
105
|
-
If returned count === limit → hint: next start = start + limit.
|
|
106
|
-
If start > 1 and result empty → note paging may exceed available items.
|
|
107
|
-
|
|
108
|
-
ERRORS
|
|
109
|
-
Return structured error with message field. Never hallucinate library names.
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
**Token reduction: ~66%**
|
|
113
|
-
|
|
114
|
-
---
|
|
115
|
-
|
|
116
|
-
## Key patterns illustrated
|
|
117
|
-
|
|
118
|
-
- Trigger phrases consolidated from 3 blocks → 1 ROUTING RULES block
|
|
119
|
-
- "Rationale", "Behavior Summary", "Response Contract" sections eliminated
|
|
120
|
-
- Orphaned `→ { server: 'all' }` arrow removed
|
|
121
|
-
- Parameter defaults made explicit inline
|
|
122
|
-
- Examples trimmed to one line each
|
|
123
|
-
- Negative examples now name the redirect tool explicitly
|
|
@@ -1,91 +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 (using read-table
|
|
5
|
-
or sas-query) and then scoring them with a MAS model (using model-score). Use this skill whenever
|
|
6
|
-
the user wants to score records from a table, run a model against query results, predict outcomes
|
|
7
|
-
for a set of rows, or any combination of fetching data and scoring it. Trigger phrases include:
|
|
8
|
-
"score these records", "score results of my query", "run the model on this table",
|
|
9
|
-
"predict for these customers", "fetch and score", "read and score", "score rows from",
|
|
10
|
-
"run model on table data", or any request that combines reading 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
|
-
This skill chains two sub-skills:
|
|
19
|
-
1. **sas-read-strategy** — Choose between `read-table` and `sas-query`
|
|
20
|
-
2. **sas-score-workflow** — Validate model, invoke scoring, present results
|
|
21
|
-
|
|
22
|
-
---
|
|
23
|
-
|
|
24
|
-
## Quick reference
|
|
25
|
-
|
|
26
|
-
1. **Does the user already have data in hand?**
|
|
27
|
-
- Yes → skip to Step 2 (scoring)
|
|
28
|
-
- No → use `sas-read-strategy` to fetch data
|
|
29
|
-
|
|
30
|
-
2. **Is the model name familiar?**
|
|
31
|
-
- Yes → proceed to score
|
|
32
|
-
- No → pause and use `find-model` / `model-info`
|
|
33
|
-
|
|
34
|
-
3. **Invoke model-score** with the fetched data
|
|
35
|
-
|
|
36
|
-
4. **Merge results** and present as a table
|
|
37
|
-
|
|
38
|
-
---
|
|
39
|
-
|
|
40
|
-
## Common flows
|
|
41
|
-
|
|
42
|
-
**Flow A — Score rows from a table directly**
|
|
43
|
-
> "Score the first 10 customers in Public.customers with the churn model"
|
|
44
|
-
|
|
45
|
-
1. Apply `sas-read-strategy` → use `read-table` to fetch 10 rows
|
|
46
|
-
2. Apply `sas-score-workflow` → invoke `model-score` and present results
|
|
47
|
-
|
|
48
|
-
**Flow B — Score results of an analytical query**
|
|
49
|
-
> "Score high-value customers (spend > 5000) in mylib.sales with the fraud model"
|
|
50
|
-
|
|
51
|
-
1. Apply `sas-read-strategy` → use `sas-query` for aggregation
|
|
52
|
-
2. Apply `sas-score-workflow` → invoke `model-score` and present results
|
|
53
|
-
|
|
54
|
-
**Flow C — User supplies scenario data directly**
|
|
55
|
-
> "Score age=45, income=60000, region=South with the churn model"
|
|
56
|
-
|
|
57
|
-
1. Skip read strategy
|
|
58
|
-
2. Apply `sas-score-workflow` → invoke `model-score` and present result
|
|
59
|
-
|
|
60
|
-
**Flow D — Model unfamiliar**
|
|
61
|
-
> "Score Public.applicants with the creditRisk2 model"
|
|
62
|
-
|
|
63
|
-
1. Model unfamiliar → use `find-model` to verify existence
|
|
64
|
-
2. Apply `sas-read-strategy` to fetch data
|
|
65
|
-
3. Apply `sas-score-workflow` to score
|
|
66
|
-
|
|
67
|
-
---
|
|
68
|
-
|
|
69
|
-
## For detailed guidance
|
|
70
|
-
|
|
71
|
-
- **Read strategy decisions?** See `sas-read-strategy` skill
|
|
72
|
-
- **Scoring validation and presentation?** See `sas-score-workflow` skill
|
|
73
|
-
|
|
74
|
-
**Flow D — Model unfamiliar**
|
|
75
|
-
> "Score Public.applicants with the creditRisk2 model"
|
|
76
|
-
|
|
77
|
-
1. Pause — "creditRisk2" is new
|
|
78
|
-
2. Suggest: `find-model` to confirm it exists, `model-info` to get input variables
|
|
79
|
-
3. Once confirmed → `read-table` + `model-score`
|
|
80
|
-
|
|
81
|
-
---
|
|
82
|
-
|
|
83
|
-
## Error handling
|
|
84
|
-
|
|
85
|
-
| Problem | Action |
|
|
86
|
-
|---|---|
|
|
87
|
-
| Table not found | Ask for correct lib.tablename |
|
|
88
|
-
| Model not found | Suggest find-model |
|
|
89
|
-
| Field name mismatch | Show mismatch, ask user to confirm mapping |
|
|
90
|
-
| Scoring error | Return structured error, suggest model-info |
|
|
91
|
-
| Empty read result | Tell user, ask if they want to adjust the query/filter |
|