@sassoftware/sas-score-mcp-serverjs 1.0.1-8 → 1.1.1

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.
Files changed (121) hide show
  1. package/.skills/.claude-plugin/plugin.json +59 -0
  2. package/.skills/agents/sas-score-mcp-serverjs-agent.md +26 -0
  3. package/.skills/copilot-instructions.md +62 -0
  4. package/.skills/skills/README.md +204 -0
  5. package/.skills/skills/detail-strategy/SKILL.md +316 -0
  6. package/.skills/skills/find-library-server/SKILL.md +62 -0
  7. package/.skills/skills/find-resources/SKILL.md +66 -0
  8. package/.skills/skills/list-library/SKILL.md +30 -0
  9. package/.skills/skills/list-mas-job-jobdef/SKILL.md +31 -0
  10. package/.skills/skills/list-tables/SKILL.md +30 -0
  11. package/.skills/skills/read-strategy/SKILL.md +87 -0
  12. package/.skills/skills/request-routing/SKILL.md +112 -0
  13. package/.skills/skills/score-cas/SKILL.md +95 -0
  14. package/.skills/skills/score-job-jobdef/SKILL.md +58 -0
  15. package/.skills/skills/score-mas-scr/SKILL.md +58 -0
  16. package/.skills/skills/score-program/SKILL.md +59 -0
  17. package/.skills/skills/score-strategy/SKILL.md +39 -0
  18. package/README.md +96 -54
  19. package/cli.js +29 -38
  20. package/openApi.yaml +121 -121
  21. package/package.json +15 -13
  22. package/scripts/docs/SCORE_SKILL_REFERENCE.md +17 -16
  23. package/scripts/docs/TOOL_DESCRIPTION_TEMPLATE.md +3 -3
  24. package/scripts/docs/TOOL_UPDATES_SUMMARY.md +65 -63
  25. package/scripts/docs/oauth-http-transport.md +2 -2
  26. package/scripts/docs/sas-mcp-tools-reference.md +43 -32
  27. package/scripts/plot_msrp_usa.py +49 -0
  28. package/scripts/refreshtoken.js +58 -0
  29. package/scripts/runListScr.mjs +16 -0
  30. package/src/createMcpServer.js +4 -1
  31. package/src/expressMcpServer.js +47 -49
  32. package/src/oauthHandlers/authorize.js +4 -1
  33. package/src/oauthHandlers/baseUrl.js +4 -0
  34. package/src/oauthHandlers/callback.js +4 -0
  35. package/src/oauthHandlers/getMetadata.js +4 -0
  36. package/src/oauthHandlers/index.js +4 -0
  37. package/src/oauthHandlers/token.js +4 -0
  38. package/src/openApi.yaml +121 -121
  39. package/src/processHeaders.js +10 -7
  40. package/src/setupSkills.js +6 -9
  41. package/src/toolHelpers/_casScore.js +32 -0
  42. package/src/toolHelpers/_desc.js +14 -0
  43. package/src/toolHelpers/_findJob.js +12 -0
  44. package/src/toolHelpers/_findJobdef.js +10 -0
  45. package/src/toolHelpers/_findLibrary.js +11 -0
  46. package/src/toolHelpers/_findMas.js +13 -0
  47. package/src/toolHelpers/_findScr.js +36 -0
  48. package/src/toolHelpers/_findTable.js +11 -0
  49. package/src/toolHelpers/_listJobdefs.js +12 -2
  50. package/src/toolHelpers/_listJobs.js +19 -8
  51. package/src/toolHelpers/{_listModels.js → _listMas.js} +4 -4
  52. package/src/toolHelpers/_listScr.js +13 -0
  53. package/src/toolHelpers/{_scrInfo.js → _scrDescribe.js} +4 -4
  54. package/src/toolHelpers/_scrScore.js +2 -2
  55. package/src/toolHelpers/_submitCasl.js +19 -17
  56. package/src/toolHelpers/{_tableInfo.js → _tableDescribe.js} +2 -2
  57. package/src/toolHelpers/getLogonPayload.js +2 -2
  58. package/src/toolSet/casModelScore.js +93 -0
  59. package/src/toolSet/casProgramScore.js +105 -0
  60. package/src/toolSet/devaScore.js +11 -6
  61. package/src/toolSet/findJob.js +74 -59
  62. package/src/toolSet/findJobdef.js +67 -64
  63. package/src/toolSet/findLibrary.js +28 -23
  64. package/src/toolSet/findMas.js +72 -0
  65. package/src/toolSet/findScr.js +69 -0
  66. package/src/toolSet/findTable.js +34 -27
  67. package/src/toolSet/getEnv.js +57 -57
  68. package/src/toolSet/jobDescribe.js +65 -0
  69. package/src/toolSet/jobScore.js +90 -0
  70. package/src/toolSet/jobdefDescribe.js +67 -0
  71. package/src/toolSet/jobdefScore.js +85 -0
  72. package/src/toolSet/listJobdefs.js +17 -8
  73. package/src/toolSet/listJobs.js +15 -8
  74. package/src/toolSet/listLibraries.js +16 -10
  75. package/src/toolSet/listMas.js +71 -0
  76. package/src/toolSet/listScr.js +62 -0
  77. package/src/toolSet/listTables.js +78 -66
  78. package/src/toolSet/{runMacro.js → macroScore.js} +86 -82
  79. package/src/toolSet/makeTools.js +39 -25
  80. package/src/toolSet/masDescribe.js +67 -0
  81. package/src/toolSet/masScore.js +95 -0
  82. package/src/toolSet/{runProgram.js → programScore.js} +96 -93
  83. package/src/toolSet/readTable.js +43 -26
  84. package/src/toolSet/sasQuery.js +24 -18
  85. package/src/toolSet/scrDescribe.js +55 -0
  86. package/src/toolSet/scrScore.js +63 -70
  87. package/src/toolSet/searchAssets.js +1 -1
  88. package/src/toolSet/setContext.js +8 -3
  89. package/src/toolSet/superstat.js +61 -61
  90. package/src/toolSet/tableDescribe.js +65 -0
  91. package/.skills/sas-find-library-smart/SKILL.md +0 -155
  92. package/.skills/sas-find-resource-strategy/SKILL.md +0 -105
  93. package/.skills/sas-list-resource-strategy/SKILL.md +0 -124
  94. package/.skills/sas-list-tables-smart/SKILL.md +0 -128
  95. package/.skills/sas-read-and-score-strategy/SKILL.md +0 -113
  96. package/.skills/sas-read-strategy/SKILL.md +0 -154
  97. package/.skills/sas-request-classifier/SKILL.md +0 -74
  98. package/.skills/sas-score-workflow-strategy/SKILL.md +0 -314
  99. package/.skills_claude/CLAUDE.md +0 -201
  100. package/.skills_claude/agents/sas-score-mcp-serverjs-agent.md +0 -58
  101. package/.skills_claude/enforce-find-resource-strategy.md +0 -35
  102. package/.skills_github/agents/sas-score-mcp-serverjs-agent.md +0 -58
  103. package/.skills_github/copilot-instructions.md +0 -201
  104. package/.skills_github/enforce-find-resource-strategy.md +0 -35
  105. package/scripts/optimize_final.py +0 -140
  106. package/scripts/optimize_tools.py +0 -99
  107. package/scripts/setup-skills.js +0 -34
  108. package/scripts/update_descriptions.py +0 -46
  109. package/src/authpkce.js +0 -219
  110. package/src/handleGetDelete.js +0 -34
  111. package/src/handleRequest.js +0 -112
  112. package/src/hapiMcpServer.js +0 -241
  113. package/src/toolSet/findModel.js +0 -60
  114. package/src/toolSet/listModels.js +0 -56
  115. package/src/toolSet/modelInfo.js +0 -55
  116. package/src/toolSet/modelScore.js +0 -89
  117. package/src/toolSet/runCasProgram.js +0 -98
  118. package/src/toolSet/runJob.js +0 -81
  119. package/src/toolSet/runJobdef.js +0 -82
  120. package/src/toolSet/scrInfo.js +0 -52
  121. package/src/toolSet/tableInfo.js +0 -58
