@sassoftware/sas-score-mcp-serverjs 0.3.29-0 → 0.4.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.
- package/cli.js +118 -3
- package/openApi.yaml +121 -121
- package/package.json +4 -5
- package/skills/mcp-tool-description-optimizer/SKILL.md +129 -0
- package/skills/mcp-tool-description-optimizer/references/examples.md +123 -0
- package/skills/sas-read-and-score/SKILL.md +91 -0
- package/skills/sas-read-strategy/SKILL.md +143 -0
- package/skills/sas-score-workflow/SKILL.md +283 -0
- package/src/createMcpServer.js +11 -4
- package/src/expressMcpServer.js +1 -1
- package/src/handleGetDelete.js +1 -1
- package/src/openApi.yaml +121 -121
- package/src/toolHelpers/_jobSubmit.js +2 -0
- package/src/toolHelpers/_listLibrary.js +56 -39
- package/src/toolHelpers/readCerts.js +4 -4
- package/src/toolSet/devaScore.js +31 -44
- package/src/toolSet/findJob.js +37 -70
- package/src/toolSet/findJobdef.js +27 -58
- package/src/toolSet/findLibrary.js +29 -62
- package/src/toolSet/findModel.js +34 -57
- package/src/toolSet/findTable.js +29 -59
- package/src/toolSet/getEnv.js +26 -45
- package/src/toolSet/listJobdefs.js +30 -65
- package/src/toolSet/listJobs.js +30 -79
- package/src/toolSet/listLibraries.js +43 -55
- package/src/toolSet/listModels.js +25 -52
- package/src/toolSet/listTables.js +36 -66
- package/src/toolSet/makeTools.js +1 -0
- package/src/toolSet/modelInfo.js +21 -53
- package/src/toolSet/modelScore.js +30 -73
- package/src/toolSet/readTable.js +33 -72
- package/src/toolSet/runCasProgram.js +30 -51
- package/src/toolSet/runJob.js +24 -24
- package/src/toolSet/runJobdef.js +26 -29
- package/src/toolSet/runMacro.js +23 -24
- package/src/toolSet/runProgram.js +32 -80
- package/src/toolSet/sasQuery.js +31 -79
- package/src/toolSet/sasQueryTemplate.js +4 -5
- package/src/toolSet/sasQueryTemplate2.js +4 -5
- package/src/toolSet/scrInfo.js +4 -7
- package/src/toolSet/scrScore.js +2 -4
- package/src/toolSet/searchAssets.js +5 -6
- package/src/toolSet/setContext.js +30 -57
- package/src/toolSet/superstat.js +2 -3
- package/src/toolSet/tableInfo.js +32 -77
|
@@ -7,84 +7,48 @@ import _listJobdefs from '../toolHelpers/_listJobdefs.js';
|
|
|
7
7
|
function listJobdefs(_appContext) {
|
|
8
8
|
|
|
9
9
|
let description = `
|
|
10
|
-
|
|
10
|
+
list-jobdefs — enumerate SAS Viya job definitions (jobdefs) assets.
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
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)
|
|
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)
|
|
26
14
|
|
|
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
|
|
27
19
|
|
|
28
|
-
|
|
29
|
-
|
|
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 }
|
|
30
24
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
EXAMPLES
|
|
26
|
+
- list jobdefs → { start: 1, limit: 10 }
|
|
27
|
+
- list 25 jobdefs → { start: 1, limit: 25 }
|
|
28
|
+
- next jobdefs → { start: 11, limit: 10 }
|
|
35
29
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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)
|
|
40
35
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
- Next page: { start:11, limit:10 }
|
|
36
|
+
PAGINATION
|
|
37
|
+
If returned length === limit, hint: next start = start + limit. Empty result with start > 1 means paged past end.
|
|
44
38
|
|
|
45
|
-
|
|
46
|
-
|
|
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 }
|
|
39
|
+
ERRORS
|
|
40
|
+
Surface backend error directly; never fabricate jobdef names.
|
|
75
41
|
`;
|
|
76
42
|
|
|
77
43
|
let spec = {
|
|
78
44
|
name: 'list-jobdefs',
|
|
79
|
-
aliases: ['listJobdefs','list jobdefs','list_jobdefs'],
|
|
80
45
|
description: description,
|
|
81
|
-
|
|
82
|
-
limit: z.number()
|
|
83
|
-
start: z.number()
|
|
84
|
-
where: z.string()
|
|
85
|
-
},
|
|
46
|
+
inputSchema: z.object({
|
|
47
|
+
limit: z.number(),
|
|
48
|
+
start: z.number(),
|
|
49
|
+
where: z.string()
|
|
50
|
+
}),
|
|
86
51
|
// No 'server' required; backend context is implicit in helper
|
|
87
|
-
required: [],
|
|
88
52
|
handler: async (params) => {
|
|
89
53
|
// _listJobdefs handles all validation and defaults
|
|
90
54
|
const result = await _listJobdefs(params);
|
|
@@ -94,3 +58,4 @@ function listJobdefs(_appContext) {
|
|
|
94
58
|
return spec;
|
|
95
59
|
}
|
|
96
60
|
export default listJobdefs;
|
|
61
|
+
|
package/src/toolSet/listJobs.js
CHANGED
|
@@ -5,100 +5,50 @@
|
|
|
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
|
-
};
|
|
25
8
|
|
|
26
9
|
let description = `
|
|
27
|
-
|
|
10
|
+
list-jobs — enumerate SAS Viya job assets.
|
|
28
11
|
|
|
29
|
-
|
|
30
|
-
|
|
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"
|
|
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)
|
|
37
14
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
- Submitting SAS code (use run-sas-program)
|
|
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
|
|
43
19
|
|
|
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 }
|
|
44
24
|
|
|
45
|
-
|
|
46
|
-
|
|
25
|
+
EXAMPLES
|
|
26
|
+
- list jobs → { start: 1, limit: 10 }
|
|
27
|
+
- list 25 jobs → { start: 1, limit: 25 }
|
|
28
|
+
- next jobs → { start: 11, limit: 10 }
|
|
47
29
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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)
|
|
52
35
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
- If items.length === limit, caller may request next page using start + limit.
|
|
56
|
-
- Provide optional hint start = start + limit when page might continue.
|
|
36
|
+
PAGINATION
|
|
37
|
+
If returned length === limit, hint: next start = start + limit. Empty result with start > 1 means paged past end.
|
|
57
38
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
- Next page: { start:11, limit:10 }
|
|
61
|
-
|
|
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.
|
|
66
|
-
|
|
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)
|
|
76
|
-
|
|
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.
|
|
80
|
-
|
|
81
|
-
Usage Tips
|
|
82
|
-
- Increase limit for fewer round trips; keep reasonable to avoid large payloads.
|
|
83
|
-
- Combine with findJob for confirmation before execution.
|
|
84
|
-
|
|
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 }
|
|
39
|
+
ERRORS
|
|
40
|
+
Surface backend error directly; never fabricate job names.
|
|
89
41
|
`;
|
|
90
42
|
|
|
91
43
|
let spec = {
|
|
92
44
|
name: 'list-jobs',
|
|
93
|
-
aliases: ['listJobs','list jobs','list_jobs'],
|
|
94
45
|
description: description,
|
|
95
|
-
|
|
96
|
-
limit: z.number()
|
|
97
|
-
start: z.number()
|
|
98
|
-
where: z.string()
|
|
99
|
-
},
|
|
46
|
+
inputSchema: z.object({
|
|
47
|
+
limit: z.number(),
|
|
48
|
+
start: z.number(),
|
|
49
|
+
where: z.string()
|
|
50
|
+
}),
|
|
100
51
|
// No 'server' required; backend context is implicit in helper
|
|
101
|
-
required: [],
|
|
102
52
|
handler: async (params) => {
|
|
103
53
|
// _listJob handles all validation and defaults
|
|
104
54
|
const result = await _listJobs(params);
|
|
@@ -108,3 +58,4 @@ function listJobs(_appContext) {
|
|
|
108
58
|
return spec;
|
|
109
59
|
}
|
|
110
60
|
export default listJobs;
|
|
61
|
+
|
|
@@ -5,60 +5,50 @@
|
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import _listLibrary from '../toolHelpers/_listLibrary.js';
|
|
7
7
|
function listLibraries(_appContext) {
|
|
8
|
-
|
|
9
8
|
let description = `
|
|
10
|
-
|
|
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.
|
|
9
|
+
list-libraries — enumerate CAS or SAS libraries.
|
|
22
10
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
- limit (integer > 0, default 10)
|
|
26
|
-
- start (1-based offset, default 1)
|
|
27
|
-
- where (optional filter expression, default '')
|
|
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.
|
|
28
13
|
|
|
29
|
-
|
|
30
|
-
|
|
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: '')
|
|
31
19
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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' }
|
|
36
29
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
30
|
+
EXAMPLES
|
|
31
|
+
- "list libraries" → { server: 'all', start: 1, limit: 10 }
|
|
32
|
+
- "list libs " → { server: 'all', start: 1, limit: 10 }
|
|
40
33
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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?"
|
|
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?"
|
|
48
39
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
- "run program to make a lib" (run-sas-program tool)
|
|
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
|
|
54
44
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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.
|
|
58
48
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
49
|
+
ERRORS
|
|
50
|
+
Return structured error with a message field. Never hallucinate library names.
|
|
51
|
+
`;
|
|
62
52
|
|
|
63
53
|
|
|
64
54
|
// Canonical kebab-case tool name; legacy aliases preserved for compatibility
|
|
@@ -66,19 +56,17 @@ function listLibraries(_appContext) {
|
|
|
66
56
|
|
|
67
57
|
let spec = {
|
|
68
58
|
name: 'list-libraries',
|
|
69
|
-
aliases: ['listLibraries','list libraries','list_libraries'],
|
|
70
59
|
description: description,
|
|
71
|
-
|
|
72
|
-
server: z.string()
|
|
73
|
-
limit: z.number()
|
|
74
|
-
start: z.number()
|
|
75
|
-
where: z.string()
|
|
76
|
-
},
|
|
60
|
+
inputSchema:z.object( {
|
|
61
|
+
server: z.string(),
|
|
62
|
+
limit: z.number(),
|
|
63
|
+
start: z.number(),// added default to match documentation
|
|
64
|
+
where: z.string()
|
|
65
|
+
}),
|
|
77
66
|
// 'server' has a default so we don't mark it required
|
|
78
|
-
required: [],
|
|
79
67
|
handler: async (params) => {
|
|
80
68
|
// normalize server just in case caller sends 'CAS'/'SAS'
|
|
81
|
-
params.server = (params.server || '
|
|
69
|
+
params.server = (params.server || 'all').toLowerCase();
|
|
82
70
|
|
|
83
71
|
let r = await _listLibrary(params);
|
|
84
72
|
return r;
|
|
@@ -87,4 +75,4 @@ function listLibraries(_appContext) {
|
|
|
87
75
|
return spec;
|
|
88
76
|
}
|
|
89
77
|
export default listLibraries;
|
|
90
|
-
|
|
78
|
+
|
|
@@ -8,69 +8,41 @@ import _listModels from '../toolHelpers/_listModels.js';
|
|
|
8
8
|
|
|
9
9
|
function listModels(_appContext) {
|
|
10
10
|
let description = `
|
|
11
|
-
|
|
11
|
+
list-models — enumerate models published to MAS.
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
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)
|
|
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
|
|
21
15
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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)
|
|
16
|
+
PARAMETERS
|
|
17
|
+
- limit: number (default: 10) — page size
|
|
18
|
+
- start: number (default: 1) — 1-based offset
|
|
28
19
|
|
|
29
|
-
|
|
30
|
-
|
|
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 }
|
|
31
24
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
EXAMPLES
|
|
26
|
+
- "list models" → { start:1, limit:10 }
|
|
27
|
+
- "list 25 models" → { start:1, limit:25 }
|
|
35
28
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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)
|
|
39
34
|
|
|
40
|
-
|
|
41
|
-
|
|
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 }
|
|
35
|
+
ERRORS
|
|
36
|
+
Returns empty array if no models found.
|
|
64
37
|
`;
|
|
65
38
|
|
|
66
39
|
let spec = {
|
|
67
40
|
name: 'list-models',
|
|
68
|
-
aliases: ['listModels','list models','list_models'],
|
|
69
41
|
description: description,
|
|
70
|
-
|
|
71
|
-
'limit': z.number()
|
|
72
|
-
'start': z.number()
|
|
73
|
-
},
|
|
42
|
+
inputSchema: z.object({
|
|
43
|
+
'limit': z.number(),
|
|
44
|
+
'start': z.number()
|
|
45
|
+
}),
|
|
74
46
|
handler: async (params) => {
|
|
75
47
|
let r = await _listModels(params);
|
|
76
48
|
return r;
|
|
@@ -81,3 +53,4 @@ function listModels(_appContext) {
|
|
|
81
53
|
}
|
|
82
54
|
|
|
83
55
|
export default listModels;
|
|
56
|
+
|
|
@@ -12,78 +12,47 @@ function listTables(_appContext) {
|
|
|
12
12
|
const log = debug('tools');
|
|
13
13
|
|
|
14
14
|
let description = `
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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> }
|
|
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.
|
|
73
44
|
`;
|
|
74
45
|
|
|
75
46
|
let spec = {
|
|
76
|
-
|
|
77
|
-
aliases: ['listTables','list tables','list_tables'],
|
|
47
|
+
name: 'list-tables',
|
|
78
48
|
description: description,
|
|
79
49
|
|
|
80
|
-
|
|
50
|
+
inputSchema: z.object({
|
|
81
51
|
'lib': z.string(),
|
|
82
|
-
'server': z.string()
|
|
83
|
-
'limit': z.number()
|
|
84
|
-
'start': z.number()
|
|
85
|
-
},
|
|
86
|
-
required: ['lib'],
|
|
52
|
+
'server': z.string(),
|
|
53
|
+
'limit': z.number(),
|
|
54
|
+
'start': z.number()
|
|
55
|
+
}),
|
|
87
56
|
handler: async (params) => {
|
|
88
57
|
let r = await _listTables(params);
|
|
89
58
|
return r;
|
|
@@ -93,3 +62,4 @@ function listTables(_appContext) {
|
|
|
93
62
|
}
|
|
94
63
|
|
|
95
64
|
export default listTables;
|
|
65
|
+
|
package/src/toolSet/makeTools.js
CHANGED