@sassoftware/sas-score-mcp-serverjs 0.4.0 → 0.4.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 (39) hide show
  1. package/cli.js +9 -127
  2. package/package.json +2 -3
  3. package/src/createMcpServer.js +0 -1
  4. package/src/expressMcpServer.js +27 -53
  5. package/src/handleGetDelete.js +3 -6
  6. package/src/hapiMcpServer.js +18 -10
  7. package/src/toolHelpers/_jobSubmit.js +0 -2
  8. package/src/toolHelpers/_listLibrary.js +39 -56
  9. package/src/toolHelpers/getLogonPayload.js +1 -3
  10. package/src/toolSet/devaScore.js +36 -28
  11. package/src/toolSet/findJob.js +49 -23
  12. package/src/toolSet/findJobdef.js +54 -24
  13. package/src/toolSet/findLibrary.js +57 -25
  14. package/src/toolSet/findModel.js +53 -31
  15. package/src/toolSet/findTable.js +54 -25
  16. package/src/toolSet/getEnv.js +38 -20
  17. package/src/toolSet/listJobdefs.js +58 -24
  18. package/src/toolSet/listJobs.js +72 -24
  19. package/src/toolSet/listLibraries.js +47 -37
  20. package/src/toolSet/listModels.js +47 -20
  21. package/src/toolSet/listTables.js +58 -29
  22. package/src/toolSet/makeTools.js +0 -3
  23. package/src/toolSet/modelInfo.js +49 -18
  24. package/src/toolSet/modelScore.js +69 -27
  25. package/src/toolSet/readTable.js +62 -25
  26. package/src/toolSet/runCasProgram.js +43 -23
  27. package/src/toolSet/runJob.js +19 -20
  28. package/src/toolSet/runJobdef.js +23 -21
  29. package/src/toolSet/runMacro.js +20 -20
  30. package/src/toolSet/runProgram.js +71 -24
  31. package/src/toolSet/sasQuery.js +70 -23
  32. package/src/toolSet/scrInfo.js +4 -3
  33. package/src/toolSet/setContext.js +48 -22
  34. package/src/toolSet/tableInfo.js +71 -28
  35. package/skills/mcp-tool-description-optimizer/SKILL.md +0 -129
  36. package/skills/mcp-tool-description-optimizer/references/examples.md +0 -123
  37. package/skills/sas-read-and-score/SKILL.md +0 -91
  38. package/skills/sas-read-strategy/SKILL.md +0 -143
  39. package/skills/sas-score-workflow/SKILL.md +0 -282
