@sassoftware/sas-score-mcp-serverjs 0.4.0 → 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.
Files changed (41) hide show
  1. package/cli.js +1 -2
  2. package/package.json +2 -4
  3. package/src/createMcpServer.js +9 -4
  4. package/src/expressMcpServer.js +1 -1
  5. package/src/handleGetDelete.js +1 -1
  6. package/src/toolHelpers/readCerts.js +4 -4
  7. package/src/toolSet/devaScore.js +62 -61
  8. package/src/toolSet/findJob.js +9 -16
  9. package/src/toolSet/findJobdef.js +4 -5
  10. package/src/toolSet/findLibrary.js +67 -68
  11. package/src/toolSet/findModel.js +4 -5
  12. package/src/toolSet/findTable.js +6 -6
  13. package/src/toolSet/getEnv.js +10 -7
  14. package/src/toolSet/listJobdefs.js +61 -62
  15. package/src/toolSet/listJobs.js +61 -62
  16. package/src/toolSet/listLibraries.js +78 -80
  17. package/src/toolSet/listModels.js +56 -56
  18. package/src/toolSet/listTables.js +65 -66
  19. package/src/toolSet/makeTools.js +1 -3
  20. package/src/toolSet/modelInfo.js +4 -5
  21. package/src/toolSet/modelScore.js +7 -7
  22. package/src/toolSet/readTable.js +63 -67
  23. package/src/toolSet/runCasProgram.js +9 -9
  24. package/src/toolSet/runJob.js +81 -82
  25. package/src/toolSet/runJobdef.js +82 -83
  26. package/src/toolSet/runMacro.js +81 -82
  27. package/src/toolSet/runProgram.js +9 -10
  28. package/src/toolSet/sasQuery.js +77 -79
  29. package/src/toolSet/sasQueryTemplate.js +4 -5
  30. package/src/toolSet/sasQueryTemplate2.js +4 -5
  31. package/src/toolSet/scrInfo.js +3 -5
  32. package/src/toolSet/scrScore.js +70 -70
  33. package/src/toolSet/searchAssets.js +5 -6
  34. package/src/toolSet/setContext.js +65 -66
  35. package/src/toolSet/superstat.js +61 -60
  36. package/src/toolSet/tableInfo.js +57 -59
  37. package/skills/mcp-tool-description-optimizer/SKILL.md +0 -129
  38. package/skills/mcp-tool-description-optimizer/references/examples.md +0 -123
  39. package/skills/sas-read-and-score/SKILL.md +0 -91
  40. package/skills/sas-read-strategy/SKILL.md +0 -143
  41. package/skills/sas-score-workflow/SKILL.md +0 -282
