@sassoftware/sas-score-mcp-serverjs 0.4.1-1 → 0.4.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.
- package/package.json +1 -1
- package/src/createMcpServer.js +3 -5
- package/src/toolSet/devaScore.js +62 -61
- package/src/toolSet/findJob.js +1 -1
- package/src/toolSet/findJobdef.js +2 -2
- package/src/toolSet/findLibrary.js +67 -67
- package/src/toolSet/findModel.js +2 -2
- package/src/toolSet/findTable.js +3 -2
- package/src/toolSet/getEnv.js +8 -4
- package/src/toolSet/listJobdefs.js +61 -61
- package/src/toolSet/listJobs.js +61 -61
- package/src/toolSet/listLibraries.js +78 -78
- package/src/toolSet/listModels.js +56 -56
- package/src/toolSet/listTables.js +65 -65
- package/src/toolSet/modelInfo.js +2 -2
- package/src/toolSet/modelScore.js +6 -5
- package/src/toolSet/readTable.js +63 -65
- package/src/toolSet/runCasProgram.js +7 -6
- package/src/toolSet/runJob.js +81 -81
- package/src/toolSet/runJobdef.js +82 -82
- package/src/toolSet/runMacro.js +80 -80
- package/src/toolSet/runProgram.js +2 -2
- package/src/toolSet/sasQuery.js +77 -78
- package/src/toolSet/scrInfo.js +1 -1
- package/src/toolSet/scrScore.js +70 -68
- package/src/toolSet/setContext.js +65 -65
- package/src/toolSet/superstat.js +61 -59
- package/src/toolSet/tableInfo.js +57 -57
- package/skills/mcp-tool-description-optimizer/SKILL.md +0 -129
- package/skills/mcp-tool-description-optimizer/references/examples.md +0 -123
- package/skills/sas-read-and-score/SKILL.md +0 -91
- package/skills/sas-read-strategy/SKILL.md +0 -143
- package/skills/sas-score-workflow/SKILL.md +0 -283
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © 2025, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
|
|
3
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
*/
|
|
5
|
-
import { z } from 'zod';
|
|
6
|
-
import _listLibrary from '../toolHelpers/_listLibrary.js';
|
|
7
|
-
function listLibraries(_appContext) {
|
|
8
|
-
let description = `
|
|
9
|
-
list-libraries — enumerate CAS or SAS libraries.
|
|
10
|
-
|
|
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.
|
|
13
|
-
|
|
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: '')
|
|
19
|
-
|
|
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' }
|
|
29
|
-
|
|
30
|
-
EXAMPLES
|
|
31
|
-
- "list libraries" → { server: 'all', start: 1, limit: 10 }
|
|
32
|
-
- "list libs " → { server: 'all', start: 1, limit: 10 }
|
|
33
|
-
|
|
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?"
|
|
39
|
-
|
|
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
|
|
44
|
-
|
|
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.
|
|
48
|
-
|
|
49
|
-
ERRORS
|
|
50
|
-
Return structured error with a message field. Never hallucinate library names.
|
|
51
|
-
`;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
// Canonical kebab-case tool name; legacy aliases preserved for compatibility
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
let spec = {
|
|
58
|
-
name: 'list-libraries',
|
|
59
|
-
description: description,
|
|
60
|
-
inputSchema:z.object(
|
|
61
|
-
server: z.string(),
|
|
62
|
-
limit: z.number(),
|
|
63
|
-
start: z.number()
|
|
64
|
-
where: z.string()
|
|
65
|
-
}),
|
|
66
|
-
// 'server' has a default so we don't mark it required
|
|
67
|
-
handler: async (params) => {
|
|
68
|
-
// normalize server just in case caller sends 'CAS'/'SAS'
|
|
69
|
-
params.server = (params.server || 'all').toLowerCase();
|
|
70
|
-
|
|
71
|
-
let r = await _listLibrary(params);
|
|
72
|
-
return r;
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
return spec;
|
|
76
|
-
}
|
|
77
|
-
export default listLibraries;
|
|
78
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © 2025, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import _listLibrary from '../toolHelpers/_listLibrary.js';
|
|
7
|
+
function listLibraries(_appContext) {
|
|
8
|
+
let description = `
|
|
9
|
+
list-libraries — enumerate CAS or SAS libraries.
|
|
10
|
+
|
|
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.
|
|
13
|
+
|
|
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: '')
|
|
19
|
+
|
|
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' }
|
|
29
|
+
|
|
30
|
+
EXAMPLES
|
|
31
|
+
- "list libraries" → { server: 'all', start: 1, limit: 10 }
|
|
32
|
+
- "list libs " → { server: 'all', start: 1, limit: 10 }
|
|
33
|
+
|
|
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?"
|
|
39
|
+
|
|
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
|
|
44
|
+
|
|
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.
|
|
48
|
+
|
|
49
|
+
ERRORS
|
|
50
|
+
Return structured error with a message field. Never hallucinate library names.
|
|
51
|
+
`;
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
// Canonical kebab-case tool name; legacy aliases preserved for compatibility
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
let spec = {
|
|
58
|
+
name: 'list-libraries',
|
|
59
|
+
description: description,
|
|
60
|
+
inputSchema: z.object({
|
|
61
|
+
server: z.string().optional(),
|
|
62
|
+
limit: z.number().optional(),
|
|
63
|
+
start: z.number().optional(),
|
|
64
|
+
where: z.string().optional()
|
|
65
|
+
}),
|
|
66
|
+
// 'server' has a default so we don't mark it required
|
|
67
|
+
handler: async (params) => {
|
|
68
|
+
// normalize server just in case caller sends 'CAS'/'SAS'
|
|
69
|
+
params.server = (params.server || 'all').toLowerCase();
|
|
70
|
+
|
|
71
|
+
let r = await _listLibrary(params);
|
|
72
|
+
return r;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
return spec;
|
|
76
|
+
}
|
|
77
|
+
export default listLibraries;
|
|
78
|
+
|
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © 2025, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
|
|
3
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { z } from 'zod';
|
|
7
|
-
import _listModels from '../toolHelpers/_listModels.js';
|
|
8
|
-
|
|
9
|
-
function listModels(_appContext) {
|
|
10
|
-
let description = `
|
|
11
|
-
list-models — enumerate models published to MAS.
|
|
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
|
|
15
|
-
|
|
16
|
-
PARAMETERS
|
|
17
|
-
- limit: number (default: 10) — page size
|
|
18
|
-
- start: number (default: 1) — 1-based offset
|
|
19
|
-
|
|
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 }
|
|
24
|
-
|
|
25
|
-
EXAMPLES
|
|
26
|
-
- "list models" → { start:1, limit:10 }
|
|
27
|
-
- "list 25 models" → { start:1, limit:25 }
|
|
28
|
-
|
|
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)
|
|
34
|
-
|
|
35
|
-
ERRORS
|
|
36
|
-
Returns empty array if no models found.
|
|
37
|
-
`;
|
|
38
|
-
|
|
39
|
-
let spec = {
|
|
40
|
-
name: 'list-models',
|
|
41
|
-
description: description,
|
|
42
|
-
inputSchema: z.object({
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
handler: async (params) => {
|
|
47
|
-
let r = await _listModels(params);
|
|
48
|
-
return r;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return spec;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export default listModels;
|
|
56
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © 2025, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import _listModels from '../toolHelpers/_listModels.js';
|
|
8
|
+
|
|
9
|
+
function listModels(_appContext) {
|
|
10
|
+
let description = `
|
|
11
|
+
list-models — enumerate models published to MAS.
|
|
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
|
|
15
|
+
|
|
16
|
+
PARAMETERS
|
|
17
|
+
- limit: number (default: 10) — page size
|
|
18
|
+
- start: number (default: 1) — 1-based offset
|
|
19
|
+
|
|
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 }
|
|
24
|
+
|
|
25
|
+
EXAMPLES
|
|
26
|
+
- "list models" → { start:1, limit:10 }
|
|
27
|
+
- "list 25 models" → { start:1, limit:25 }
|
|
28
|
+
|
|
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)
|
|
34
|
+
|
|
35
|
+
ERRORS
|
|
36
|
+
Returns empty array if no models found.
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
let spec = {
|
|
40
|
+
name: 'list-models',
|
|
41
|
+
description: description,
|
|
42
|
+
inputSchema: z.object({
|
|
43
|
+
limit: z.number().optional(),
|
|
44
|
+
start: z.number().optional()
|
|
45
|
+
}),
|
|
46
|
+
handler: async (params) => {
|
|
47
|
+
let r = await _listModels(params);
|
|
48
|
+
return r;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return spec;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export default listModels;
|
|
56
|
+
|
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © 2025, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
|
|
3
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { z } from 'zod';
|
|
7
|
-
import debug from 'debug';
|
|
8
|
-
import _listTables from '../toolHelpers/_listTables.js';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
function listTables(_appContext) {
|
|
12
|
-
const log = debug('tools');
|
|
13
|
-
|
|
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.
|
|
44
|
-
`;
|
|
45
|
-
|
|
46
|
-
let spec = {
|
|
47
|
-
name: 'list-tables',
|
|
48
|
-
description: description,
|
|
49
|
-
|
|
50
|
-
inputSchema: z.object({
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}),
|
|
56
|
-
handler: async (params) => {
|
|
57
|
-
let r = await _listTables(params);
|
|
58
|
-
return r;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return spec;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export default listTables;
|
|
65
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © 2025, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import debug from 'debug';
|
|
8
|
+
import _listTables from '../toolHelpers/_listTables.js';
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
function listTables(_appContext) {
|
|
12
|
+
const log = debug('tools');
|
|
13
|
+
|
|
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.
|
|
44
|
+
`;
|
|
45
|
+
|
|
46
|
+
let spec = {
|
|
47
|
+
name: 'list-tables',
|
|
48
|
+
description: description,
|
|
49
|
+
|
|
50
|
+
inputSchema: z.object({
|
|
51
|
+
lib: z.string(),
|
|
52
|
+
server: z.string().optional(),
|
|
53
|
+
limit: z.number().optional(),
|
|
54
|
+
start: z.number().optional()
|
|
55
|
+
}),
|
|
56
|
+
handler: async (params) => {
|
|
57
|
+
let r = await _listTables(params);
|
|
58
|
+
return r;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return spec;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export default listTables;
|
|
65
|
+
|
package/src/toolSet/modelInfo.js
CHANGED
|
@@ -41,7 +41,7 @@ Returns model metadata: inputs (name, type, role), outputs (name, type, possible
|
|
|
41
41
|
name: 'model-info',
|
|
42
42
|
description: description,
|
|
43
43
|
inputSchema: z.object({
|
|
44
|
-
|
|
44
|
+
model: z.string()
|
|
45
45
|
}),
|
|
46
46
|
handler: async (params) => {
|
|
47
47
|
let r = await _masDescribe(params);
|
|
@@ -52,4 +52,4 @@ Returns model metadata: inputs (name, type, role), outputs (name, type, possible
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
export default modelInfo;
|
|
55
|
-
|
|
55
|
+
|
|
@@ -42,11 +42,12 @@ Returns predictions, probabilities, scores merged with input data. Returns error
|
|
|
42
42
|
let spec = {
|
|
43
43
|
name: 'model-score',
|
|
44
44
|
description: description,
|
|
45
|
-
inputSchema:
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
inputSchema:z.object({
|
|
46
|
+
model: z.string(),
|
|
47
|
+
scenario: z.string(),
|
|
48
|
+
uflag: z.boolean().optional()
|
|
49
49
|
}),
|
|
50
|
+
|
|
50
51
|
handler: async (iparams) => {
|
|
51
52
|
let params = {...iparams};
|
|
52
53
|
let scenario = params.scenario;
|
|
@@ -85,4 +86,4 @@ Returns predictions, probabilities, scores merged with input data. Returns error
|
|
|
85
86
|
}
|
|
86
87
|
|
|
87
88
|
export default modelScore;
|
|
88
|
-
|
|
89
|
+
|
package/src/toolSet/readTable.js
CHANGED
|
@@ -1,65 +1,63 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © 2025, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
|
|
3
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
*/
|
|
5
|
-
import { z } from 'zod';
|
|
6
|
-
import debug from 'debug';
|
|
7
|
-
|
|
8
|
-
import _readTable from '../toolHelpers/_readTable.js';
|
|
9
|
-
function readTable(_appContext) {
|
|
10
|
-
|
|
11
|
-
let describe = `
|
|
12
|
-
read-table — retrieve rows from a table in a CAS or SAS library.
|
|
13
|
-
|
|
14
|
-
USE when: read table, show rows, read from library, filtered data with WHERE
|
|
15
|
-
DO NOT USE for: list tables, table structure (use table-info), SQL queries (use sas-query), SAS programs
|
|
16
|
-
|
|
17
|
-
PARAMETERS
|
|
18
|
-
- table: string — table name (required)
|
|
19
|
-
- lib: string — caslib or libref (required)
|
|
20
|
-
- server: string (default: 'cas') — 'cas' or 'sas'
|
|
21
|
-
- start: number (default: 1) — 1-based row index
|
|
22
|
-
- limit: number (default: 10) — max rows (1-1000)
|
|
23
|
-
- where: string — SQL WHERE clause filter
|
|
24
|
-
- format: boolean (default: true) — formatted or raw values
|
|
25
|
-
|
|
26
|
-
ROUTING RULES
|
|
27
|
-
- "read table cars in Samples" → { table: "cars", lib: "Samples", start: 1, limit: 10 }
|
|
28
|
-
- "show 25 rows from customers" → { table: "customers", lib: "<lib>", limit: 25, start: 1 }
|
|
29
|
-
- "read from mylib.orders where status='shipped'" → { table: "orders", lib: "mylib", where: "status='shipped'", start: 1, limit: 10 }
|
|
30
|
-
|
|
31
|
-
EXAMPLES
|
|
32
|
-
- "read table cars in Samples" → { table: "cars", lib: "Samples", start: 1, limit: 10 }
|
|
33
|
-
- "show 25 rows from customers" → { table: "customers", lib: "mylib", limit: 25, start: 1 }
|
|
34
|
-
|
|
35
|
-
NEGATIVE EXAMPLES (do not route here)
|
|
36
|
-
- "list tables in Samples" (use list-tables)
|
|
37
|
-
- "what columns are in cars" (use table-info)
|
|
38
|
-
- "execute SQL query" (use sas-query)
|
|
39
|
-
- "run SAS code" (use run-sas-program)
|
|
40
|
-
|
|
41
|
-
ERRORS
|
|
42
|
-
Returns rows array, total count, filtered_count, columns metadata. Empty array if no matches.
|
|
43
|
-
`;
|
|
44
|
-
|
|
45
|
-
let specs = {
|
|
46
|
-
name: 'read-table',
|
|
47
|
-
description: describe,
|
|
48
|
-
inputSchema: z.object({
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
export default readTable;
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © 2025, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import debug from 'debug';
|
|
7
|
+
|
|
8
|
+
import _readTable from '../toolHelpers/_readTable.js';
|
|
9
|
+
function readTable(_appContext) {
|
|
10
|
+
|
|
11
|
+
let describe = `
|
|
12
|
+
read-table — retrieve rows from a table in a CAS or SAS library.
|
|
13
|
+
|
|
14
|
+
USE when: read table, show rows, read from library, filtered data with WHERE
|
|
15
|
+
DO NOT USE for: list tables, table structure (use table-info), SQL queries (use sas-query), SAS programs
|
|
16
|
+
|
|
17
|
+
PARAMETERS
|
|
18
|
+
- table: string — table name (required)
|
|
19
|
+
- lib: string — caslib or libref (required)
|
|
20
|
+
- server: string (default: 'cas') — 'cas' or 'sas'
|
|
21
|
+
- start: number (default: 1) — 1-based row index
|
|
22
|
+
- limit: number (default: 10) — max rows (1-1000)
|
|
23
|
+
- where: string — SQL WHERE clause filter
|
|
24
|
+
- format: boolean (default: true) — formatted or raw values
|
|
25
|
+
|
|
26
|
+
ROUTING RULES
|
|
27
|
+
- "read table cars in Samples" → { table: "cars", lib: "Samples", start: 1, limit: 10 }
|
|
28
|
+
- "show 25 rows from customers" → { table: "customers", lib: "<lib>", limit: 25, start: 1 }
|
|
29
|
+
- "read from mylib.orders where status='shipped'" → { table: "orders", lib: "mylib", where: "status='shipped'", start: 1, limit: 10 }
|
|
30
|
+
|
|
31
|
+
EXAMPLES
|
|
32
|
+
- "read table cars in Samples" → { table: "cars", lib: "Samples", start: 1, limit: 10 }
|
|
33
|
+
- "show 25 rows from customers" → { table: "customers", lib: "mylib", limit: 25, start: 1 }
|
|
34
|
+
|
|
35
|
+
NEGATIVE EXAMPLES (do not route here)
|
|
36
|
+
- "list tables in Samples" (use list-tables)
|
|
37
|
+
- "what columns are in cars" (use table-info)
|
|
38
|
+
- "execute SQL query" (use sas-query)
|
|
39
|
+
- "run SAS code" (use run-sas-program)
|
|
40
|
+
|
|
41
|
+
ERRORS
|
|
42
|
+
Returns rows array, total count, filtered_count, columns metadata. Empty array if no matches.
|
|
43
|
+
`;
|
|
44
|
+
|
|
45
|
+
let specs = {
|
|
46
|
+
name: 'read-table',
|
|
47
|
+
description: describe,
|
|
48
|
+
inputSchema: z.object({
|
|
49
|
+
table: z.string(),
|
|
50
|
+
lib: z.string().optional(),
|
|
51
|
+
start: z.number().optional(),
|
|
52
|
+
limit: z.number().optional(),
|
|
53
|
+
server: z.string().optional(),
|
|
54
|
+
where: z.string().optional()
|
|
55
|
+
}),
|
|
56
|
+
handler: async (params) => {
|
|
57
|
+
let r = await _readTable(params,'query');
|
|
58
|
+
return r;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return specs;
|
|
62
|
+
}
|
|
63
|
+
export default readTable;
|
|
@@ -43,13 +43,14 @@ Log output and CAS results. If output table specified, returned as markdown tabl
|
|
|
43
43
|
let spec = {
|
|
44
44
|
name: 'run-cas-program',
|
|
45
45
|
description: description,
|
|
46
|
-
inputSchema:
|
|
46
|
+
inputSchema:z.object({
|
|
47
47
|
src: z.string(),
|
|
48
|
-
scenario: z.
|
|
49
|
-
output: z.string(),
|
|
50
|
-
folder: z.string(),
|
|
51
|
-
limit: z.number()
|
|
52
|
-
},
|
|
48
|
+
scenario: z.string(),
|
|
49
|
+
output: z.string().optional,
|
|
50
|
+
folder: z.string().optional,
|
|
51
|
+
limit: z.number().optional
|
|
52
|
+
}),
|
|
53
|
+
|
|
53
54
|
// NOTE: Previously 'required' incorrectly listed 'program' which does not
|
|
54
55
|
// exist in the schema. This prevented execution in some orchestrators that
|
|
55
56
|
// enforce required parameter presence, causing only descriptions to appear.
|