@@ -7,37 +7,71 @@ import _listJobdefs from '../toolHelpers/_listJobdefs.js';
7
7
  function listJobdefs(_appContext) {
8
8
 
9
9
  let description = `
10
- list-jobdefs — enumerate SAS Viya job definitions (jobdefs) assets.
10
+ ## list-jobdefs — enumerate SAS Viya job definitions assets(jobdefs)
11
11
 
12
- USE when: list jobdefs, show jobdefs, browse jobdefs, list available jobdefs, next page
13
- DO NOT USE for: find single jobdef (use find-jobdef), execute jobdef (use run-jobdef), find job (use find-job), sas code (use run-sas-program)
12
+ LLM Invocation Guidance (When to use)
13
+ jobdef and jobdefs are used interchangeably here to refer to job definitions.
14
+ Use THIS tool when the user wants to browse or list many job definitions assets
15
+ - "list jobdefs"
16
+ - "show jobdefs"
17
+ - "list available jobdefs"
18
+ - "browse jobdefs"
19
+ - "next jobdefs" (after a previous page)
20
+ - "list 25 jobdefs" / "list jobdefs limit 25"
21
+ Do NOT use this tool for:
22
+ - Checking existence of ONE job (use find-job)
23
+ - Executing/running a job (use run-job)
24
+ - Running a job definition (use run-jobdef)
25
+ - Submitting SAS code (use run-sas-program)
14
26
 
15
- PARAMETERS
16
- - limit: number (default: 10) — number of jobdefs per page
17
- - start: number (default: 1) — 1-based page offset
18
- - where: string (default: '') — optional filter expression
19
27
 
20
- ROUTING RULES
21
- - list jobdefs { start: 1, limit: 10 }
22
- - show me 25 jobdefs → { start: 1, limit: 25 }
23
- - next jobdefs → { start: previousStart + previousLimit, limit: previousLimit }
28
+ Purpose
29
+ Page through jobdef assets deployed/registered in SAS Viya.
24
30
 
25
- EXAMPLES
26
- - list jobdefs { start: 1, limit: 10 }
27
- - list 25 jobdefs → { start: 1, limit: 25 }
28
- - next jobdefs { start: 11, limit: 10 }
31
+ Parameters
32
+ - limit (number, default 10): Number of jobs to return.
33
+ - start (number, default 1): 1-based offset for paging.
34
+ - where (string, optional): Filter expression (future use / passthrough; empty string by default). If unsupported, it may be ignored gracefully.
29
35
 
30
- NEGATIVE EXAMPLES (do not route here)
31
- - find jobdef abc (use find-jobdef)
32
- - list jobs (use list-jobs)
33
- - run jobdef abc (use run-jobdef)
34
- - list models (use list-models)
36
+ Response Contract
37
+ - Returns an array of jobdef names or objects (backend-dependent) inside structuredContent.
38
+ - If items.length === limit, caller may request next page using start + limit.
39
+ - Provide optional hint start = start + limit when page might continue.
35
40
 
36
- PAGINATION
37
- If returned length === limit, hint: next start = start + limit. Empty result with start > 1 means paged past end.
41
+ Pagination Examples
42
+ - First page: { start:1, limit:10 }
43
+ - Next page: { start:11, limit:10 }
38
44
 
39
- ERRORS
40
- Surface backend error directly; never fabricate jobdef names.
45
+ Disambiguation & Clarification
46
+ - Input only "list" ask: "Specify asset to list? (Say 'Please specify what to listlist' to proceed)" unless prior context indicates job definition listing.
47
+ - Input contains "run"/"execute" plus job name → route to job/jobdef.
48
+
49
+ Negative Examples (should NOT call list-jobdefs)
50
+ - "list libraries" (use list-libraries)
51
+ - "list tables" (use list-tables)
52
+ - "list models" (use list-models)
53
+ - "list jobs" (use list-jobs)
54
+ - "find job abc" (findJob)
55
+ - "run job abc" (job)
56
+ - "job abc" (job)
57
+ - "find model xyz" (findModel)
58
+ - "list models" (listModels)
59
+ - "list tables in lib xyz" (listTables)
60
+ - "show me libraries" (listLibraries)
61
+ - "describe job abc" (findJob then possibly job for execution)
62
+
63
+ Error Handling
64
+ - On backend error: surface structured error payload (do not fabricate job names).
65
+ - Empty page (items.length === 0) with start > 1 may mean caller paged past end.
66
+
67
+ Usage Tips
68
+ - Increase limit for fewer round trips; keep reasonable to avoid large payloads.
69
+ - Combine with findJobdeffor confirmation before execution.
70
+
71
+ Examples (→ mapped params)
72
+ - "list jobdefs" → { start:1, limit:10 }
73
+ - "list 25 jobdefs" → { start:1, limit:25 }
74
+ - "next jobdefs" (after prior {start:1,limit:10}) → { start:11, limit:10 }
41
75
  `;
42
76
 
43
77
  let spec = {
@@ -5,39 +5,87 @@
5
5
  import { z } from 'zod';
6
6
  import _listJobs from '../toolHelpers/_listJobs.js';
7
7
  function listJobs(_appContext) {
8
+ // LLM guidance object retained for potential future consumption; not exported directly.
9
+ let llmDescription = {
10
+ purpose: "Map natural language requests to listJobs parameters and return a machine-readable response.",
11
+ param_mapping: {
12
+ limit: "positive integer. if not specified, set limit to 10",
13
+ start: "1-indexed offset. if not specified, set start to 1",
14
+ where: "optional filter string, default '' (may be ignored)"
15
+ },
16
+ response_schema: "{ jobs: string[] , start?: number }",
17
+ behavior: "Return only JSON matching response_schema. If ambiguous, ask at most one clarifying question. If no results, return { jobs: [] }. Include start when a full page is returned.",
18
+ examples: [
19
+ { input: "list jobs", mapped_params: { start: 1, limit: 10 } },
20
+ { input: "show me jobs, 20 per page", mapped_params: { start: 1, limit: 20 } },
21
+ { input: "next jobs", note: "interpret as start = previousStart + previousLimit" }
22
+ ],
23
+ safety: "Surface backend errors directly; do not hallucinate job names."
24
+ };
8
25
 
9
26
  let description = `
10
- list-jobs — enumerate SAS Viya job assets.
27
+ ## list-jobs — enumerate SAS Viya job assets
28
+
29
+ LLM Invocation Guidance (When to use)
30
+ Use THIS tool when the user wants to browse or list many job definitions / job assets:
31
+ - "list jobs"
32
+ - "show jobs"
33
+ - "list available jobs"
34
+ - "browse jobs"
35
+ - "next jobs" (after a previous page)
36
+ - "list 25 jobs" / "list jobs limit 25"
37
+
38
+ Do NOT use this tool for:
39
+ - Checking existence of ONE job (use find-job)
40
+ - Executing/running a job (use run-job)
41
+ - Running a job definition (use run-jobdef)
42
+ - Submitting SAS code (use run-sas-program)
43
+
44
+
45
+ Purpose
46
+ Page through job assets deployed/registered in SAS Viya Job Execution service.
47
+
48
+ Parameters
49
+ - limit (number, default 10): Number of jobs to return.
50
+ - start (number, default 1): 1-based offset for paging.
51
+ - where (string, optional): Filter expression (future use / passthrough; empty string by default). If unsupported, it may be ignored gracefully.
11
52
 
12
- USE when: list jobs, show jobs, browse jobs, list available jobs, next page
13
- DO NOT USE for: find single job (use find-job), execute job (use run-job), run job def (use run-jobdef), sas code (use run-sas-program)
53
+ Response Contract
54
+ - Returns an array of job names or objects (backend-dependent) inside structuredContent.
55
+ - If items.length === limit, caller may request next page using start + limit.
56
+ - Provide optional hint start = start + limit when page might continue.
14
57
 
15
- PARAMETERS
16
- - limit: number (default: 10) — number of jobs per page
17
- - start: number (default: 1) — 1-based page offset
18
- - where: string (default: '') — optional filter expression
58
+ Pagination Examples
59
+ - First page: { start:1, limit:10 }
60
+ - Next page: { start:11, limit:10 }
19
61
 
20
- ROUTING RULES
21
- - list jobs { start: 1, limit: 10 }
22
- - show me 25 jobs { start: 1, limit: 25 }
23
- - next jobs { start: previousStart + previousLimit, limit: previousLimit }
62
+ Disambiguation & Clarification
63
+ - Input only "list" → ask: "List jobs? (Say 'list jobs' to proceed)" unless prior context indicates jobs listing.
64
+ - "find job X"route to findJob instead.
65
+ - Input contains "run"/"execute" plus job name route to job/jobdef.
24
66
 
25
- EXAMPLES
26
- - list jobs { start: 1, limit: 10 }
27
- - list 25 jobs → { start: 1, limit: 25 }
28
- - next jobs → { start: 11, limit: 10 }
67
+ Negative Examples (should NOT call list-jobs)
68
+ - "find job abc" (find-job)
69
+ - "run job abc" (run-job)
70
+ - "job abc" (run-job)
71
+ - "find model xyz" (find-model)
72
+ - "list models" (list-models)
73
+ - "list tables in lib xyz" (list-tables)
74
+ - "show me libraries" (list-libraries)
75
+ - "describe job abc" (find-job then possibly run-job for execution)
29
76
 
30
- NEGATIVE EXAMPLES (do not route here)
31
- - find job abc (use find-job)
32
- - run job abc (use run-job)
33
- - list models (use list-models)
34
- - list tables in lib xyz (use list-tables)
77
+ Error Handling
78
+ - On backend error: surface structured error payload (do not fabricate job names).
79
+ - Empty page (items.length === 0) with start > 1 may mean caller paged past end.
35
80
 
36
- PAGINATION
37
- If returned length === limit, hint: next start = start + limit. Empty result with start > 1 means paged past end.
81
+ Usage Tips
82
+ - Increase limit for fewer round trips; keep reasonable to avoid large payloads.
83
+ - Combine with findJob for confirmation before execution.
38
84
 
39
- ERRORS
40
- Surface backend error directly; never fabricate job names.
85
+ Examples (→ mapped params)
86
+ - "list jobs" { start:1, limit:10 }
87
+ - "list 25 jobs" → { start:1, limit:25 }
88
+ - "next jobs" (after prior {start:1,limit:10}) → { start:11, limit:10 }
41
89
  `;
42
90
 
43
91
  let spec = {
@@ -5,50 +5,60 @@
5
5
  import { z } from 'zod';
6
6
  import _listLibrary from '../toolHelpers/_listLibrary.js';
7
7
  function listLibraries(_appContext) {
8
+
8
9
  let description = `
9
- list-libraries — enumerate CAS or SAS libraries.
10
+ ## list-libraries — enumerate CAS or SAS libraries
11
+
12
+ LLM Invocation Guidance (critical)
13
+ Use THIS tool when the user asks for: "list libs", "list libraries", "show cas libs", "show sas libs", "what libraries are available", "list caslib(s)", "enumerate libraries", "libraries in cas", "libraries in sas".
14
+ DO NOT use this tool when the user asks for: tables inside a specific library (choose listTables), 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
+ - "next" (after prior call) → { start: previous.start + previous.limit }
20
+ - "first 20 cas libs" → { server: 'cas', limit: 20 }
21
+ - If server unspecified: default to CAS.
10
22
 
11
- USE when user asks to: list/show/enumerate libraries, caslibs, sas libs, or available libraries.
12
- DO NOT USE for: listing tables in a library (→ list-tables), column/table metadata, job execution, models, scoring.
23
+ Parameters
24
+ - server (cas|sas, default 'cas')
25
+ - limit (integer > 0, default 10)
26
+ - start (1-based offset, default 1)
27
+ - where (optional filter expression, default '')
13
28
 
14
- PARAMETERS
15
- - server: 'cas' | 'sas' | 'all' (default: 'all')
16
- - limit: integer > 0 (default: 10)
17
- - start: 1-based offset (default: 1)
18
- - where: optional filter expression (default: '')
29
+ Response Contract
30
+ Return JSON-like structure from helper; consumers may extract an array of library objects/names. If number of returned items === limit supply a pagination hint: start = start + limit.
19
31
 
20
- ROUTING RULES
21
- - "cas libs / cas libraries / in cas" → { server: 'cas' }
22
- - "sas libs / sas libraries / in sas" → { server: 'sas' }
23
- - "all libs / all libraries" → { server: 'all' }
24
- - "list tables in <libname>" → route to list-tables, NOT here
25
- - server unspecified → default { server: 'all' }
26
- - "all cas libs" with no limit specified → { server: 'cas', limit: 50 } + paging note
27
- - "next" after prior call (start:S, limit:L) → { start: S + L, limit: L }
28
- - ambiguous "list" or "libs" with no context → assume { server: 'cas' }
32
+ Behavior Summary
33
+ - Pure listing; no side effects.
34
+ - If ambiguous short request like "list" or "libs" and no prior context: assume { server: 'cas' }.
35
+ - If user explicitly asks for ALL (e.g. "all cas libs") and count likely large, honor limit=50 unless user supplies a value; include note about paging.
29
36
 
30
- EXAMPLES
31
- - "list libraries" → { server: 'all', start: 1, limit: 10 }
32
- - "list libs " { server: 'all', start: 1, limit: 10 }
37
+ Disambiguation Rules
38
+ - If user mentions a singular library name plus desire for tables ("list tables in SASHELP") choose listTables (not this tool).
39
+ - If user mixes "tables" and "libraries" ask for clarification unless clearly about libraries.
33
40
 
34
- - "list all libs" → { server: 'all', start: 1, limit: 10 }
35
- - "list cas libraries" → { server: 'cas', start: 1, limit: 10 }
36
- - "show me 25 sas libs" → { server: 'sas', limit: 25, start: 1 }
37
- - "next" (prev: start:1,limit:10) → { server: <same>, start: 11, limit: 10 }
38
- - "filter cas libs" (no filter given) → ask: "What filter expression should I apply?"
41
+ Examples
42
+ - "list libraries" → { server: 'cas', start:1, limit:10 }
43
+ - "list libs" → { server: 'cas', start:1, limit:10 }
44
+ - "list sas libs" → { server: 'sas' }
45
+ - "show me 25 cas libraries" { server:'cas', limit:25 }
46
+ - "next" (after prior call {start:1,limit:10}) → { start:11, limit:10 }
47
+ - "filter cas libs" (no criterion) → ask: "Provide a filter or continue without one?"
39
48
 
40
- NEGATIVE EXAMPLES (do not route here)
41
- - "list tables in SASHELP" list-tables
42
- - "list models / jobs / jobdefs"→ respective tools
43
- - "run a program to create a lib" run-sas-program
49
+ Negative Examples (do not route here)
50
+ - "list tables in public" (route to list-tables)
51
+ - "list models, list tables, list jobs, list jobdef and similar request"
52
+ - "describe library" (likely list-tables or table-info depending on follow-up)
53
+ - "run program to make a lib" (run-sas-program tool)
44
54
 
45
- PAGINATION
46
- If returned item count === limit, hint: next start = start + limit.
47
- If start > 1 and result is empty, note paging may have exceeded available items.
55
+ Error Handling
56
+ - On backend error: return structured error with message field; do not hallucinate libraries.
57
+ - Empty result set return empty list plus (if start>1) a hint that paging may have exceeded available items.
48
58
 
49
- ERRORS
50
- Return structured error with a message field. Never hallucinate library names.
51
- `;
59
+ Rationale
60
+ Concise, signal-rich description increases probability this spec is selected for generic library enumeration intents.
61
+ `;
52
62
 
53
63
 
54
64
  // Canonical kebab-case tool name; legacy aliases preserved for compatibility
@@ -59,7 +69,7 @@ Return structured error with a message field. Never hallucinate library names.
59
69
  aliases: ['listLibraries','list libraries','list_libraries'],
60
70
  description: description,
61
71
  schema: {
62
- server: z.string().default('all'),
72
+ server: z.string().default('cas'),
63
73
  limit: z.number().default(10),
64
74
  start: z.number().default(1), // added default to match documentation
65
75
  where: z.string().default('')
@@ -68,7 +78,7 @@ Return structured error with a message field. Never hallucinate library names.
68
78
  required: [],
69
79
  handler: async (params) => {
70
80
  // normalize server just in case caller sends 'CAS'/'SAS'
71
- params.server = (params.server || 'all').toLowerCase();
81
+ params.server = (params.server || 'cas').toLowerCase();
72
82
 
73
83
  let r = await _listLibrary(params);
74
84
  return r;
@@ -8,32 +8,59 @@ import _listModels from '../toolHelpers/_listModels.js';
8
8
 
9
9
  function listModels(_appContext) {
10
10
  let description = `
11
- list-models — enumerate models published to MAS.
11
+ ## list-models — enumerate models published to MAS (Model Publish / Scoring service)
12
12
 
13
- USE when: list models, show models, browse models, next page
14
- DO NOT USE for: find model, model metadata, score model, list jobs/tables/libraries
13
+ LLM Invocation Guidance (When to use)
14
+ Use THIS tool when the user wants a collection of models, e.g.:
15
+ - "list models"
16
+ - "show models"
17
+ - "list available models"
18
+ - "browse models"
19
+ - "list 25 models" / "list models limit 25"
20
+ - "next models" (after a previous page)
15
21
 
16
- PARAMETERS
17
- - limit: number (default: 10) page size
18
- - start: number (default: 1) 1-based offset
22
+ Do NOT use this tool for:
23
+ - Checking a single model's existence (use find-model)
24
+ - Getting model metadata / variables (use model-info)
25
+ - Scoring a model (use model-score)
26
+ - list libraries, tables, jobs, or jobdefs (use respective list/find tools)
27
+ - Looking up jobs, libraries, tables, or SCR endpoints (route to respective tools)
19
28
 
20
- ROUTING RULES
21
- - "list models" { start:1, limit:10 }
22
- - "list 25 models" → { start:1, limit:25 }
23
- - "next models" → { start: start+limit, limit:10 }
29
+ Purpose
30
+ Provide a paginated view of MAS-registered models so the caller can then drill into one via modelInfo or score it.
24
31
 
25
- EXAMPLES
26
- - "list models" { start:1, limit:10 }
27
- - "list 25 models" { start:1, limit:25 }
32
+ Parameters
33
+ - limit (number, default 10): Number of models to return for this page.
34
+ - start (number, default 1): 1-based offset. For paging: start = start + limit.
28
35
 
29
- NEGATIVE EXAMPLES (do not route here)
30
- - "find model X" (use find-model)
31
- - "describe model X" (use model-info)
32
- - "score model X" (use model-score)
33
- - "list jobs" (use list-jobs)
36
+ Response Contract
37
+ - Returns an array of model entries (names or metadata objects). Empty array if no models.
38
+ - If returned length === limit, caller may request the next page.
34
39
 
35
- ERRORS
36
- Returns empty array if no models found.
40
+ Pagination Examples
41
+ - First page: { start:1, limit:10 }
42
+ - Next page: { start:11, limit:10 }
43
+
44
+ Disambiguation & Clarification
45
+ - Input only "list" → ask: "List models? (Say 'list models' to proceed)" unless prior context strongly indicates models.
46
+ - "find model X" → use find-model instead.
47
+ - "score model X" → use model-score.
48
+ - "describe model X" → use model-info.
49
+
50
+ Negative Examples (should NOT call list-models)
51
+ - "find model churn" (find-model)
52
+ - "model info customerRisk" (model-info)
53
+ - "score model sales_pred" (model-score)
54
+ - "list jobs" (list-jobs)
55
+
56
+ Usage Tips
57
+ - Combine with findModel for narrowing down after a broad list.
58
+ - Increase limit judiciously; very large pages can impact latency.
59
+
60
+ Examples (→ mapped params)
61
+ - "list models" → { start:1, limit:10 }
62
+ - "list 25 models" → { start:1, limit:25 }
63
+ - "next models" (after prior {start:1,limit:10}) → { start:11, limit:10 }
37
64
  `;
38
65
 
39
66
  let spec = {
@@ -12,35 +12,64 @@ function listTables(_appContext) {
12
12
  const log = debug('tools');
13
13
 
14
14
  let description = `
15
- list-tables — enumerate tables within a library.
16
-
17
- USE when: list tables in <lib>, show tables in <lib>, next page
18
- DO NOT USE for: find table, list libraries, get table structure (use table-info), read data (use read-table)
19
-
20
- PARAMETERS
21
- - lib: string library to inspect (required)
22
- - server: string (default: 'cas') — 'cas' or 'sas'
23
- - limit: number (default: 10) page size
24
- - start: number (default: 1) — 1-based offset
25
- - where: string optional filter expression
26
-
27
- ROUTING RULES
28
- - "list tables in Samples" → { lib: "Samples", start: 1, limit: 10 }
29
- - "list 25 tables in sashelp" → { lib: "sashelp", limit: 25, start: 1 }
30
- - "list cas tables in Public" { lib: "Public", server: "cas", start: 1, limit: 10 }
31
-
32
- EXAMPLES
33
- - "list tables in Samples" → { lib: "Samples", start: 1, limit: 10 }
34
- - "show 25 tables in sashelp" → { lib: "sashelp", limit: 25, start: 1 }
35
-
36
- NEGATIVE EXAMPLES (do not route here)
37
- - "list libs" (use list-libraries)
38
- - "find lib Public" (use find-library)
39
- - "describe table cars" (use table-info)
40
- - "read table cars" (use read-table)
41
-
42
- ERRORS
43
- Returns empty array if no tables found.
15
+ ## list-tables — enumerate tables within a specific CAS or SAS library
16
+
17
+ LLM Invocation Guidance (When to use)
18
+ Use THIS tool when the user explicitly wants the tables inside ONE library:
19
+ - "list tables in Samples"
20
+ - "show tables in sashelp"
21
+ - "list cas tables in Public"
22
+ - "list 25 tables in Samples"
23
+ - "next tables" (after a prior listTables call)
24
+
25
+ Do NOT use this tool to list the following
26
+ - lib -> use list-libraries
27
+ - list models -> use list-models
28
+ - list jobs -> use list-jobs
29
+ - list jobdefs -> use list-jobdefs
30
+ - Finding whether a library exists (use find-library)
31
+ - Describing a single table's columns or metadata (use table-info)
32
+ - Reading table data rows (use read-table)
33
+ - Listing jobs/models (other specialized tools)
34
+
35
+ Purpose
36
+ Return the names (and possibly lightweight metadata) of tables contained in a specified library (CAS caslib or SAS libref).
37
+
38
+ Parameters
39
+ - lib (string, required): Library to inspect (e.g. "Samples", "sashelp").
40
+ - server (cas|sas, default 'cas'): Target environment; default when unspecified is CAS.
41
+ - limit (number, default 10): Page size.
42
+ - start (number, default 1): 1-based offset for pagination.
43
+ - where (string, optional): Filter expression (if supported by backend) or ignored safely.
44
+
45
+ Response Contract
46
+ - JSON: { tables: string[] [, start:number]? }
47
+ - tables array is empty when no matches.
48
+ - Include start = start + limit when length === limit (possible more pages).
49
+
50
+ Pagination Examples
51
+ - First page: { lib:'Samples', start:1, limit:10 }
52
+ - Next page: { lib:'Samples', start:11, limit:10 }
53
+
54
+ Disambiguation & Clarification
55
+ - Missing library name → ask: "Which library do you want to list tables from?"
56
+ - Input only "list tables" → ask for the library unless prior context supplies one.
57
+ - If user mentions multiple libs ("tables in Public and Samples") → request a single library.
58
+
59
+ Negative Examples (should NOT call list-tables)
60
+ - "list libs" (list-libraries)
61
+ - "find lib Public" (find-library)
62
+ - "describe table cars" (table-info)
63
+ - "read table cars from sashelp" (read-table)
64
+
65
+ Usage Tips
66
+ - After listing, call table-info to inspect structure or read-table for sample data.
67
+ - Keep limit moderate; page for very large libraries.
68
+
69
+ Examples (→ mapped params)
70
+ - "list tables in samples" → { lib:"samples", start:1, limit:10 }
71
+ - "show 25 tables in sashelp" → { lib:"sashelp", limit:25, start:1 }
72
+ - "next tables" (after previous {start:1,limit:10}) → { start:11, limit:10, lib:<previousLib> }
44
73
  `;
45
74
 
46
75
  let spec = {
@@ -30,7 +30,6 @@ import findJobdef from './findJobdef.js';
30
30
 
31
31
  import sasQuery from './sasQuery.js';
32
32
  import setContext from './setContext.js';
33
- //import scoreSkill from './scoreSkill.js';
34
33
 
35
34
  function makeTools(_appContext) {
36
35
  // wrap all tools with
@@ -65,8 +64,6 @@ function makeTools(_appContext) {
65
64
  findJobdef(_appContext),
66
65
  runJobdef(_appContext),
67
66
 
68
- //scoreSkill(_appContext),
69
-
70
67
  devaScore(_appContext),
71
68
  setContext(_appContext)
72
69
 
@@ -10,32 +10,63 @@ const log = debug('tools');
10
10
 
11
11
  function modelInfo(_appContext) {
12
12
  let description = `
13
- model-info — retrieve detailed metadata for a deployed model.
13
+ ## model-info — retrieve detailed metadata for a deployed model
14
14
 
15
- USE when: what inputs does model need, describe model, show variables for model, model inputs/outputs
16
- DO NOT USE for: find model, list models, score model, table/job operations
15
+ LLM Invocation Guidance (When to use)
16
+ Use THIS tool when:
17
+ - User wants input/output variable information: "What inputs does model X need?"
18
+ - User wants to understand model variables: "Describe model myModel"
19
+ - User wants data types and roles: "Show me the variables for myModel"
20
+ - User wants to prepare data for scoring: "What are the required inputs for model sales_forecast?"
17
21
 
18
- PARAMETERS
19
- - model: string model name (required, exact match)
22
+ Do NOT use this tool for:
23
+ - Checking if a model exists (use find-model)
24
+ - Listing available models (use list-models)
25
+ - Scoring a model (use model-score)
26
+ - Looking up tables or jobs (use respective find/list tools)
20
27
 
21
- ROUTING RULES
22
- - "what inputs does model X need?" { model: "X" }
23
- - "describe model Y" → { model: "Y" }
24
- - "show variables for Z" → { model: "Z" }
28
+ Purpose
29
+ Retrieve detailed metadata for a model deployed to MAS (Model Aggregation Service). This includes input variable names, data types, roles/usage, ranges, and output variable information. Use this before scoring to understand what data the model requires.
25
30
 
26
- EXAMPLES
31
+ Parameters
32
+ - model (string, required): The name of the model as published to MAS. Must be exact match.
33
+
34
+ Response Contract
35
+ Returns a JSON object containing model metadata, typically including:
36
+ - name: The model name
37
+ - inputs: Array of input variable objects with:
38
+ - name: Variable name
39
+ - type: Data type (numeric, character, etc.)
40
+ - role: Role in model (input, key, etc.)
41
+ - allowed_values or range: Optional constraints
42
+ - outputs: Array of output/prediction objects with:
43
+ - name: Prediction/output variable name
44
+ - type: Data type
45
+ - possible_values: For classification models, the class labels
46
+ - model_type: Type of model (regression, classification, etc.)
47
+ - description: Optional model description
48
+
49
+ Disambiguation & Clarification
50
+ - If model name is missing: ask "Which model would you like to see information for?"
51
+ - If user says "variables" without specifying model: ask "Which model would you like the variables for?"
52
+ - Multiple model requests: handle one at a time
53
+
54
+ Examples (→ mapped params)
27
55
  - "What inputs does model churnRisk need?" → { model: "churnRisk" }
28
56
  - "Describe model creditScore" → { model: "creditScore" }
29
- - "Show variables for myModel" → { model: "myModel" }
57
+ - "Show the variables for myModel" → { model: "myModel" }
58
+ - "What are the outputs of model sales_forecast?" → { model: "sales_forecast" }
30
59
 
31
- NEGATIVE EXAMPLES (do not route here)
32
- - "list models" (use list-models)
33
- - "find model X" (use find-model)
34
- - "score with model X" (use model-score)
60
+ Negative Examples (should NOT call model-info)
61
+ - "List all available models" (use list-models instead)
62
+ - "Find model cancer" (use find-model instead)
63
+ - "Score this customer with model churnRisk" (use model-score instead)
35
64
 
36
- ERRORS
37
- Returns model metadata: inputs (name, type, role), outputs (name, type, possible_values), model_type, description.
38
- `;
65
+ Related Tools
66
+ - list-models find-model model-info model-score (typical workflow)
67
+ - find-model — to check if a specific model exists
68
+ - model-score — to score data using the model
69
+ `;
39
70
 
40
71
  let spec = {
41
72
  name: 'model-info',