@sassoftware/sas-score-mcp-serverjs 1.0.1-2 → 1.0.1-3

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 (27) hide show
  1. package/.skills_claude/README.md +303 -0
  2. package/.skills_claude/TESTING_GUIDE.md +252 -0
  3. package/.skills_claude/agents/sas-viya-scoring-expert.md +58 -0
  4. package/.skills_claude/claude-desktop-config.json +16 -0
  5. package/.skills_claude/claude-desktop-system-prompt.md +127 -0
  6. package/.skills_claude/copilot-instructions.md +155 -0
  7. package/.skills_claude/instructions.md +184 -0
  8. package/.skills_claude/skills/sas-find-library-smart/SKILL.md +157 -0
  9. package/.skills_claude/skills/sas-find-resource-strategy/SKILL.md +105 -0
  10. package/.skills_claude/skills/sas-list-resource-strategy/SKILL.md +124 -0
  11. package/.skills_claude/skills/sas-list-tables-smart/SKILL.md +126 -0
  12. package/.skills_claude/skills/sas-read-and-score/SKILL.md +112 -0
  13. package/.skills_claude/skills/sas-read-strategy/SKILL.md +154 -0
  14. package/.skills_claude/skills/sas-request-classifier/SKILL.md +69 -0
  15. package/.skills_claude/skills/sas-score-workflow/SKILL.md +200 -0
  16. package/.skills_claude/skills-index.md +345 -0
  17. package/.skills_github/agents/sas-viya-scoring-expert.md +58 -0
  18. package/.skills_github/copilot-instructions.md +177 -0
  19. package/.skills_github/skills/sas-find-library-smart/SKILL.md +155 -0
  20. package/.skills_github/skills/sas-find-resource-strategy/SKILL.md +105 -0
  21. package/.skills_github/skills/sas-list-resource-strategy/SKILL.md +124 -0
  22. package/.skills_github/skills/sas-list-tables-smart/SKILL.md +128 -0
  23. package/.skills_github/skills/sas-read-and-score/SKILL.md +113 -0
  24. package/.skills_github/skills/sas-read-strategy/SKILL.md +154 -0
  25. package/.skills_github/skills/sas-request-classifier/SKILL.md +74 -0
  26. package/.skills_github/skills/sas-score-workflow/SKILL.md +314 -0
  27. package/package.json +3 -2
