@sassoftware/sas-score-mcp-serverjs 0.4.1-20 → 0.4.1-21
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/package.json +1 -1
- package/skills/sas-find-library-smart/SKILL.md +17 -0
- package/skills/sas-read-strategy/SKILL.md +15 -0
- package/skills/sas-score-workflow/SKILL.md +93 -6
- package/src/toolSet/findTable.js +1 -1
- package/.claude/mcp-tool-description-optimizer/SKILL.md +0 -129
- package/.claude/mcp-tool-description-optimizer/references/examples.md +0 -123
- package/.claude/sas-find-library-smart/SKILL.md +0 -154
- package/.claude/sas-list-tables-smart/SKILL.md +0 -127
- package/.claude/sas-read-and-score/SKILL.md +0 -111
- package/.claude/sas-read-strategy/SKILL.md +0 -178
- package/.claude/sas-score-workflow/SKILL.md +0 -314
- package/.claude/sas-spec-migration/SKILL.md +0 -303
package/package.json
CHANGED
|
@@ -78,6 +78,23 @@ ELSE
|
|
|
78
78
|
|
|
79
79
|
---
|
|
80
80
|
|
|
81
|
+
## Table Reference Format
|
|
82
|
+
|
|
83
|
+
When users follow up to find or work with tables, they may provide a reference in dot notation (e.g., "find table cars in Public" or "maps.india").
|
|
84
|
+
|
|
85
|
+
**Always parse table references as: `lib.table`**
|
|
86
|
+
- First part (before dot) = **library name** → `lib` parameter
|
|
87
|
+
- Second part (after dot) = **table name** → `name` or `table` parameter
|
|
88
|
+
|
|
89
|
+
**Examples:**
|
|
90
|
+
- "maps.india" → `lib: "maps"`, `name: "india"`
|
|
91
|
+
- "Public.customers" → `lib: "Public"`, `name: "customers"`
|
|
92
|
+
- "sashelp.cars" → `lib: "sashelp"`, `name: "cars"`
|
|
93
|
+
|
|
94
|
+
This rule ensures consistent parsing when users reference tables in subsequent operations after finding a library.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
81
98
|
## Common patterns
|
|
82
99
|
|
|
83
100
|
**Pattern 1 — Find library, server unspecified**
|
|
@@ -36,6 +36,21 @@ Use `sas-score-find-table` with intelligent server detection:
|
|
|
36
36
|
|
|
37
37
|
---
|
|
38
38
|
|
|
39
|
+
## Table Reference Format
|
|
40
|
+
|
|
41
|
+
When a user provides a table reference in dot notation (e.g., "read maps.india" or "find table cars.Public"):
|
|
42
|
+
|
|
43
|
+
**Always parse as: `lib.table`**
|
|
44
|
+
- First part (before dot) = **library name** → `lib` parameter
|
|
45
|
+
- Second part (after dot) = **table name** → `name` or `table` parameter
|
|
46
|
+
|
|
47
|
+
**Examples:**
|
|
48
|
+
- "maps.india" → `lib: "maps"`, `name: "india"`
|
|
49
|
+
- "Public.customers" → `lib: "Public"`, `name: "customers"`
|
|
50
|
+
- "sashelp.cars" → `lib: "sashelp"`, `name: "cars"`
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
39
54
|
## Determine the read strategy
|
|
40
55
|
|
|
41
56
|
Ask yourself: does the user already have the data in hand?
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
2
|
name: sas-score-workflow
|
|
3
3
|
description: >
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
MANDATORY routing logic for all scoring requests. Extract model.type suffix, route to correct tool
|
|
5
|
+
(run-job|run-jobdef|model-score|scr-score|run-program). Complete routing decision BEFORE invoking
|
|
6
|
+
any tool. Handles both MAS models and alternative scoring engines (jobs, jobdefs, SCR, SAS programs).
|
|
7
|
+
Trigger phrases: "score with model X.job", "score X.jobdef scenario", "score with model X.mas",
|
|
8
|
+
"score with model X.scr", any request with "score" + model name containing a dot (.) + type suffix.
|
|
9
9
|
---
|
|
10
10
|
|
|
11
11
|
# SAS Score Workflow
|
|
@@ -35,6 +35,91 @@ If no type is specified (bare model name), assume `.mas` (MAS model).
|
|
|
35
35
|
|
|
36
36
|
---
|
|
37
37
|
|
|
38
|
+
## ⚠️ MANDATORY: ROUTING DECISION (DO THIS FIRST)
|
|
39
|
+
|
|
40
|
+
**CRITICAL: This decision must be completed BEFORE invoking ANY scoring tool.**
|
|
41
|
+
|
|
42
|
+
When a user requests scoring with a model name (e.g., `score a=10,b=20 with model simplejob.job`):
|
|
43
|
+
|
|
44
|
+
### Step 1: Extract the Type Suffix
|
|
45
|
+
Check if the model name contains a dot:
|
|
46
|
+
- **YES** (e.g., `simplejob.job`) → Split on the last dot to extract type: `job`
|
|
47
|
+
- **NO** (e.g., `churn`) → Assume type is `.mas` (default MAS model)
|
|
48
|
+
|
|
49
|
+
### Step 2: Validate the Type
|
|
50
|
+
Confirm the extracted type is one of: `job`, `jobdef`, `mas`, `scr`, `sas`
|
|
51
|
+
- **VALID** → Proceed to Step 3
|
|
52
|
+
- **INVALID** (e.g., `.xyz`) → Assume `.mas` and treat entire input as model name
|
|
53
|
+
|
|
54
|
+
### Step 3: Strip the Type Suffix
|
|
55
|
+
Remove the `.type` from the model name:
|
|
56
|
+
- `simplejob.job` → base name: `simplejob`
|
|
57
|
+
- `churn.mas` → base name: `churn`
|
|
58
|
+
- `fraud_detector.jobdef` → base name: `fraud_detector`
|
|
59
|
+
|
|
60
|
+
### Step 4: Route to the Correct Tool
|
|
61
|
+
Invoke the tool that matches the type:
|
|
62
|
+
- **`.job`** → `sas-score-run-job`
|
|
63
|
+
- **`.jobdef`** → `sas-score-run-jobdef`
|
|
64
|
+
- **`.mas`** → `sas-score-model-score`
|
|
65
|
+
- **`.scr`** → `sas-score-scr-score`
|
|
66
|
+
- **`.sas`** → `sas-score-run-sas-program`
|
|
67
|
+
|
|
68
|
+
### Step 5: Invoke with Correct Parameters
|
|
69
|
+
Pass the base name (without type) to the routed tool.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Routing Decision Tree
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
User request: "score a=10,b=20 with model simplejob.job"
|
|
77
|
+
↓
|
|
78
|
+
[Extract model reference] → "simplejob.job"
|
|
79
|
+
↓
|
|
80
|
+
[Split on last dot] → base="simplejob", type="job"
|
|
81
|
+
↓
|
|
82
|
+
[Validate type] → "job" ∈ [job, jobdef, mas, scr, sas]? YES
|
|
83
|
+
↓
|
|
84
|
+
[Route by type]
|
|
85
|
+
└─ type="job" → call sas-score-run-job()
|
|
86
|
+
↓
|
|
87
|
+
[Invoke tool] → sas-score-run-job({ name: "simplejob", scenario: {a: "10", b: "20"} })
|
|
88
|
+
↓
|
|
89
|
+
[Return results]
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## ❌ Anti-Patterns (DO NOT DO THIS)
|
|
95
|
+
|
|
96
|
+
These mistakes cause incorrect routing:
|
|
97
|
+
|
|
98
|
+
| Request | Wrong Tool Called | Why It's Wrong | Correct Tool |
|
|
99
|
+
|---------|-------------------|----------------|---------------|
|
|
100
|
+
| `score simplejob.job scenario =a=10,b=20` | `deva-score` | `.job` suffix ignored; generic scorer used | `sas-score-run-job` |
|
|
101
|
+
| `score churn.mas where age=45` | `run-job` | Type mismatch; treated as job instead of MAS | `sas-score-model-score` |
|
|
102
|
+
| `score fraud.jobdef using amount=500` | `model-score` | Wrong tool for jobdef type | `sas-score-run-jobdef` |
|
|
103
|
+
| `score model.scr with scenario` | `run-jobdef` | SCR endpoint ignored | `sas-score-scr-score` |
|
|
104
|
+
| `score code.sas using x=1` | `model-score` | SAS program treated as MAS model | `sas-score-run-sas-program` |
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## ✅ Checkpoint Verification
|
|
109
|
+
|
|
110
|
+
Before invoking ANY tool, verify all checkpoints:
|
|
111
|
+
|
|
112
|
+
- [ ] **Did I extract the type correctly?** (Check: is it one of the 5 types: `job`, `jobdef`, `mas`, `scr`, `sas`?)
|
|
113
|
+
- [ ] **Did I strip the type suffix from the model name?** (Pass base name only: `simplejob`, not `simplejob.job`)
|
|
114
|
+
- [ ] **Does the routing match the type?** (e.g., `.job` → `run-job`, `.mas` → `model-score`)
|
|
115
|
+
- [ ] **Am I using the correct parameter name?** (e.g., `name:` for jobs/jobdefs, `model:` for MAS, `url:` for SCR)
|
|
116
|
+
- [ ] **Is the scenario parsed correctly?** (e.g., `{ a: "10", b: "20" }` from `a=10,b=20`)
|
|
117
|
+
- [ ] **Have I considered if this is the default MAS case?** (If no type, assume `.mas` and use `model-score`)
|
|
118
|
+
|
|
119
|
+
⚠️ **All checkboxes must be ✓ before invoking the tool.**
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
38
123
|
## Type-Based Routing
|
|
39
124
|
|
|
40
125
|
### Parse and Strip Model Type
|
|
@@ -296,6 +381,8 @@ Merge the scoring output back with the input records and present as a table wher
|
|
|
296
381
|
| Scoring error / invalid inputs | Return structured error, suggest `model-info` to check required inputs and data types |
|
|
297
382
|
| Empty read result | Tell user, ask if they want to adjust the query/filter before scoring |
|
|
298
383
|
| Missing input fields | Ask which table columns map to the required model inputs |
|
|
384
|
+
| **Type routing error (wrong tool called)** | **Check: did I complete the MANDATORY routing decision? Did I extract the type correctly? Did I route to the right tool based on type?** |
|
|
385
|
+
| **Type suffix not recognized** | **Assume `.mas` (default MAS model) and treat entire input as model name** |
|
|
299
386
|
|
|
300
387
|
---
|
|
301
388
|
|
package/src/toolSet/findTable.js
CHANGED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: mcp-tool-description-optimizer
|
|
3
|
-
description: >
|
|
4
|
-
Optimize MCP (Model Context Protocol) tool descriptions for token efficiency and LLM routing accuracy.
|
|
5
|
-
Use this skill whenever a user shares a raw, verbose, or poorly structured MCP tool description and wants
|
|
6
|
-
it improved, rewritten, or reviewed. Trigger on phrases like: "optimize this tool description",
|
|
7
|
-
"rewrite my MCP tool description", "make this tool description more efficient", "clean up my tool spec",
|
|
8
|
-
"improve how Claude picks my tool", or when a user pastes a JavaScript/TypeScript tool description string
|
|
9
|
-
and asks for help with it. Also trigger when the user mentions token efficiency, tool routing,
|
|
10
|
-
or LLM disambiguation in the context of MCP servers.
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
# MCP Tool Description Optimizer
|
|
14
|
-
|
|
15
|
-
Rewrites verbose or poorly structured MCP tool descriptions into compact, signal-rich versions that
|
|
16
|
-
improve LLM tool selection accuracy while reducing token usage.
|
|
17
|
-
|
|
18
|
-
## Why this matters
|
|
19
|
-
|
|
20
|
-
Claude and other LLMs select MCP tools based entirely on the `description` field. Descriptions that are
|
|
21
|
-
too long, redundant, or badly structured waste context tokens and reduce routing precision.
|
|
22
|
-
A well-optimized description:
|
|
23
|
-
- States what the tool does and when to use it upfront
|
|
24
|
-
- Eliminates redundancy (same info repeated across sections)
|
|
25
|
-
- Uses a compact, scannable format (labeled blocks, not nested markdown)
|
|
26
|
-
- Includes clear negative examples to prevent mis-routing
|
|
27
|
-
- Keeps parameters terse — name, type, default, one-line purpose
|
|
28
|
-
|
|
29
|
-
---
|
|
30
|
-
|
|
31
|
-
## Optimization Process
|
|
32
|
-
|
|
33
|
-
### Step 1 — Analyze the input description
|
|
34
|
-
|
|
35
|
-
Before rewriting, identify these problems in the original:
|
|
36
|
-
|
|
37
|
-
| Problem | Example |
|
|
38
|
-
|---|---|
|
|
39
|
-
| **Redundancy** | Trigger phrases listed in 3+ places |
|
|
40
|
-
| **Filler sections** | "Rationale", "Behavior Summary", "Response Contract" with no routing signal |
|
|
41
|
-
| **Orphaned syntax** | Arrows (`→`) or bullets with no target |
|
|
42
|
-
| **Overlong examples** | Long prose examples when one-liners suffice |
|
|
43
|
-
| **Heavy markdown** | `##` headers for every minor point |
|
|
44
|
-
| **Duplicated parameter docs** | Same param described in both a table and prose |
|
|
45
|
-
|
|
46
|
-
Call out 2–4 of the most impactful issues before writing the new version.
|
|
47
|
-
|
|
48
|
-
### Step 2 — Rewrite using the standard template
|
|
49
|
-
|
|
50
|
-
Use this exact block structure for the output. Omit blocks that don't apply.
|
|
51
|
-
|
|
52
|
-
```
|
|
53
|
-
<tool-name> — <one-line purpose>.
|
|
54
|
-
|
|
55
|
-
USE when: <comma-separated user intents or trigger phrases>
|
|
56
|
-
DO NOT USE for: <comma-separated anti-patterns with → redirect where applicable>
|
|
57
|
-
|
|
58
|
-
PARAMETERS
|
|
59
|
-
- <name>: <type> (default: <val>) — <one-line purpose>
|
|
60
|
-
...
|
|
61
|
-
|
|
62
|
-
ROUTING RULES
|
|
63
|
-
- "<trigger phrase>" → { param: value }
|
|
64
|
-
- "<trigger phrase>" → { param: value }
|
|
65
|
-
- <ambiguous case> → <ask for clarification | default behavior>
|
|
66
|
-
|
|
67
|
-
EXAMPLES
|
|
68
|
-
- "<user utterance>" → { param: value, ... }
|
|
69
|
-
- "<user utterance>" → { param: value, ... }
|
|
70
|
-
|
|
71
|
-
NEGATIVE EXAMPLES (do not route here)
|
|
72
|
-
- "<user utterance>" → <correct tool>
|
|
73
|
-
|
|
74
|
-
PAGINATION (include only if tool is paginated)
|
|
75
|
-
If returned count === limit → hint: next start = start + limit.
|
|
76
|
-
If start > 1 and result empty → note paging may exceed available items.
|
|
77
|
-
|
|
78
|
-
ERRORS
|
|
79
|
-
<One or two lines: return structure, hallucination policy>
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
### Step 3 — Apply these rules consistently
|
|
83
|
-
|
|
84
|
-
**USE/DO NOT USE block**
|
|
85
|
-
- Write as comma-separated inline list, not a bullet list
|
|
86
|
-
- DO NOT USE entries should name the redirect tool in parentheses where known
|
|
87
|
-
|
|
88
|
-
**ROUTING RULES block**
|
|
89
|
-
- One rule per line; quote the trigger phrase; use `→ { }` for param mapping
|
|
90
|
-
- Consolidate synonyms on one line: `"cas libs / cas libraries / in cas" → { server: 'cas' }`
|
|
91
|
-
- List the default/fallback rule last
|
|
92
|
-
|
|
93
|
-
**PARAMETERS block**
|
|
94
|
-
- One line per param: `- name: type (default: val) — purpose`
|
|
95
|
-
- Skip obvious params (e.g. don't explain what `limit` means if it's standard pagination)
|
|
96
|
-
|
|
97
|
-
**EXAMPLES block**
|
|
98
|
-
- Each example fits on one line
|
|
99
|
-
- For "next page" examples, include the prior call's state inline: `"next" (prev: start:1, limit:10) → { start: 11, limit: 10 }`
|
|
100
|
-
|
|
101
|
-
**NEGATIVE EXAMPLES block**
|
|
102
|
-
- Only include when mis-routing is a real risk
|
|
103
|
-
- Format: `"<utterance>" → <correct-tool-name>`
|
|
104
|
-
|
|
105
|
-
**Tone**
|
|
106
|
-
- Imperative, terse. No filler words ("Please note that...", "It is important to...")
|
|
107
|
-
- Never include a "Rationale" or "Behavior Summary" section — if behavior matters, encode it as a rule
|
|
108
|
-
|
|
109
|
-
### Step 4 — Validate before returning
|
|
110
|
-
|
|
111
|
-
Check the rewritten description against this list:
|
|
112
|
-
|
|
113
|
-
- [ ] No trigger phrase appears in more than one block
|
|
114
|
-
- [ ] No orphaned `→` arrows or dangling bullets
|
|
115
|
-
- [ ] Parameter defaults are stated explicitly
|
|
116
|
-
- [ ] Negative examples cover the tool's most common mis-routing risks
|
|
117
|
-
- [ ] Total length is ≤ 50% of the original (target: 30–40% reduction)
|
|
118
|
-
|
|
119
|
-
---
|
|
120
|
-
|
|
121
|
-
## Output format
|
|
122
|
-
|
|
123
|
-
Always return:
|
|
124
|
-
|
|
125
|
-
1. **Analysis** — 2–4 bullet points naming the key issues found in the original
|
|
126
|
-
2. **Rewritten description** — inside a JavaScript code block (matching the user's original code style)
|
|
127
|
-
3. **Change summary** — a short table or bullet list of what changed and why
|
|
128
|
-
|
|
129
|
-
See `references/examples.md` for before/after examples of real tool descriptions.
|
|
@@ -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,154 +0,0 @@
|
|
|
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
|
-
**If the user specifies the server explicitly** (e.g., "find library Public in cas"):
|
|
17
|
-
- Use the specified server: `server: "cas"` or `server: "sas"`
|
|
18
|
-
- Proceed directly to finding the library
|
|
19
|
-
|
|
20
|
-
**If the server is NOT specified:**
|
|
21
|
-
1. **First attempt**: Check CAS (`server: "cas"`)
|
|
22
|
-
2. **If not found in CAS**: Check SAS with uppercase library name (`server: "sas"`)
|
|
23
|
-
3. **If not found in either**:
|
|
24
|
-
- Inform user: *"The library '<lib>' was not found in CAS or SAS servers. Please verify the library name."*
|
|
25
|
-
- Suggest: *"Would you like to list available libraries?"* (suggest `sas-score-list-libraries`)
|
|
26
|
-
4. **If found**:
|
|
27
|
-
- Inform user which server contains the library: *"Found library '<lib>' in CAS"* or *"Found library '<lib>' in SAS"*
|
|
28
|
-
- Offer next steps: *"Would you like to list tables in this library?"* (suggest `sas-score-list-tables`)
|
|
29
|
-
|
|
30
|
-
---
|
|
31
|
-
|
|
32
|
-
## Using sas-score-find-library
|
|
33
|
-
|
|
34
|
-
**When:**
|
|
35
|
-
- User wants to verify a library exists
|
|
36
|
-
- User needs to determine which server contains a library
|
|
37
|
-
- User wants to check library availability before accessing it
|
|
38
|
-
- User wants to explore available libraries (before querying)
|
|
39
|
-
|
|
40
|
-
**How:**
|
|
41
|
-
```
|
|
42
|
-
sas-score-find-library({
|
|
43
|
-
name: "libraryname", // required
|
|
44
|
-
server: "cas" or "sas" // optional; determined by server check if not specified
|
|
45
|
-
})
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
**Rules:**
|
|
49
|
-
- Always determine the correct server first (cas → sas → neither)
|
|
50
|
-
- **For SAS server: always uppercase the library name** (e.g., "public" → "PUBLIC")
|
|
51
|
-
- If library name is missing, ask: *"Which library name would you like to find?"*
|
|
52
|
-
- Return the server where the library was found
|
|
53
|
-
- If not found in either server, clearly inform the user and offer to list available libraries
|
|
54
|
-
- Do not proceed with table access until library existence is confirmed
|
|
55
|
-
|
|
56
|
-
---
|
|
57
|
-
|
|
58
|
-
## Smart server detection logic
|
|
59
|
-
|
|
60
|
-
```
|
|
61
|
-
IF server specified by user
|
|
62
|
-
→ IF server is "sas"
|
|
63
|
-
→ uppercase lib
|
|
64
|
-
→ use that server, call sas-score-find-library
|
|
65
|
-
ELSE
|
|
66
|
-
→ TRY sas-score-find-library(lib, server="cas")
|
|
67
|
-
IF library found
|
|
68
|
-
→ success, inform user: library found in CAS
|
|
69
|
-
ELSE
|
|
70
|
-
→ uppercase lib
|
|
71
|
-
→ TRY sas-score-find-library(lib.toUpperCase(), server="sas")
|
|
72
|
-
IF library found
|
|
73
|
-
→ success, inform user: library found in SAS
|
|
74
|
-
ELSE
|
|
75
|
-
→ inform user library not found in either server
|
|
76
|
-
→ offer to list available libraries
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
---
|
|
80
|
-
|
|
81
|
-
## Common patterns
|
|
82
|
-
|
|
83
|
-
**Pattern 1 — Find library, server unspecified**
|
|
84
|
-
> "Find library Public"
|
|
85
|
-
|
|
86
|
-
1. Try CAS: `sas-score-find-library({ name: "Public", server: "cas" })`
|
|
87
|
-
2. If not found, try SAS with uppercase: `sas-score-find-library({ name: "PUBLIC", server: "sas" })`
|
|
88
|
-
3. If found in CAS → *"Found library 'Public' in CAS. Would you like to list tables in it?"*
|
|
89
|
-
4. If found in SAS → *"Found library 'PUBLIC' in SAS. Would you like to list tables in it?"*
|
|
90
|
-
5. If not found → *"The library 'Public' was not found in CAS or SAS. Would you like to list available libraries?"*
|
|
91
|
-
|
|
92
|
-
**Pattern 2 — Find library with explicit server (CAS)**
|
|
93
|
-
> "Find library MyData in cas"
|
|
94
|
-
|
|
95
|
-
1. Skip server detection
|
|
96
|
-
2. Call: `sas-score-find-library({ name: "MyData", server: "cas" })`
|
|
97
|
-
3. Result → *"Found library 'MyData' in CAS"* or *"Library 'MyData' not found in CAS"*
|
|
98
|
-
|
|
99
|
-
**Pattern 3 — Find library with explicit server (SAS)**
|
|
100
|
-
> "Does library SASHELP exist in sas"
|
|
101
|
-
|
|
102
|
-
1. Skip server detection
|
|
103
|
-
2. Uppercase lib: `sas-score-find-library({ name: "SASHELP", server: "sas" })`
|
|
104
|
-
3. Result → *"Found library 'SASHELP' in SAS"* or *"Library 'SASHELP' not found in SAS"*
|
|
105
|
-
|
|
106
|
-
**Pattern 4 — Library not found, offer next steps**
|
|
107
|
-
> "Check if library staging exists"
|
|
108
|
-
|
|
109
|
-
1. Try CAS: `sas-score-find-library({ name: "staging", server: "cas" })` → not found
|
|
110
|
-
2. Try SAS: `sas-score-find-library({ name: "STAGING", server: "sas" })` → not found
|
|
111
|
-
3. Respond:
|
|
112
|
-
- *"The library 'staging' was not found in CAS or SAS."*
|
|
113
|
-
- *"Would you like to:"*
|
|
114
|
-
- *"List all available libraries? (use `sas-score-list-libraries`))"*
|
|
115
|
-
- *"Check a different library name?"*
|
|
116
|
-
|
|
117
|
-
**Pattern 5 — Library found, follow-up action**
|
|
118
|
-
> "Verify library samples exists"
|
|
119
|
-
|
|
120
|
-
1. Try CAS: `sas-score-find-library({ name: "samples", server: "cas" })` → found
|
|
121
|
-
2. Respond:
|
|
122
|
-
- *"Found library 'samples' in CAS."*
|
|
123
|
-
- *"Would you like to list tables in this library? (use `sas-score-list-tables`))"*
|
|
124
|
-
|
|
125
|
-
---
|
|
126
|
-
|
|
127
|
-
## Output presentation
|
|
128
|
-
|
|
129
|
-
**When library is found:**
|
|
130
|
-
```
|
|
131
|
-
✓ Found library '<lib>' in <SERVER>
|
|
132
|
-
|
|
133
|
-
Would you like to:
|
|
134
|
-
• List tables in this library (use sas-list-tables-smart skill)
|
|
135
|
-
• Read data from a specific table (use sas-read-strategy skill)
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
**When library is not found:**
|
|
139
|
-
```
|
|
140
|
-
✗ Library '<lib>' not found in either CAS or SAS
|
|
141
|
-
|
|
142
|
-
Suggestions:
|
|
143
|
-
• Check the spelling of the library name
|
|
144
|
-
• List available libraries (use list-libraries tool)
|
|
145
|
-
• Try a different library name
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
---
|
|
149
|
-
|
|
150
|
-
## Integration with other skills
|
|
151
|
-
|
|
152
|
-
- **After finding library → List tables**: Use `sas-list-tables-smart` skill to browse available tables
|
|
153
|
-
- **After finding library → Read data**: Use `sas-read-strategy` skill to retrieve data from tables
|
|
154
|
-
- **Library not found → Explore**: Use `sas-score-list-libraries` tool to see all available libraries
|