@@ -1,67 +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
- aliases: ['readTable','read table','read_table'],
48
- description: describe,
49
- schema: {
50
- table: z.string(),
51
- lib: z.string(),
52
- start: z.number(),
53
- limit: z.number().default(10),
54
- server: z.string().default('cas'),
55
- where: z.string().default(''),
56
- format: z.boolean().default(true)
57
-
58
- },
59
- required: ['table', 'lib'],
60
- handler: async (params) => {
61
- let r = await _readTable(params,'query');
62
- return r;
63
- }
64
- }
65
- return specs;
66
- }
67
- 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;
@@ -41,21 +41,20 @@ Log output and CAS results. If output table specified, returned as markdown tabl
41
41
  `;
42
42
 
43
43
  let spec = {
44
- name: 'run-sas-program',
45
- aliases: ['Program','run program'],
44
+ name: 'run-cas-program',
46
45
  description: description,
47
- schema: {
46
+ inputSchema:z.object({
48
47
  src: z.string(),
49
- scenario: z.any().default(''),
50
- output: z.string().default(''),
51
- folder: z.string().default(''),
52
- limit: z.number().default(100)
53
- },
48
+ scenario: z.string(),
49
+ output: z.string().optional,
50
+ folder: z.string().optional,
51
+ limit: z.number().optional
52
+ }),
53
+
54
54
  // NOTE: Previously 'required' incorrectly listed 'program' which does not
55
55
  // exist in the schema. This prevented execution in some orchestrators that
56
56
  // enforce required parameter presence, causing only descriptions to appear.
57
57
  // Corrected to 'src'.
58
- required: ['src'],
59
58
  handler: async (params) => {
60
59
  let {src, folder, scenario, _appContext} = params;
61
60
  // figure out src
@@ -96,3 +95,4 @@ Log output and CAS results. If output table specified, returned as markdown tabl
96
95
  }
97
96
 
98
97
  export default runCasProgram;
98
+
@@ -1,82 +1,81 @@
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 _jobSubmit from '../toolHelpers/_jobSubmit.js';
8
-
9
- function runJob(_appContext) {
10
-
11
- let description = `
12
- run-job — execute a deployed SAS Viya job.
13
-
14
- USE when: run job, execute job, run with parameters
15
- DO NOT USE for: arbitrary SAS code (use run-sas-program), macros (use run-macro), list/find jobs
16
-
17
- PARAMETERS
18
- - name: string — job name (required)
19
- - scenario: string | object — input parameters. Accepts: "x=1, y=2" or {x:1, y:2}
20
-
21
- ROUTING RULES
22
- - "run job xyz" → { name: "xyz" }
23
- - "run job xyz with param1=10, param2=val2" → { name: "xyz", scenario: {param1:10, param2:"val2"} }
24
-
25
- EXAMPLES
26
- - "run job xyz" → { name: "xyz" }
27
- - "run job monthly_etl with month=10, year=2025" → { name: "monthly_etl", scenario: {month:10, year:2025} }
28
-
29
- NEGATIVE EXAMPLES (do not route here)
30
- - "run SAS code" (use run-sas-program)
31
- - "run macro X" (use run-macro)
32
- - "list jobs" (use list-jobs)
33
- - "find job X" (use find-job)
34
-
35
- ERRORS
36
- Returns log output, listings, tables from job. Error if job not found.
37
- `;
38
-
39
- let spec = {
40
- aliases: ['run job', 'run-job', 'runjob'],
41
- name: 'run-job',
42
- description: description,
43
- schema: {
44
- name: z.string(),
45
- scenario: z.any().default(''),
46
- },
47
- required: ['name'],
48
- handler: async (params) => {
49
- let scenario = params.scenario;
50
- let scenarioObj = {};
51
- let count = 0;
52
- //
53
- if (scenario == null) {
54
- scenarioObj = {};
55
- } else if (typeof scenario === 'object') {
56
- scenarioObj = scenario;
57
- } else if (Array.isArray(scenario)) {
58
- scenarioObj = scenario[0];
59
- } else if (typeof scenario === 'string') {
60
- if (scenario.trim() === '') {
61
- scenarioObj = {};
62
- } else {
63
- // console.error('Incoming scenario', scenario);
64
- scenarioObj = scenario.split(',').reduce((acc, pair) => {
65
- let [key, value] = pair.split('=');
66
- acc[key.trim()] = value;
67
- count++;
68
- return acc;
69
- }, {});
70
- }
71
- }
72
- params.type = 'job';
73
- params.scenario = scenarioObj;
74
- // Provide runtime context for auth and server settings
75
- let r = await _jobSubmit(params);
76
- return r;
77
- }
78
- };
79
- return spec;
80
- }
81
-
82
- export default runJob;
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 _jobSubmit from '../toolHelpers/_jobSubmit.js';
8
+
9
+ function runJob(_appContext) {
10
+
11
+ let description = `
12
+ run-job — execute a deployed SAS Viya job.
13
+
14
+ USE when: run job, execute job, run with parameters
15
+ DO NOT USE for: arbitrary SAS code (use run-sas-program), macros (use run-macro), list/find jobs
16
+
17
+ PARAMETERS
18
+ - name: string — job name (required)
19
+ - scenario: string | object — input parameters. Accepts: "x=1, y=2" or {x:1, y:2}
20
+
21
+ ROUTING RULES
22
+ - "run job xyz" → { name: "xyz" }
23
+ - "run job xyz with param1=10, param2=val2" → { name: "xyz", scenario: {param1:10, param2:"val2"} }
24
+
25
+ EXAMPLES
26
+ - "run job xyz" → { name: "xyz" }
27
+ - "run job monthly_etl with month=10, year=2025" → { name: "monthly_etl", scenario: {month:10, year:2025} }
28
+
29
+ NEGATIVE EXAMPLES (do not route here)
30
+ - "run SAS code" (use run-sas-program)
31
+ - "run macro X" (use run-macro)
32
+ - "list jobs" (use list-jobs)
33
+ - "find job X" (use find-job)
34
+
35
+ ERRORS
36
+ Returns log output, listings, tables from job. Error if job not found.
37
+ `;
38
+
39
+ let spec = {
40
+ name: 'run-job',
41
+ description: description,
42
+ inputSchema: z.object({
43
+ name: z.string(),
44
+ scenario: z.string()
45
+ }),
46
+ handler: async (params) => {
47
+ let scenario = params.scenario;
48
+ let scenarioObj = {};
49
+ let count = 0;
50
+ //
51
+ if (scenario == null) {
52
+ scenarioObj = {};
53
+ } else if (typeof scenario === 'object') {
54
+ scenarioObj = scenario;
55
+ } else if (Array.isArray(scenario)) {
56
+ scenarioObj = scenario[0];
57
+ } else if (typeof scenario === 'string') {
58
+ if (scenario.trim() === '') {
59
+ scenarioObj = {};
60
+ } else {
61
+ // console.error('Incoming scenario', scenario);
62
+ scenarioObj = scenario.split(',').reduce((acc, pair) => {
63
+ let [key, value] = pair.split('=');
64
+ acc[key.trim()] = value;
65
+ count++;
66
+ return acc;
67
+ }, {});
68
+ }
69
+ }
70
+ params.type = 'job';
71
+ params.scenario = scenarioObj;
72
+ // Provide runtime context for auth and server settings
73
+ let r = await _jobSubmit(params);
74
+ return r;
75
+ }
76
+ };
77
+ return spec;
78
+ }
79
+
80
+ export default runJob;
81
+
@@ -1,83 +1,82 @@
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 _jobSubmit from '../toolHelpers/_jobSubmit.js';
8
-
9
- function runJobdef(_appContext) {
10
- // JSON object for LLM/tooling
11
-
12
- let description = `
13
- run-jobdef — execute a SAS Viya job definition.
14
-
15
- USE when: run jobdef, execute jobdef, run with parameters
16
- DO NOT USE for: arbitrary SAS code (use run-sas-program), macros (use run-macro), list/find jobdefs
17
-
18
- PARAMETERS
19
- - name: string — jobdef name (required)
20
- - scenario: string | object — input parameters. Accepts: "x=1, y=2" or {x:1, y:2}
21
-
22
- ROUTING RULES
23
- - "run jobdef xyz" → { name: "xyz" }
24
- - "run jobdef xyz with param1=10, param2=val2" → { name: "xyz", scenario: {param1:10, param2:"val2"} }
25
-
26
- EXAMPLES
27
- - "run jobdef xyz" → { name: "xyz" }
28
- - "run jobdef monthly_report with month=10, year=2025" → { name: "monthly_report", scenario: {month:10, year:2025} }
29
-
30
- NEGATIVE EXAMPLES (do not route here)
31
- - "run SAS code" (use run-sas-program)
32
- - "run macro X" (use run-macro)
33
- - "list jobdefs" (use list-jobdefs)
34
- - "find jobdef X" (use find-jobdef)
35
-
36
- ERRORS
37
- Returns log output, listings, tables from jobdef. Error if jobdef not found.
38
- `;
39
-
40
- let spec = {
41
- name: 'run-jobdef',
42
- aliases: ['jobDef','jobdef','jobdef'],
43
- description: description,
44
- schema: {
45
- name: z.string(),
46
- scenario: z.any().default(''),
47
- },
48
- required: ['name'],
49
- handler: async (params) => {
50
- let scenario = params.scenario;
51
- let scenarioObj = {};
52
- let count = 0;
53
- //
54
- if (scenario == null) {
55
- scenarioObj = {};
56
- } else if (typeof scenario === 'object') {
57
- scenarioObj = scenario;
58
- } else if (Array.isArray(scenario)) {
59
- scenarioObj = scenario[0];
60
- } else if (typeof scenario === 'string') {
61
- if (scenario.trim() === '') {
62
- scenarioObj = {};
63
- } else {
64
- // console.error('Incoming scenario', scenario);
65
- scenarioObj = scenario.split(',').reduce((acc, pair) => {
66
- let [key, value] = pair.split('=');
67
- acc[key.trim()] = value;
68
- count++;
69
- return acc;
70
- }, {});
71
- }
72
- }
73
- params.type = 'def';
74
- params.scenario = scenarioObj;
75
- // Provide runtime context for auth and server settings
76
- let r = await _jobSubmit(params);
77
- return r;
78
- }
79
- };
80
- return spec;
81
- }
82
-
83
- export default runJobdef;
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 _jobSubmit from '../toolHelpers/_jobSubmit.js';
8
+
9
+ function runJobdef(_appContext) {
10
+ // JSON object for LLM/tooling
11
+
12
+ let description = `
13
+ run-jobdef — execute a SAS Viya job definition.
14
+
15
+ USE when: run jobdef, execute jobdef, run with parameters
16
+ DO NOT USE for: arbitrary SAS code (use run-sas-program), macros (use run-macro), list/find jobdefs
17
+
18
+ PARAMETERS
19
+ - name: string — jobdef name (required)
20
+ - scenario: string | object — input parameters. Accepts: "x=1, y=2" or {x:1, y:2}
21
+
22
+ ROUTING RULES
23
+ - "run jobdef xyz" → { name: "xyz" }
24
+ - "run jobdef xyz with param1=10, param2=val2" → { name: "xyz", scenario: {param1:10, param2:"val2"} }
25
+
26
+ EXAMPLES
27
+ - "run jobdef xyz" → { name: "xyz" }
28
+ - "run jobdef monthly_report with month=10, year=2025" → { name: "monthly_report", scenario: {month:10, year:2025} }
29
+
30
+ NEGATIVE EXAMPLES (do not route here)
31
+ - "run SAS code" (use run-sas-program)
32
+ - "run macro X" (use run-macro)
33
+ - "list jobdefs" (use list-jobdefs)
34
+ - "find jobdef X" (use find-jobdef)
35
+
36
+ ERRORS
37
+ Returns log output, listings, tables from jobdef. Error if jobdef not found.
38
+ `;
39
+
40
+ let spec = {
41
+ name: 'run-jobdef',
42
+ description: description,
43
+ inputSchema: z.object({
44
+ name: z.string(),
45
+ scenario: z.string()
46
+ }),
47
+ handler: async (params) => {
48
+ let scenario = params.scenario;
49
+ let scenarioObj = {};
50
+ let count = 0;
51
+ //
52
+ if (scenario == null) {
53
+ scenarioObj = {};
54
+ } else if (typeof scenario === 'object') {
55
+ scenarioObj = scenario;
56
+ } else if (Array.isArray(scenario)) {
57
+ scenarioObj = scenario[0];
58
+ } else if (typeof scenario === 'string') {
59
+ if (scenario.trim() === '') {
60
+ scenarioObj = {};
61
+ } else {
62
+ // console.error('Incoming scenario', scenario);
63
+ scenarioObj = scenario.split(',').reduce((acc, pair) => {
64
+ let [key, value] = pair.split('=');
65
+ acc[key.trim()] = value;
66
+ count++;
67
+ return acc;
68
+ }, {});
69
+ }
70
+ }
71
+ params.type = 'def';
72
+ params.scenario = scenarioObj;
73
+ // Provide runtime context for auth and server settings
74
+ let r = await _jobSubmit(params);
75
+ return r;
76
+ }
77
+ };
78
+ return spec;
79
+ }
80
+
81
+ export default runJobdef;
82
+