@@ -0,0 +1,177 @@
1
+ # SAS Agent instructions for this repository
2
+
3
+ ## Project overview
4
+ This repository builds and maintains a SAS-focused agent experience on top of an MCP server.
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
+ 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
+
8
+ ## Available Agents
9
+
10
+ This repository includes specialized agents for SAS-focused workflows:
11
+
12
+ - **SAS Viya Scoring Expert** — 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.
16
+
17
+ ## Operating model
18
+ Treat this repository as a domain-specialized SAS agent, not as a generic coding project.
19
+ Prefer domain interpretation and skill-based guidance before directly invoking low-level tools.
20
+ When a request is ambiguous, resolve the ambiguity before taking action.
21
+
22
+ ## Request classification
23
+ Before using SAS MCP tools, classify the request into one of these categories:
24
+
25
+ - SAS job or flow execution
26
+ - SAS code or program analysis
27
+ - CAS data, caslibs, tables, or resources
28
+ - SAS data, librefs, tables, or resources
29
+ - MAS model, SAS job model, SAS jobdef model
30
+ - Score model / scoring artifact / scoring execution
31
+ - General SAS content or metadata discovery
32
+ - Authentication, connection, or environment issue
33
+
34
+ If the request could belong to multiple categories, ask one clarifying question unless lightweight discovery can resolve it safely.
35
+
36
+ ## Skill-first behavior
37
+ Before invoking MCP tools, decide whether one or more SAS skills should be used.
38
+ Prefer loading the most relevant SAS skill for the request category.
39
+ Use more than one skill only when the task clearly spans multiple domains, for example:
40
+ - CAS discovery + scoring
41
+ - model lookup + job execution
42
+ - content discovery + code analysis
43
+
44
+ Do not load unrelated skills.
45
+ Do not treat "model", "score", "job", "code", or "table" as interchangeable terms.
46
+
47
+ ## Tool usage policy
48
+ Use MCP tools only after you have identified the most likely domain.
49
+ Prefer read or discovery operations before write, execute, deploy, or destructive operations.
50
+ When a user asks to run, publish, deploy, or score something, confirm that you have identified the correct SAS asset type first.
51
+ If a tool response reveals that the original interpretation was wrong, correct course explicitly and continue.
52
+
53
+ ## Ambiguity handling
54
+ In this repository:
55
+
56
+ - "model" usually refers to MAS models, SAS job models, or SAS jobdef models, SCR models
57
+ - "score" or "scoring" usually refers to running a model on data, not measuring test coverage.
58
+ - "job" usually refers to a SAS job or flow, not a CI job.
59
+
60
+ When these terms appear without clear SAS context, ask a clarifying question or use the SAS request classifier skill before invoking tools.
61
+ The following terms are ambiguous and must be disambiguated from context or by asking a question:
62
+ - model
63
+ - score
64
+ - scoring
65
+ - job
66
+ - code
67
+ - table
68
+ - content
69
+ - resource
70
+
71
+ Examples:
72
+ - "find my model" may refer to a MAS model, model repository entry, or scoring asset
73
+ - "run scoring" may refer to a job, MAS, jobdef, SCR model
74
+ - "open the table" may refer to a CAS table or SAS dataset
75
+
76
+ ## Response style
77
+ Be concise, precise, and domain-aware.
78
+ Explain which SAS concept you are acting on when ambiguity is possible.
79
+ Do not pretend certainty when the asset type or environment is unclear.
80
+ Prefer structured answers with short steps when guiding the user.
81
+
82
+ ## Coding and implementation guidance
83
+ When editing code in this repository:
84
+ - Preserve existing MCP server patterns and naming conventions.
85
+ - Prefer small, composable modules over large prompt files.
86
+ - Keep tool descriptions short, specific, and distinct.
87
+ - Put durable domain workflows in skills, not in tool descriptions.
88
+ - Keep always-on instructions short; detailed procedures belong in skills.
89
+ - Prefer configuration and prompt assets that can be reused across Claude and Copilot.
90
+
91
+ ## Repository structure expectations
92
+ Expect to find:
93
+ - MCP server implementation code
94
+ - prompt or skill assets
95
+ - configuration for client integrations
96
+ - SAS/Viya-specific adapters or resource logic
97
+ - tests or examples for skill and tool behavior
98
+
99
+ When adding new artifacts:
100
+ - Put repo-wide guidance in `.github/copilot-instructions.md`
101
+ - Put targeted reusable workflows in `.github/skills/<skill-name>/SKILL.md`
102
+ - Keep supporting references, examples, and templates next to the skill that uses them
103
+
104
+ ## Safety and correctness
105
+ Never make up SAS assets, job names, model identifiers, or CAS resources.
106
+ If a requested action depends on environment-specific details, verify those details first.
107
+ Prefer inspection and discovery over assumption.
108
+
109
+ ---
110
+
111
+ # Available Skills
112
+
113
+ This repository provides specialized skills for SAS-focused workflows. Load the relevant skill for the user's request before using MCP tools.
114
+
115
+ ## sas-request-classifier
116
+ **Purpose:** Classify ambiguous SAS or Viya requests before using MCP tools.
117
+
118
+ **Use when:** Request mentions jobs, code, models, scoring, CAS tables, content, or resources and the correct SAS domain is not yet clear.
119
+
120
+ **Trigger phrases:** "find my model", "run scoring", "open the table", or any ambiguous request using domain terms.
121
+
122
+ ## sas-find-resource-strategy
123
+ **Purpose:** Unified find-only strategy to verify existence of libraries, tables, models, jobs, and jobdefs using find tools.
124
+
125
+ **Use when:** User asks to find, verify, check existence of, or locate a resource.
126
+
127
+ **Trigger phrases:** "find library", "find table", "find model", "find job", "find jobdef", "does X exist".
128
+
129
+ ## sas-list-resource-strategy
130
+ **Purpose:** Unified list strategy to list libraries, tables, models, jobs, and jobdefs with normalized pagination.
131
+
132
+ **Use when:** User asks to list, show, browse, or enumerate resources.
133
+
134
+ **Rule:** Always pass non-null `start` and `limit`; default to `start: 1` and `limit: 10` when not provided.
135
+
136
+ **Trigger phrases:** "list libraries", "list tables", "list models", "list jobs", "list jobdefs", "show resources".
137
+
138
+ ## sas-find-library-smart
139
+ **Purpose:** Find a SAS Viya library (libref or caslib) with intelligent server detection. Automatically checks CAS first, then SAS if not found.
140
+
141
+ **Use when:** User needs to verify a library exists, before accessing tables within it.
142
+
143
+ **Trigger phrases:** "find library", "does library exist", "check if library", "locate library", "is there a library named", "verify library".
144
+
145
+ ## sas-list-tables-smart
146
+ **Purpose:** List all tables in a SAS Viya library with intelligent server detection. When the server is not specified, automatically checks CAS first, then SAS if not found.
147
+
148
+ **Use when:** User wants to browse or explore available tables.
149
+
150
+ **Trigger phrases:** "list tables in", "show tables in", "what tables are in", "browse tables in", "tables in library", "enumerate tables".
151
+
152
+ ## sas-read-strategy
153
+ **Purpose:** Guide the user in choosing the right data retrieval tool: `sas-score-read-table` (for raw row access with filters) or `sas-score-sas-query` (for analytical queries, aggregations, joins).
154
+
155
+ **Use when:** User wants to fetch records from a SAS/CAS table.
156
+
157
+ **Pre-check:** Use `sas-find-resource-strategy` to verify library/table existence first.
158
+
159
+ **Trigger phrases:** "read records from", "get data where", "fetch rows from", "query the table", "give me the first N records", "aggregate by", "join tables".
160
+
161
+ ## sas-read-and-score
162
+ **Purpose:** Guide the full read → score workflow in SAS Viya: reading records from a table and then scoring them with a MAS model.
163
+
164
+ **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.
165
+
166
+ **Pre-check:** Use `sas-find-resource-strategy` to verify library/table/model resources first.
167
+
168
+ **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".
169
+
170
+ ## sas-score-workflow
171
+ **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.
172
+
173
+ **Use when:** User requests scoring with a model name that may require routing to different execution engines.
174
+
175
+ **Pre-check:** Use `sas-find-resource-strategy` to verify model/job/jobdef resources before execution.
176
+
177
+ **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,155 @@
1
+ ---
2
+ name: sas-find-library-smart
3
+ description: >
4
+ Find a SAS Viya library (libref or caslib) with intelligent server detection. Automatically checks
5
+ CAS first, then SAS if not found. Use this skill when the user needs to verify a library exists,
6
+ before accessing tables within it. Trigger phrases include: "find library", "does library exist",
7
+ "check if library", "locate library", "is there a library named", "verify library", or any request
8
+ to confirm a library's availability across servers.
9
+ ---
10
+
11
+ # Smart Library Lookup (Find Library)
12
+
13
+ Intelligently locates a SAS Viya library by checking CAS first, then SAS if the library is not found
14
+ in CAS. Provides the user with clear information about library availability and location.
15
+
16
+ > Primary strategy: use `sas-find-resource-strategy` for all resource existence checks.
17
+
18
+ **If the user specifies the server explicitly** (e.g., "find library Public in cas"):
19
+ - Use the specified server: `server: "cas"` or `server: "sas"`
20
+ - Proceed directly to finding the library
21
+
22
+ **If the server is NOT specified:**
23
+ 1. **First attempt**: Check CAS (`server: "cas"`)
24
+ 2. **If not found in CAS**: Check SAS with uppercase library name (`server: "sas"`)
25
+ 3. **If not found in either**:
26
+ - Inform user: *"The library '&lt;lib&gt;' was not found in CAS or SAS servers. Please verify the library name."*
27
+ - Ask for corrected library name or explicit server context
28
+ 4. **If found**:
29
+ - Inform user which server contains the library: *"Found library '&lt;lib&gt;' in CAS"* or *"Found library '&lt;lib&gt;' in SAS"*
30
+ - Offer next steps: *"Would you like to list tables in this library?"* (suggest `sas-score-list-tables`)
31
+
32
+ ---
33
+
34
+ ## Using sas-score-find-library
35
+
36
+ **When:**
37
+ - User wants to verify a library exists
38
+ - User needs to determine which server contains a library
39
+ - User wants to check library availability before accessing it
40
+ - User wants to explore available libraries (before querying)
41
+
42
+ **How:**
43
+ ```
44
+ sas-score-find-library({
45
+ name: "libraryname", // required
46
+ server: "cas" or "sas" // optional; determined by server check if not specified
47
+ })
48
+ ```
49
+
50
+ **Rules:**
51
+ - Always determine the correct server first (cas → sas → neither)
52
+ - **For SAS server: always uppercase the library name** (e.g., "public" → "PUBLIC")
53
+ - If library name is missing, ask: *"Which library name would you like to find?"*
54
+ - Return the server where the library was found
55
+ - If not found in either server, clearly inform the user and request corrected name or server context
56
+ - Do not proceed with table access until library existence is confirmed
57
+ - Do not use list tools to find whether a library exists
58
+
59
+ ---
60
+
61
+ ## Smart server detection logic
62
+
63
+ ```
64
+ IF server specified by user
65
+ → IF server is "sas"
66
+ → uppercase lib
67
+ → use that server, call sas-score-find-library
68
+ ELSE
69
+ → TRY sas-score-find-library(lib, server="cas")
70
+ IF library found
71
+ → success, inform user: library found in CAS
72
+ ELSE
73
+ → uppercase lib
74
+ → TRY sas-score-find-library(lib.toUpperCase(), server="sas")
75
+ IF library found
76
+ → success, inform user: library found in SAS
77
+ ELSE
78
+ → inform user library not found in either server
79
+ → ask for corrected name or explicit server
80
+ ```
81
+
82
+ ---
83
+
84
+ ## Common patterns
85
+
86
+ **Pattern 1 — Find library, server unspecified**
87
+ > "Find library Public"
88
+
89
+ 1. Try CAS: `sas-score-find-library({ name: "Public", server: "cas" })`
90
+ 2. If not found, try SAS with uppercase: `sas-score-find-library({ name: "PUBLIC", server: "sas" })`
91
+ 3. If found in CAS → *"Found library 'Public' in CAS. Would you like to list tables in it?"*
92
+ 4. If found in SAS → *"Found library 'PUBLIC' in SAS. Would you like to list tables in it?"*
93
+ 5. If not found -> *"The library 'Public' was not found in CAS or SAS. Please confirm the name or specify a server."*
94
+
95
+ **Pattern 2 — Find library with explicit server (CAS)**
96
+ > "Find library MyData in cas"
97
+
98
+ 1. Skip server detection
99
+ 2. Call: `sas-score-find-library({ name: "MyData", server: "cas" })`
100
+ 3. Result → *"Found library 'MyData' in CAS"* or *"Library 'MyData' not found in CAS"*
101
+
102
+ **Pattern 3 — Find library with explicit server (SAS)**
103
+ > "Does library SASHELP exist in sas"
104
+
105
+ 1. Skip server detection
106
+ 2. Uppercase lib: `sas-score-find-library({ name: "SASHELP", server: "sas" })`
107
+ 3. Result → *"Found library 'SASHELP' in SAS"* or *"Library 'SASHELP' not found in SAS"*
108
+
109
+ **Pattern 4 — Library not found, offer next steps**
110
+ > "Check if library staging exists"
111
+
112
+ 1. Try CAS: `sas-score-find-library({ name: "staging", server: "cas" })` → not found
113
+ 2. Try SAS: `sas-score-find-library({ name: "STAGING", server: "sas" })` → not found
114
+ 3. Respond:
115
+ - *"The library 'staging' was not found in CAS or SAS."*
116
+ - *"Please confirm the library name or specify the server (CAS or SAS)."*
117
+
118
+ **Pattern 5 — Library found, follow-up action**
119
+ > "Verify library samples exists"
120
+
121
+ 1. Try CAS: `sas-score-find-library({ name: "samples", server: "cas" })` → found
122
+ 2. Respond:
123
+ - *"Found library 'samples' in CAS."*
124
+ - *"Would you like to list tables in this library? (use `sas-score-list-tables`))"*
125
+
126
+ ---
127
+
128
+ ## Output presentation
129
+
130
+ **When library is found:**
131
+ ```
132
+ ✓ Found library '<lib>' in <SERVER>
133
+
134
+ Would you like to:
135
+ • List tables in this library (use sas-list-tables-smart skill)
136
+ • Read data from a specific table (use sas-read-strategy skill)
137
+ ```
138
+
139
+ **When library is not found:**
140
+ ```
141
+ ✗ Library '<lib>' not found in either CAS or SAS
142
+
143
+ Suggestions:
144
+ • Check the spelling of the library name
145
+ • Specify the intended server (CAS or SAS)
146
+ • Try a different library name
147
+ ```
148
+
149
+ ---
150
+
151
+ ## Integration with other skills
152
+
153
+ - **Primary find strategy**: Use `sas-find-resource-strategy` for existence checks
154
+ - **After finding library → List tables**: Use `sas-list-tables-smart` skill to browse available tables
155
+ - **After finding library → Read data**: Use `sas-read-strategy` skill to retrieve data from tables
@@ -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 only find tools to verify existence.
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.
45
+ 2. If not found, check SAS with uppercase library name.
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.
60
+ 2. If not found, check SAS (uppercase library).
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-tables`
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 })`
@@ -0,0 +1,128 @@
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 and table context using the `sas-find-resource-strategy` 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 '&lt;lib&gt;' was not found in CAS or SAS. Please verify the library name is correct."*
28
+ - Ask for corrected library name or explicit server context
29
+
30
+ ---
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
+ - Do not use list tools to determine whether a specific resource exists
58
+
59
+ ---
60
+
61
+ ## Smart server detection logic
62
+
63
+ ```
64
+ IF server specified by user
65
+ → IF server is "sas"
66
+ → uppercase lib
67
+ → use that server
68
+ ELSE
69
+ → TRY sas-score-list-tables(lib, server="cas")
70
+ IF tables found
71
+ → success, return tables
72
+ ELSE
73
+ → uppercase lib
74
+ → TRY sas-score-list-tables(lib.toUpperCase(), server="sas")
75
+ IF tables found
76
+ → success, return tables
77
+ ELSE
78
+ → inform user library not found in either server
79
+ ```
80
+
81
+ ---
82
+
83
+ ## Common patterns
84
+
85
+ **Pattern 1 — List tables, server unspecified**
86
+ > "List tables in Public"
87
+
88
+ 1. Try CAS: `sas-score-list-tables({ lib: "Public", server: "cas" })`
89
+ 2. If empty, try SAS with uppercase: `sas-score-list-tables({ lib: "PUBLIC", server: "sas" })`
90
+ 3. If still empty → inform user
91
+
92
+ **Pattern 2 — List tables with explicit server (SAS)**
93
+ > "List tables in sashelp in sas"
94
+
95
+ 1. Skip server detection
96
+ 2. Call with uppercase lib: `sas-score-list-tables({ lib: "SASHELP", server: "sas" })`
97
+
98
+ **Pattern 3 — List tables with explicit server (CAS)**
99
+ > "List tables in Public in cas"
100
+
101
+ 1. No uppercase needed for CAS
102
+ 2. Call: `sas-score-list-tables({ lib: "Public", server: "cas" })`
103
+
104
+ **Pattern 4 — Pagination**
105
+ > "Show me 25 tables in Samples, then the next batch"
106
+
107
+ 1. First call: `sas-score-list-tables({ lib: "Samples", limit: 25, start: 1 })`
108
+ 2. Next call: `sas-score-list-tables({ lib: "Samples", limit: 25, start: 26 })`
109
+
110
+ **Pattern 5 — Library not found**
111
+ > "List tables in foo"
112
+
113
+ 1. Try CAS: empty
114
+ 2. Try SAS with uppercase: empty
115
+ 3. Response: *"The library 'foo' was not found in CAS or SAS. Please verify the library name."*
116
+
117
+ ---
118
+
119
+ ## Error handling
120
+
121
+ | Scenario | Action |
122
+ |---|---|
123
+ | Library not found in either server | Inform user and ask to verify library name |
124
+ | Empty result on first server | Automatically check second server |
125
+ | User specifies invalid server | Return error; ask user to clarify: `"cas"` or `"sas"` |
126
+ | Missing library name | Ask: *"Which library should I list tables from?"* |
127
+ | Library verification needed | Use `sas-find-resource-strategy` to verify the library exists first |
128
+