@@ -0,0 +1,62 @@
1
+ ---
2
+ name: find-library-server
3
+ description: >
4
+ Verify that a SAS Viya library exists and determine which server (CAS or SAS) hosts it.
5
+ Always checks CAS first, then SAS. Returns the confirmed library name and server.
6
+ Use whenever you need to confirm a library exists before listing tables or performing any library-scoped operation.
7
+ ---
8
+
9
+ # Find Library Server
10
+
11
+ **Purpose**: Verify a library exists and determine whether it lives in CAS or SAS.
12
+
13
+ **Tool**: `sas-score-find-library({ name, server })`
14
+
15
+ ---
16
+
17
+ ## Workflow
18
+
19
+ 1. Call `sas-score-find-library({ name: "<lib>", server: "cas" })`
20
+ - ✅ Found → return `{ lib: "<lib>", server: "cas" }`
21
+ - ❌ Not found → go to step 2
22
+
23
+ 2. Call `sas-score-find-library({ name: "<LIB_UPPERCASED>", server: "sas" })`
24
+ - ✅ Found → return `{ lib: "<LIB_UPPERCASED>", server: "sas" }`
25
+ - ❌ Not found → library does not exist; **stop** and report not found to the user
26
+
27
+ ---
28
+
29
+ ## Known Library Hints (skip searching if known)
30
+
31
+ Use these to skip the two-step search when the server is already deterministic:
32
+
33
+ | Library (case-insensitive) | Server |
34
+ |---|---|
35
+ | Casuser, Formats, ModelPerformanceData, Models, Public, Samples, SystemData | `"cas"` (check CAS only) |
36
+ | MAPS, MAPSGFK, MAPSSAS, SASDQREF, SASHELP, SASUSER, WORK | `"sas"` (check SAS only, uppercase lib) |
37
+ | Unknown | Try CAS first; if not found, try SAS with uppercased lib |
38
+
39
+ ---
40
+
41
+ ## Output
42
+
43
+ Always return the confirmed resolved values to the caller:
44
+
45
+ | Field | Value |
46
+ |---|---|
47
+ | `lib` | Confirmed library name (may be uppercased for SAS) |
48
+ | `server` | `"cas"` or `"sas"` |
49
+
50
+ ---
51
+
52
+ ## Error Handling
53
+
54
+ - Not found in either server → confirm spelling with the user and offer to list available libraries.
55
+ - Do **not** fall back to listing libraries as a substitute for verification — they serve different purposes.
56
+
57
+ ---
58
+
59
+ ## Important Constraints
60
+
61
+ - **Never use `list-*` tools for library verification** — use only `sas-score-find-library`.
62
+ - This skill verifies libraries only. To verify a table, use `sas-score-find-table` directly (it validates the library implicitly).
@@ -0,0 +1,66 @@
1
+ ---
2
+ name: find-resources
3
+ description: >
4
+ Unified resource verification skill. Use the appropriate find tool before any execution.
5
+ Determines server for tables (CAS vs SAS). Never use list tools for verifying or finding specific resources; list tools are for discovery and exploration only.
6
+ ---
7
+
8
+ **GATE** Do not use list-* tools for verification — those are for explicit user list requests only. Always use the specific find-* tool to verify existence of a resource before attempting to use it.
9
+
10
+ # Unified Resource Finding Strategy
11
+
12
+ Use this strategy to verify that a resource exists before executing any action.
13
+ Never use `list-*` tools for verification — those are for explicit user browse requests only.
14
+
15
+ ## Dotted `a.b` Resource Reference Parsing
16
+
17
+ Parse any `a.b` notation before choosing a find tool:
18
+
19
+ | `b` value | Resource type | Find tool |
20
+ |---|---|---|
21
+ | `mas` | MAS model | `sas-score-find-mas`, name=`a` |
22
+ | `job` | Job model | `sas-score-find-job`, name=`a` |
23
+ | `jobdef` | JobDef model | `sas-score-find-jobdef`, name=`a` |
24
+ | `scr` | SCR model | no find tool — ask user for URL |
25
+ | `cas` | CAS model | `sas-score-find-table({ name: name, server: 'cas' })` |
26
+ | **anything else** | **Table** | `sas-score-find-table`, lib=`a`, table=`b` |
27
+
28
+ ## Find Library
29
+
30
+ **Workflow**
31
+
32
+ Use skill `find-library-server` to verify library existence and determine server.
33
+
34
+ ## Find Table
35
+
36
+ **workflow**
37
+
38
+ Step 1. Use find-library-server skill to verify the library exists and in which server:
39
+ - ✅ Found → return go to Step 2
40
+ - ❌ Not found → library does not exist; **stop** and report not found to the user
41
+
42
+ Step 2. Use sas-score-find-table tool with the library and server from step 1: `sas-score-find-table({ lib: "<lib>", name: "<TABLE_NAME>", server: <server })`
43
+ - ✅ Found → return success with confirmed lib, table, and server
44
+ - ❌ Not found → table does not exist; **stop** and report not found to the user
45
+
46
+ ---
47
+
48
+
49
+ ## Find Model of type MAS, Job, Jobdef, SCR, cas
50
+
51
+ **Workflow**
52
+
53
+ Step 1. Strip any suffix (`.mas`, `.job`, `.jobdef`, `.scr`) before lookup — use the base name only.
54
+
55
+ | Type | Tool |
56
+ |---|---|
57
+ | MAS (default when type unspecified) | `sas-score-find-mas({ name })` |
58
+ | Job | `sas-score-find-job({ name })` |
59
+ | JobDef | `sas-score-find-jobdef({ name })` |
60
+ | SCR | `sas-score-find-scr({ name })` |
61
+ | cas | `sas-score-find-table({ name: name, server: 'cas' })` |
62
+
63
+ ## Error Handling
64
+
65
+ - Not found → confirm spelling, library name, and server with user.
66
+ - Resource type unclear → ask: MAS, Job, JobDef, or SCR?
@@ -0,0 +1,30 @@
1
+ ---
2
+ name: list-library
3
+ description: >
4
+ List SAS Viya libraries. Calls sas-score-list-libraries with the appropriate server parameter.
5
+ Use only when the user explicitly wants to browse or enumerate libraries, not to verify a specific library exists.
6
+ User must specify server (CAS or SAS) in their request to trigger this skill;
7
+ ---
8
+
9
+ # List Libraries
10
+
11
+ **Trigger**:
12
+ - "list libraries in cas",
13
+ - "show all libraries in cas",
14
+ - "list libraries in sas",
15
+ - "enumerate libraries in sas",
16
+ - "what libraries are available in cas",
17
+ - "what libraries are available in sas".
18
+
19
+ **GATE**
20
+
21
+ Do not use this skill when the request is to verify whether a specific resource exists — use find-resources skill for that.
22
+
23
+ **Tool**
24
+ Use `sas-score-list-libraries` tool with the appropriate server parameter based on user input. -> sas-score-list-libraries({ server: "cas" }) or sas-score-list-libraries({ server: "sas" })
25
+
26
+ ## Pagination
27
+
28
+ For the first page pass `start=1` and `limit=10`. For subsequent pages compute `start = previous_start + limit`.
29
+ - If returned count equals `limit`: hint that more items are available and offer a next page.
30
+ - If returned count is less than `limit`: inform the user that all results have been returned.
@@ -0,0 +1,31 @@
1
+ ---
2
+ name: list-mas-job-jobdef
3
+ description: >
4
+ List MAS models, Jobs, or JobDefs in SAS Viya. Routes to the correct list tool based on resource type.
5
+ Use only when the user explicitly wants to browse or enumerate models, jobs, or jobdefs.
6
+ ---
7
+
8
+ # List MAS Models, Jobs, and JobDefs
9
+
10
+ **Trigger**: user says "list models", "show all jobs", "browse jobdefs", "enumerate MAS models", etc.
11
+
12
+ **Do not use this skill for libraries or tables** — use the `list-library` or `list-tables` skills for those.
13
+
14
+ ## Workflow
15
+
16
+ | Resource | List Tool | Notes |
17
+ |---|---|---|
18
+ | MAS Models | `sas-score-list-mas` | Default when model type is unspecified |
19
+ | Jobs | `sas-score-list-jobs` | |
20
+ | JobDefs | `sas-score-list-jobdefs` | |
21
+ | SCR Models | *(no list tool)* | Explain no list tool exists; ask user for a specific SCR URL |
22
+
23
+ Call the appropriate tool directly with pagination parameters and return results.
24
+
25
+ If the user asks to list SCR Models, explain that no list tool is available for SCR Models and ask the user to provide a specific SCR URL instead.
26
+
27
+ ## Pagination
28
+
29
+ For the first page pass `start=1` and `limit=10`. For subsequent pages compute `start = previous_start + limit`.
30
+ - If returned count equals `limit`: hint that more items are available and offer a next page.
31
+ - If returned count is less than `limit`: inform the user that all results have been returned.
@@ -0,0 +1,30 @@
1
+ ---
2
+ name: list-tables
3
+ description: >
4
+ List tables in a SAS Viya library. Always verifies the library exists and determines its server
5
+ (CAS or SAS) before listing. Never calls sas-score-list-tables without first completing library verification.
6
+ ---
7
+
8
+ # List Tables in a Library
9
+
10
+ **Trigger**: user says "list tables in \<lib\>", "show tables in \<lib\>", "what tables are in \<lib\>", etc.
11
+
12
+ > **Example prompt**: "list tables in Public"
13
+
14
+ **GATE**
15
+ Always follow the workflow steps in order. Do not skip the library and server verification step.
16
+
17
+ ---
18
+
19
+ ## Workflow
20
+ 1. Use find-library-server skill to determine if library exists and which server it is on.
21
+ - ✅ Found → call `sas-score-list-tables({ lib: <confirmed_lib>, server: <confirmed_server> })` with the confirmed values
22
+ - ❌ Not found → **stop** and report not found to the user, offering to list available libraries if appropriate
23
+
24
+ ---
25
+
26
+ ## Pagination
27
+
28
+ For the first page pass `start=1` and `limit=10`. For subsequent pages compute `start = previous_start + limit`.
29
+ - If returned count equals `limit`: hint that more items are available and offer a next page.
30
+ - If returned count is less than `limit`: inform the user that all results have been returned.
@@ -0,0 +1,87 @@
1
+ ---
2
+ name: read-strategy
3
+ description: >
4
+ Strategy for reading data from CAS or SAS tables. Determines which read tool to use (raw reads vs analytical queries).
5
+ ---
6
+
7
+ # Read Table Strategy
8
+
9
+ ## Mandatory two-step sequence — never skip or reorder
10
+
11
+ **Step 1 and Step 2 are required for every read request. Step 2 must never run before Step 1 succeeds.**
12
+
13
+ ---
14
+
15
+ ### Step 1 — Verify the table exists and resolve its server (REQUIRED)
16
+
17
+ **GATE**:
18
+
19
+ Do not check for the existence of the library separately. Follow the workflow below. The sas-score-find-table tool will check for the existence of the table in the specified library and server, which implicitly verifies the library as well.
20
+
21
+ ## Workflow to read a table
22
+
23
+ ### Step 1 — Verify the table exists and resolve its server (REQUIRED)
24
+ 1. Call `sas-score-find-table({ lib, name: table, server: "cas" })`
25
+ - ✅ Found → confirmed `lib` = lib as given, confirmed `server` = `"cas"` → go to Step 2
26
+ - ❌ Not found → call `sas-score-find-table({ lib: lib.toUpperCase(), name: table, server: "sas" })`
27
+ - ✅ Found → confirmed `lib` = uppercased lib, confirmed `server` = `"sas"` → go to Step 2
28
+ - ❌ Not found in either → **stop**. Tell the user the table was not found.
29
+
30
+
31
+ ### Step 2 — Read the table
32
+
33
+ Use the confirmed `lib` and `server` from Step 1. Never guess or default the server.
34
+
35
+ **Use `sas-score-read-table`** for all row reads, including filtered reads with a WHERE clause.
36
+ **Use `sas-score-sas-query`** only when the request requires SQL aggregation (COUNT, SUM, AVG, MIN, MAX), GROUP BY, JOIN, or computed columns. A WHERE clause alone is not a reason to use sas-query.
37
+
38
+ ## Read Table (`sas-score-read-table`)
39
+
40
+ **When**: raw rows, filtered rows, browsing — anything that is not an aggregation or join.
41
+
42
+ **Parsing row count from user input**:
43
+
44
+ | User says | start | limit |
45
+ |---|---|---|
46
+ | "first N rows/records" | 1 | N |
47
+ | "top N rows" | 1 | N |
48
+ | "N rows" / "N records" | 1 | N |
49
+ | "rows N to M" | N | M−N+1 |
50
+ | "starting from row N" | N | 10 |
51
+ | (not specified) | 1 | 10 |
52
+
53
+ > "first" always means start at row 1 and return N rows. It is never a row offset.
54
+
55
+ **Dotted format**: `"lib.table"` → `lib: "lib"`, `table: "table"` (split on first dot).
56
+
57
+ **Parameters**: `lib`, `table`, `server` (confirmed from Step 1 — required), `start`, `limit`, `where`
58
+
59
+ ## SQL Query (`sas-score-sas-query`)
60
+
61
+ **When**: COUNT/SUM/AVG/MIN/MAX, GROUP BY, JOIN across tables, or computed columns.
62
+
63
+ **NOT for**: simple filtered reads — use read-table with `where` instead.
64
+
65
+ **Parameters**: `table` (as `"lib.table"`), `query`, `sql`
66
+
67
+ ## Decision
68
+
69
+ ```
70
+ Does the request need aggregation (COUNT/SUM/AVG/GROUP BY) or a JOIN?
71
+ YES → sas-score-sas-query
72
+ NO → sas-score-read-table (pass filter in `where` parameter if needed)
73
+ ```
74
+
75
+ ## Table Name Format
76
+
77
+ - CAS: `Public.customers`, `Caslib.table`
78
+ - SAS: `SASHELP.cars`, `LIBREF.table` (uppercase libref)
79
+ - Dotted input `"x.y"` → lib=`x`, table=`y`
80
+
81
+ ## Error Handling
82
+
83
+ | Error | Action |
84
+ |---|---|
85
+ | Table not found | Verify with find-resources first |
86
+ | Empty result | Ask user to adjust WHERE clause |
87
+ | Column not found | Ask user to verify column name (case-sensitive) |
@@ -0,0 +1,112 @@
1
+ ---
2
+ name: request-routing
3
+ description: >
4
+ Route SAS Viya requests for finding resources,reading tables, running queries,
5
+ scoring MAS/job/jobdef/SCR/cas models, listing resources, and describing metadata.
6
+ Use when the task involves choosing the correct SAS Viya tool or deciding whether
7
+ to verify, read, query, score, list, or describe a resource.
8
+ ---
9
+
10
+ # Request Routing — Canonical SKILL
11
+
12
+ Purpose: single source-of-truth for routing SAS Viya actions (read, query, score, describe, list).
13
+
14
+ ## Dotted Resource Reference Parsing — `a.b` Notation
15
+
16
+ When any resource reference appears in the form `a.b`, parse `b` to determine the resource type:
17
+
18
+ | `b` value | Resource type | Parsed as |
19
+ |---|---|---|
20
+ | `mas` | MAS model | name = `a` |
21
+ | `job` | Job model | name = `a` |
22
+ | `jobdef` | JobDef model | name = `a` |
23
+ | `scr` | SCR model | name = `a` |
24
+ | `cas` | CAS model in a cas table| name = `a` |
25
+ | **anything else** | **Table** | lib = `a`, table = `b` |
26
+
27
+ **Rule**: if `b` is not one of `{mas, job, jobdef, scr, sas, casl}`, treat `a.b` as a table reference where `a` is the library name and `b` is the table name.
28
+
29
+ **Examples**:
30
+ - `Public.customers` → table, lib=`Public`, table=`customers`
31
+ - `SASHELP.cars` → table, lib=`SASHELP`, table=`cars`
32
+ - `churnRisk.mas` → MAS model, name=`churnRisk`
33
+ - `simplejob.job` → Job model, name=`simplejob`
34
+ - `myScorer.jobdef` → JobDef model, name=`myScorer`
35
+ - `loanModel.scr` → SCR model, name=`loanModel`
36
+
37
+ Quick workflow
38
+ - Verify — confirm resources exist (use find-*).
39
+ - Execute — run the mapped execution tool (read, query, score, describe, list).
40
+ - Format — return results and append a short Strategy Summary.
41
+
42
+ **Important Reminder**: If the category is "Find resource" do not use the list-* rules below, use the specific find-* tool for that resource type. The list-* tools are for discovery when the user does not have a specific resource in mind.
43
+
44
+ Classification
45
+ | Category | Triggers | Primary Action | Primary Tool(s) |
46
+ |---|---|---|---|
47
+ | Find resource | "find", "does X exist", "locate", "verify" | Verify resource | `sas-score-find-library`, `sas-score-find-table`, `sas-score-find-mas`, `sas-score-find-job`, `sas-score-find-jobdef` |
48
+ | Read / Query | "read", "show rows", "how many", "count", "average", "query" | Read / aggregate | `sas-score-read-table`, `sas-score-sas-query` |
49
+ | Score | "score", "predict", "run model" | Score inputs | `sas-score-mas-score`, `sas-score-scr-score`, `sas-score-job-score`, `sas-score-jobdef-score`, `sas-score-program-score`, `sas-score-cas-program-score` |
50
+ | List / Discover | "list", "show all", "browse" | List resources | Use **list-library** skill for libraries, **list-tables** skill for tables in a library, **list-mas-job-jobdef** skill for models/jobs/jobdefs |
51
+ | Describe | "describe", "what inputs", "metadata" | Return metadata | `sas-score-*-describe` (mas/job/jobdef/scr/table) |
52
+
53
+ Verification rules
54
+ - Always verify resources using the appropriate `find-*` tool before executing actions
55
+
56
+ Execution rules
57
+ - Execute only after verification; choose the execution tool per the Execute mapping section.
58
+ - Scoring flows:
59
+ - Inline scenario: verify model → call scoring tool.
60
+ - Table rows: verify model + table → read rows → map columns to model inputs → score → merge predictions with rows.
61
+ - Read/query flows:
62
+ - Use `sas-score-read-table` for **all** row reads, including those with a WHERE filter. A filter condition is not a reason to use sas-query.
63
+ - Use `sas-score-sas-query` **only** when the request requires SQL aggregation (COUNT, SUM, AVG, MIN, MAX), GROUP BY, JOIN across tables, or computed columns.
64
+ - When mapping between table columns and model inputs is ambiguous, ask the user for explicit mapping.
65
+
66
+ Defaults & exceptions
67
+ - Default model type: MAS unless the user specifies otherwise.
68
+ - Skip `find-*` verification for SCR models; SCR endpoints may be scored directly.
69
+ - If server determination is ambiguous, prompt the user for clarification.
70
+ - Pagination: always pass `start=1` and `limit=10` when calling any tool that accepts these parameters, unless the user specifies different values. Never omit them and rely on tool-level defaults.
71
+
72
+ Execute mapping (concise)
73
+ - Read rows (including WHERE filter): `sas-score-read-table` (lib, table, server, where)
74
+ - SQL aggregation/join only: `sas-score-sas-query` (lib.table, query, sql)
75
+ - MAS scoring: `sas-score-mas-score` (mas, scenario)
76
+ - Job scoring: `sas-score-job-score` (name, scenario)
77
+ - JobDef scoring: `sas-score-jobdef-score` (name, scenario)
78
+ - SCR scoring: `sas-score-scr-score` (name, scenario)
79
+ - Program scoring: `sas-score-program-score` (src, scenario, folder, output, limit)
80
+ - CAS Program scoring: `sas-score-cas-program-score` (src, scenario, folder, output, limit)
81
+ - Describe: `sas-score-*-describe` (mas/job/jobdef/scr/table)
82
+
83
+ Combined Read + Score (short)
84
+ 1. Verify: find table (server) and find the model (mas,job,jobdef,scr). If table/model not found, ask user to clarify resource and server.
85
+ 2. Read: fetch rows (read-table or sas-query).
86
+ 3. Map: ensure table columns match model inputs; ask for mapping if needed.
87
+ 4. Score: call the appropriate scoring tool.
88
+ 5. Merge: attach predictions to rows and return.
89
+
90
+ Strategy Summary (append to responses)
91
+ ---
92
+ **Strategy Summary:**
93
+ - **Classification**: [Find / Read / Score / List / Describe]
94
+ - **Verification**: [Resources verified / skipped]
95
+ - **Tool(s)**: [Primary tool(s) invoked]
96
+ - **Decision**: [Server chosen, model type, mapping]
97
+ - **Next steps**: [Follow-ups or clarifications]
98
+ ---
99
+
100
+ Error handling (short)
101
+ - Resource not found → ask for exact resource name and server (for tables).
102
+ - Column/input mismatch → request mapping from user.
103
+ - Empty result → ask to relax filters or confirm criteria.
104
+ - Execution error → return tool error verbatim.
105
+
106
+ Examples (minimal)
107
+ - Read: "read customers in Public" → find Public (CAS) → read-table → return rows.
108
+ - Score inline: "score a=1,b=2 with job simplejob" → find job → job-score → return merged result.
109
+ - Score table: "score Public.customers with model risk" → find table (CAS) & model (MAS) → read rows → score → return merged.
110
+
111
+ Notes: Keep this SKILL as the canonical, compact router; agent wrappers should be short and reference this document for details and examples.
112
+
@@ -0,0 +1,95 @@
1
+ ---
2
+ name: score-cas
3
+ description: >
4
+ Scoring workflow for CAS (Cloud Analytic Services) programs and CAS model tables.
5
+ Use when the model suffix is .casl, or when the user references a CAS model table
6
+ (casmodel), or when running inline CASL/CAS program src code.
7
+ Handles both inline scenario scoring and table row scoring.
8
+ ---
9
+
10
+ # Score CAS Program / CAS Model
11
+
12
+ ## When to use this skill
13
+ - Model type is `.casl` (CAS Program — inline src code)
14
+ - User references a CAS model table (`casmodel` in `lib.table` form, with optional `name`)
15
+ - User says "run cas program", "execute casl", "score cas model"
16
+
17
+ ## Model Forms
18
+
19
+ The tool `sas-score-cas-program-score` accepts two mutually exclusive model forms:
20
+
21
+ | Form | Params | When to use |
22
+ |---|---|---|
23
+ | Inline src code | `src` (required), no `casmodel` | User provides CASL code directly |
24
+ | CAS model table | `casmodel` (required), `name` (optional) | User references a persisted CAS model table |
25
+
26
+ > If both `src` and `casmodel` are provided, `casmodel` takes precedence.
27
+
28
+ ## Tool
29
+
30
+ | Type | Verify | Score |
31
+ |---|---|---|
32
+ | CAS Program (inline) | *(no pre-check)* | `sas-score-cas-program-score` |
33
+ | CAS Model (table) | *(no pre-check)* | `sas-score-cas-program-score` |
34
+
35
+ ## Inline Src Code Scoring
36
+
37
+ Score CASL source code directly (no casmodel):
38
+
39
+ ```
40
+ sas-score-cas-program-score({ src, scenario, output, limit })
41
+ ```
42
+
43
+ - `src` — CASL/CAS program code to execute verbatim
44
+ - `scenario` — input parameters as string (`"x=1, y=2"`) or object (`{ x: 1, y: 2 }`)
45
+ - `output` — optional CAS table name to return in response
46
+ - `limit` — max rows to return (default 100)
47
+
48
+ ## CAS Model Table Scoring
49
+
50
+ Score using a persisted CAS model table:
51
+
52
+ ```
53
+ sas-score-cas-program-score({ casmodel, name, scenario, output, limit })
54
+ ```
55
+
56
+ - `casmodel` — CAS model table in `lib.table` form (e.g., `mylib.mymodel`)
57
+ - `name` — optional model name if different from the table name
58
+ - `scenario` — input parameters
59
+ - `output` / `limit` — same as above
60
+
61
+ ## Routing Examples
62
+
63
+ | User says | Params |
64
+ |---|---|
65
+ | "run cas program `action echo`" | `{ src: "action echo" }` |
66
+ | "execute casl `action simple.summary` with table=a.b" | `{ src: "action simple.summary", scenario: { table: "a.b" } }` |
67
+ | "score cas model `mylib.abc` with x=1, y=2" | `{ casmodel: "mylib.abc", scenario: "x=1, y=2" }` |
68
+ | "score cas model `mylib.abc` using model name `mymodel`" | `{ casmodel: "mylib.abc", name: "mymodel", scenario: ... }` |
69
+
70
+ ## Table Row Scoring
71
+
72
+ **Parsing row count:**
73
+
74
+ | User says | start | limit |
75
+ |---|---|---|
76
+ | "score the first N rows from lib.table" | 1 | N |
77
+ | "score N rows from lib.table" | 1 | N |
78
+ | (count not specified) | 1 | 10 |
79
+
80
+ **Flow:**
81
+ 1. Read table → use read-strategy skill
82
+ 2. Score each row — tool accepts a single row; loop over rows calling the tool for each
83
+ 3. Return rows with predictions appended
84
+ 4. Cap batch at 10 rows by default; ask user before proceeding with larger batches
85
+
86
+ ## Error Handling
87
+
88
+ | Error | Action |
89
+ |---|---|
90
+ | CAS session cannot be created | Report CAS connectivity issue to user |
91
+ | `src` not provided and `casmodel` not provided | Ask user for src code or casmodel table |
92
+ | CAS model table not found | Confirm `casmodel` value with user |
93
+ | Table not found (row scoring) | Confirm table name and library |
94
+ | Empty table | Ask user to adjust filter or confirm criteria |
95
+ | Scoring failure | Return tool error verbatim |
@@ -0,0 +1,58 @@
1
+ ---
2
+ name: score-job-jobdef
3
+ description: >
4
+ Scoring workflow for Job (.job) and JobDef (.jobdef) model types.
5
+ Use when the model suffix is .job or .jobdef.
6
+ Handles both inline scenario scoring and table row scoring.
7
+ ---
8
+
9
+ # Score Job / JobDef
10
+
11
+ ## When to use this skill
12
+ - Model type is `.job`
13
+ - Model type is `.jobdef`
14
+
15
+ ## Tools
16
+
17
+ | Type | Verify | Score |
18
+ |---|---|---|
19
+ | Job | `sas-score-find-job` | `sas-score-job-score` |
20
+ | JobDef | `sas-score-find-jobdef` | `sas-score-jobdef-score` |
21
+
22
+ ## Inline Scenario Scoring
23
+
24
+ **Job:**
25
+ 1. Verify: `sas-score-find-job({ name })`
26
+ 2. Score: `sas-score-job-score({ name, scenario })`
27
+
28
+ **JobDef:**
29
+ 1. Verify: `sas-score-find-jobdef({ name })`
30
+ 2. Score: `sas-score-jobdef-score({ name, scenario })`
31
+
32
+ ## Table Row Scoring
33
+
34
+ **Parsing row count:**
35
+
36
+ | User says | start | limit |
37
+ |---|---|---|
38
+ | "score the first N rows from lib.table" | 1 | N |
39
+ | "score N rows from lib.table" | 1 | N |
40
+ | (count not specified) | 1 | 10 |
41
+
42
+ **Flow:**
43
+ 1. Find model →
44
+ - if job use `sas-score-find-job` to find the Job model
45
+ - if jobdef use `sas-score-find-jobdef` to find the JobDef model
46
+ 2. Read table → use read-strategy skill
47
+ 3. Score each row — tools accept a single row; loop over rows calling the tool for each
48
+ 4. Return rows with predictions appended
49
+ 5. Cap batch at 10 rows by default; ask user before proceeding with larger batches
50
+
51
+ ## Error Handling
52
+
53
+ | Error | Action |
54
+ |---|---|
55
+ | Job / JobDef not found | Confirm name with user |
56
+ | Table not found | Confirm table name and library |
57
+ | Empty table | Ask user to adjust filter or confirm criteria |
58
+ | Scoring failure | Return tool error verbatim |
@@ -0,0 +1,58 @@
1
+ ---
2
+ name: score-mas-scr
3
+ description: >
4
+ Scoring workflow for MAS (Micro Analytic Score) and SCR (Score Code Runtime) models.
5
+ Use when the model type is .mas or .scr, or when no suffix is given (default is MAS).
6
+ Handles both inline scenario scoring and table row scoring.
7
+ ---
8
+
9
+ # Score MAS / SCR
10
+
11
+ ## When to use this skill
12
+ - Model type is `.mas` (default when no suffix given)
13
+ - Model type is `.scr`
14
+
15
+ ## Tools
16
+
17
+ | Type | Verify | Score |
18
+ |---|---|---|
19
+ | MAS | `sas-score-find-mas` | `sas-score-mas-score` |
20
+ | SCR | `sas-score-find-scr` | `sas-score-scr-score` |
21
+
22
+ ## Inline Scenario Scoring
23
+
24
+ **MAS:**
25
+ 1. Verify: `sas-score-find-mas({ model })`
26
+ 2. Score: `sas-score-mas-score({ model, scenario })`
27
+
28
+ **SCR:**
29
+ 1. Verify: `sas-score-find-scr({ model })`
30
+ 2. Score: `sas-score-scr-score({ model, scenario })`
31
+
32
+ ## Table Row Scoring
33
+
34
+ **Parsing row count:**
35
+
36
+ | User says | start | limit |
37
+ |---|---|---|
38
+ | "score the first N rows from lib.table" | 1 | N |
39
+ | "score N rows from lib.table" | 1 | N |
40
+ | (count not specified) | 1 | 10 |
41
+
42
+ **Flow:**
43
+ 1. Find model →
44
+ - if mas use `sas-score-find-mas` to find the MAS model
45
+ - if scr use `sas-score-find-scr` to find the SCR model
46
+ 2. Read table → use read-strategy skill
47
+ 3. Score each row — tools accept a single row; loop over rows calling the tool for each
48
+ 4. Return rows with predictions appended
49
+ 5. Cap batch at 10 rows by default; ask user before proceeding with larger batches
50
+
51
+ ## Error Handling
52
+
53
+ | Error | Action |
54
+ |---|---|
55
+ | MAS model not found | Confirm model name with user |
56
+ | Table not found | Confirm table name and library |
57
+ | Empty table | Ask user to adjust filter or confirm criteria |
58
+ | Scoring failure | Return tool error verbatim |