@sassoftware/sas-score-mcp-serverjs 1.0.1-9 → 1.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.
Files changed (118) hide show
  1. package/.skills/.claude-plugin/plugin.json +59 -0
  2. package/.skills/agents/sas-score-mcp-serverjs-agent.md +26 -0
  3. package/.skills/copilot-instructions.md +62 -0
  4. package/.skills/skills/README.md +204 -0
  5. package/.skills/skills/detail-strategy/SKILL.md +316 -0
  6. package/.skills/skills/find-library-server/SKILL.md +62 -0
  7. package/.skills/skills/find-resources/SKILL.md +66 -0
  8. package/.skills/skills/list-library/SKILL.md +30 -0
  9. package/.skills/skills/list-mas-job-jobdef/SKILL.md +31 -0
  10. package/.skills/skills/list-tables/SKILL.md +30 -0
  11. package/.skills/skills/read-strategy/SKILL.md +87 -0
  12. package/.skills/skills/request-routing/SKILL.md +112 -0
  13. package/.skills/skills/score-cas/SKILL.md +95 -0
  14. package/.skills/skills/score-job-jobdef/SKILL.md +58 -0
  15. package/.skills/skills/score-mas-scr/SKILL.md +58 -0
  16. package/.skills/skills/score-program/SKILL.md +59 -0
  17. package/.skills/skills/score-strategy/SKILL.md +39 -0
  18. package/README.md +96 -54
  19. package/cli.js +11 -13
  20. package/openApi.yaml +121 -121
  21. package/package.json +16 -14
  22. package/scripts/docs/SCORE_SKILL_REFERENCE.md +17 -16
  23. package/scripts/docs/TOOL_DESCRIPTION_TEMPLATE.md +3 -3
  24. package/scripts/docs/TOOL_UPDATES_SUMMARY.md +65 -63
  25. package/scripts/docs/oauth-http-transport.md +2 -2
  26. package/scripts/docs/sas-mcp-tools-reference.md +43 -32
  27. package/scripts/plot_msrp_usa.py +49 -0
  28. package/scripts/refreshtoken.js +58 -0
  29. package/scripts/runListScr.mjs +16 -0
  30. package/src/createMcpServer.js +4 -1
  31. package/src/expressMcpServer.js +47 -49
  32. package/src/oauthHandlers/authorize.js +4 -1
  33. package/src/oauthHandlers/baseUrl.js +4 -0
  34. package/src/oauthHandlers/callback.js +4 -0
  35. package/src/oauthHandlers/getMetadata.js +4 -0
  36. package/src/oauthHandlers/index.js +4 -0
  37. package/src/oauthHandlers/token.js +4 -0
  38. package/src/openApi.yaml +121 -121
  39. package/src/processHeaders.js +10 -7
  40. package/src/setupSkills.js +1 -18
  41. package/src/toolHelpers/_casScore.js +32 -0
  42. package/src/toolHelpers/_desc.js +14 -0
  43. package/src/toolHelpers/_findJob.js +12 -0
  44. package/src/toolHelpers/_findJobdef.js +10 -0
  45. package/src/toolHelpers/_findLibrary.js +11 -0
  46. package/src/toolHelpers/_findMas.js +13 -0
  47. package/src/toolHelpers/_findScr.js +36 -0
  48. package/src/toolHelpers/_findTable.js +11 -0
  49. package/src/toolHelpers/_listJobdefs.js +12 -2
  50. package/src/toolHelpers/_listJobs.js +19 -8
  51. package/src/toolHelpers/{_listModels.js → _listMas.js} +4 -4
  52. package/src/toolHelpers/_listScr.js +13 -0
  53. package/src/toolHelpers/{_scrInfo.js → _scrDescribe.js} +4 -4
  54. package/src/toolHelpers/_scrScore.js +2 -2
  55. package/src/toolHelpers/_submitCasl.js +19 -17
  56. package/src/toolHelpers/{_tableInfo.js → _tableDescribe.js} +2 -2
  57. package/src/toolHelpers/getLogonPayload.js +2 -2
  58. package/src/toolSet/casModelScore.js +93 -0
  59. package/src/toolSet/casProgramScore.js +105 -0
  60. package/src/toolSet/devaScore.js +11 -6
  61. package/src/toolSet/findJob.js +74 -59
  62. package/src/toolSet/findJobdef.js +67 -64
  63. package/src/toolSet/findLibrary.js +28 -23
  64. package/src/toolSet/findMas.js +72 -0
  65. package/src/toolSet/findScr.js +69 -0
  66. package/src/toolSet/findTable.js +34 -27
  67. package/src/toolSet/getEnv.js +57 -57
  68. package/src/toolSet/jobDescribe.js +65 -0
  69. package/src/toolSet/jobScore.js +90 -0
  70. package/src/toolSet/jobdefDescribe.js +67 -0
  71. package/src/toolSet/jobdefScore.js +85 -0
  72. package/src/toolSet/listJobdefs.js +17 -8
  73. package/src/toolSet/listJobs.js +15 -8
  74. package/src/toolSet/listLibraries.js +16 -10
  75. package/src/toolSet/listMas.js +71 -0
  76. package/src/toolSet/listScr.js +62 -0
  77. package/src/toolSet/listTables.js +78 -66
  78. package/src/toolSet/{runMacro.js → macroScore.js} +86 -82
  79. package/src/toolSet/makeTools.js +39 -25
  80. package/src/toolSet/masDescribe.js +67 -0
  81. package/src/toolSet/masScore.js +95 -0
  82. package/src/toolSet/{runProgram.js → programScore.js} +96 -93
  83. package/src/toolSet/readTable.js +43 -26
  84. package/src/toolSet/sasQuery.js +24 -18
  85. package/src/toolSet/scrDescribe.js +55 -0
  86. package/src/toolSet/scrScore.js +63 -70
  87. package/src/toolSet/searchAssets.js +1 -1
  88. package/src/toolSet/setContext.js +8 -3
  89. package/src/toolSet/superstat.js +61 -61
  90. package/src/toolSet/tableDescribe.js +65 -0
  91. package/.agents/sas-score-mcp-serverjs-agent.md +0 -58
  92. package/.instructions/copilot-instructions.md +0 -201
  93. package/.instructions/enforce-find-resource-strategy.md +0 -35
  94. package/.skills/sas-find-library-smart/SKILL.md +0 -155
  95. package/.skills/sas-find-resource-strategy/SKILL.md +0 -105
  96. package/.skills/sas-list-resource-strategy/SKILL.md +0 -124
  97. package/.skills/sas-list-tables-smart/SKILL.md +0 -128
  98. package/.skills/sas-read-and-score-strategy/SKILL.md +0 -113
  99. package/.skills/sas-read-strategy/SKILL.md +0 -154
  100. package/.skills/sas-request-classifier/SKILL.md +0 -74
  101. package/.skills/sas-score-workflow-strategy/SKILL.md +0 -314
  102. package/scripts/optimize_final.py +0 -140
  103. package/scripts/optimize_tools.py +0 -99
  104. package/scripts/setup-skills.js +0 -34
  105. package/scripts/update_descriptions.py +0 -46
  106. package/src/authpkce.js +0 -219
  107. package/src/handleGetDelete.js +0 -34
  108. package/src/handleRequest.js +0 -112
  109. package/src/hapiMcpServer.js +0 -241
  110. package/src/toolSet/findModel.js +0 -60
  111. package/src/toolSet/listModels.js +0 -56
  112. package/src/toolSet/modelInfo.js +0 -55
  113. package/src/toolSet/modelScore.js +0 -89
  114. package/src/toolSet/runCasProgram.js +0 -98
  115. package/src/toolSet/runJob.js +0 -81
  116. package/src/toolSet/runJobdef.js +0 -82
  117. package/src/toolSet/scrInfo.js +0 -52
  118. package/src/toolSet/tableInfo.js +0 -58
@@ -1,60 +0,0 @@
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
-
10
- function findModel(_appContext) {
11
- let description = `
12
- find-model — locate a specific MAS model deployed to MAS server
13
-
14
- USE when: find model, does model exist, is model deployed, lookup model, verify model exists
15
- DO NOT USE for: list models (use list-models), model info/variables (use model-info), score model (use model-score), find table/job/lib (use respective tools), scr models (use scr-info/scr-score)
16
-
17
- PARAMETERS
18
- - name: string (required) — model name to locate; if multiple supplied, use first
19
-
20
- ROUTING RULES
21
- - "find model <name>" → { name: "<name>" }
22
- - "does model <name> exist" → { name: "<name>" }
23
- - "is model <name> deployed" → { name: "<name>" }
24
- - "lookup/verify model <name>" → { name: "<name>" }
25
- - "find model" with no name → ask "Which model name would you like to find?"
26
- - "find all models / list models" → use list-models instead
27
- - "score model <name>" → use model-score instead
28
- - "describe model / model info" → use model-info instead
29
-
30
- EXAMPLES
31
- - "find model myModel" → { name: "myModel" }
32
- - "does model churn_score exist" → { name: "churn_score" }
33
- - "is model riskModel deployed" → { name: "riskModel" }
34
- - "lookup model claims_fraud_v1" → { name: "claims_fraud_v1" }
35
-
36
- NEGATIVE EXAMPLES (do not route here)
37
- - "list models" (use list-models)
38
- - "score model myModel" (use model-score)
39
- - "model info for churnRisk" (use model-info)
40
-
41
- ERRORS
42
- Returns { models: [] } if not found; { models: [name, ...] } if found. Never hallucinate model names.
43
- `;
44
-
45
- let spec = {
46
- name: 'find-model',
47
- description: description,
48
- inputSchema: z.object({
49
- name: z.string()
50
- }),
51
- handler: async (params) => {
52
- let r = await _listModels(params);
53
- return r;
54
- }
55
- }
56
- return spec;
57
- }
58
-
59
- export default findModel;
60
-
@@ -1,56 +0,0 @@
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,55 +0,0 @@
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 _masDescribe from '../toolHelpers/_masDescribe.js';
9
- const log = debug('tools');
10
-
11
- function modelInfo(_appContext) {
12
- let description = `
13
- model-info — retrieve detailed metadata for a deployed model.
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
17
-
18
- PARAMETERS
19
- - model: string — model name (required, exact match)
20
-
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" }
25
-
26
- EXAMPLES
27
- - "What inputs does model churnRisk need?" → { model: "churnRisk" }
28
- - "Describe model creditScore" → { model: "creditScore" }
29
- - "Show variables for myModel" → { model: "myModel" }
30
-
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)
35
-
36
- ERRORS
37
- Returns model metadata: inputs (name, type, role), outputs (name, type, possible_values), model_type, description.
38
- `;
39
-
40
- let spec = {
41
- name: 'model-info',
42
- description: description,
43
- inputSchema: z.object({
44
- model: z.string()
45
- }),
46
- handler: async (params) => {
47
- let r = await _masDescribe(params);
48
- return r;
49
- }
50
- }
51
- return spec;
52
- }
53
-
54
- export default modelInfo;
55
-
@@ -1,89 +0,0 @@
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 _masScoring from '../toolHelpers/_masScoring.js';
9
- const log = debug('tools');
10
-
11
- function modelScore(_appContext) {
12
- let description = `
13
- mas-score — score data using a deployed model on MAS.
14
-
15
- USE when: score with model, predict using model, batch scoring, model predictions
16
- DO NOT USE for: find model, model metadata, list models, run programs/jobs, query tables
17
-
18
- PARAMETERS
19
- - model: string — model name (required, exact match)
20
- - scenario: string | object | array — input data (required). Accepts: "x=1, y=2", {x:1, y:2}, or array of objects
21
- - uflag: boolean (default: false) — prefix model fields with underscore when true
22
-
23
- ROUTING RULES
24
- - "score with model X using a=1, b=2" → { model: "X", scenario: {a:1, b:2}, uflag: false }
25
- - "predict using model Y with age=45, income=60000" → { model: "Y", scenario: {age:45, income:60000}, uflag: false }
26
-
27
- EXAMPLES
28
- - "score with model churn using age=45, income=60000" → { model: "churn", scenario: {age:45, income:60000}, uflag: false }
29
- - "predict creditScore for credit=700, debt=20000" → { model: "creditScore", scenario: {credit:700, debt:20000}, uflag: false }
30
-
31
- NEGATIVE EXAMPLES (do not route here)
32
- - "find model X" (use find-model)
33
- - "what inputs does model need" (use model-info)
34
- - "list models" (use list-models)
35
- - "run job X" (use run-job)
36
-
37
- ERRORS
38
- Returns predictions, probabilities, scores merged with input data. Returns error if model not found or scoring fails.
39
- `;
40
-
41
-
42
- let spec = {
43
- name: 'mas-score',
44
- description: description,
45
- inputSchema:z.object({
46
- model: z.string(),
47
- scenario: z.string(),
48
- uflag: z.boolean().optional()
49
- }),
50
-
51
- handler: async (iparams) => {
52
- let params = {...iparams};
53
- let scenario = params.scenario;
54
-
55
- // Convert the scenario string to an object
56
- // Example: "x=1, y=2, z=3" to { x: 1, y: 2, z: 3 }
57
- let scenarioObj ={};
58
- let count = 0;
59
- if (typeof scenario === 'object') {
60
- scenarioObj = scenario;
61
- } else if (Array.isArray(scenario)) {
62
- scenarioObj = scenario[0];
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
- params.scenario= scenarioObj;
73
-
74
- // Drop model extension (e.g., .job, .model)
75
- if (params.model && params.model.includes('.')) {
76
- params.model = params.model.substring(0, params.model.lastIndexOf('.'));
77
- }
78
-
79
- log('modelScore params', params);
80
- // Check if the params.scenario is a string and parse it
81
- let r = await _masScoring(params)
82
- return r;
83
- }
84
- }
85
- return spec;
86
- }
87
-
88
- export default modelScore;
89
-
@@ -1,98 +0,0 @@
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 _submitCode from '../toolHelpers/_submitCode.js';
8
-
9
- function runCasProgram(_appContext) {
10
- let description = `
11
- run-cas-program — execute a CAS program on SAS Viya server.
12
-
13
- USE when: run cas program, execute cas, submit cas, cas action
14
- DO NOT USE for: macros (use run-macro), sas code (use run-sas-program), jobs (use run-job), jobdefs (use run-jobdef)
15
-
16
- PARAMETERS
17
- - src: string (required) — CAS program to execute verbatim
18
- - scenario: string or object (optional) — input parameters
19
- - folder: string — server folder path for .sas files
20
- - output: string — table name to return in response
21
- - limit: number (default: 100) — max rows to return
22
-
23
- ROUTING RULES
24
- - run cas program action echo → { src: action echo }
25
- - execute cas action simple.summary → { src: action simple.summary }
26
-
27
- EXAMPLES
28
- - run cas program action echo → { src: action echo }
29
- - cas program sample folder=/Public/models → { src: sample, folder: /Public/models }
30
-
31
- NEGATIVE EXAMPLES (do not route here)
32
- - run sas macro (use run-macro)
33
- - submit sas code (use run-sas-program)
34
- - run job X (use run-job)
35
-
36
- NOTES
37
- Sends src verbatim without validation. For SAS macros use run-macro. For arbitrary SAS code use run-sas-program.
38
-
39
- RESPONSE
40
- Log output and CAS results. If output table specified, returned as markdown table.
41
- `;
42
-
43
- let spec = {
44
- name: 'run-cas-program',
45
- description: description,
46
- inputSchema:z.object({
47
- src: z.string(),
48
- scenario: z.string(),
49
- output: z.string().optional,
50
- folder: z.string().optional,
51
- limit: z.number().optional
52
- }),
53
-
54
- // NOTE: Previously 'required' incorrectly listed 'program' which does not
55
- // exist in the schema. This prevented execution in some orchestrators that
56
- // enforce required parameter presence, causing only descriptions to appear.
57
- // Corrected to 'src'.
58
- handler: async (params) => {
59
- let {src, folder, scenario, _appContext} = params;
60
- // figure out src
61
- let isrc = src;
62
- if (folder != null && folder.trim().length > 0) {
63
- if (isrc.indexOf('.sas') < 0) {
64
- isrc = isrc + '.sas';
65
- }
66
- isrc = `
67
- filename mcptemp filesrvc folderpath="${folder}";
68
- %include mcptemp("${isrc}");
69
- filename mcptemp clear;
70
- `;
71
- }
72
- // figure out macros
73
-
74
- if (typeof scenario === 'string' && scenario.includes('=')) {
75
- scenario = scenario.split(',').reduce((acc, pair) => {
76
- const [k, ...rest] = pair.split('=');
77
- if (!k) return acc;
78
- acc[k.trim()] = rest.join('=').trim();
79
- return acc;
80
- }, {});
81
- }
82
- let iparms = {
83
- args: scenario,
84
- output: params.output,
85
- limit: params.limit,
86
- src: isrc,
87
- _appContext: _appContext
88
- }
89
- // console.error('iparms', iparms);
90
- let r = await _submitCode(iparms);
91
- return r;
92
- }
93
- }
94
- return spec;
95
- }
96
-
97
- export default runCasProgram;
98
-
@@ -1,81 +0,0 @@
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 — score with a deployed SAS Viya job.
13
-
14
- USE when: score with job, run job, execute job
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().optional()
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,82 +0,0 @@
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 — score with a deployed SAS Viya job definition.
14
-
15
- USE when: score with jobdef, run jobdef, execute jobdef
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().optional()
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
-
@@ -1,52 +0,0 @@
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 _scrInfo from '../toolHelpers/_scrInfo.js';
8
-
9
- function scrInfo(_appContext) {
10
-
11
- let description = `
12
- ## scr-info
13
-
14
- Purpose
15
- Return the input/output schema and metadata for an SCR (Score Code Runtime) model.
16
-
17
- Inputs
18
- - url (string): The SCR model identifier.
19
- What it returns
20
- - A JSON object describing the model's interface, typically including:
21
- - Input variables (names, types, required/optional)
22
- - Output variables (predictions, probabilities, scores)
23
-
24
-
25
- Usage notes
26
- - Ensure network connectivity and credentials for the remote SCR service when needed.
27
- - Use scr-score to score data after inspecting the schema.
28
-
29
- Examples
30
- - describe scr model "https://scr-host/models/loan"
31
- - info for scr model "https://scr-host/models/loan"
32
- `;
33
-
34
- let spec = {
35
- name: 'scr-info',
36
- description: description,
37
- inputSchema: z.object({
38
- url: z.string()
39
- }),
40
- handler: async (params) => {
41
- let {url, _appContext} = params;
42
- if (url === null) {
43
- return { status: { statusCode: 2, msg: `SCR model ${url} not found` }, results: {} };
44
- }
45
- let r = await _scrInfo({url, _appContext});
46
- return r;
47
- }
48
- }
49
- return spec;
50
- }
51
-
52
- export default scrInfo;
@@ -1,58 +0,0 @@
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 _tableInfo from '../toolHelpers/_tableInfo.js';
9
- import { type } from 'node:os';
10
- function tableInfo(_appContext) {
11
-
12
- let describe = `
13
- table-info — retrieve metadata about a table in a CAS or SAS library.
14
-
15
- USE when: what columns, describe structure, show schema, table statistics, column info
16
- DO NOT USE for: read data (use read-table), list tables (use list-tables), find table (use find-table), queries (use sas-query)
17
-
18
- PARAMETERS
19
- - table: string — table name (required)
20
- - lib: string — caslib or libref (required)
21
- - server: string (default: 'cas') — 'cas' or 'sas'
22
-
23
- ROUTING RULES
24
- - "what columns are in cars" → { table: "cars", lib: "<lib>", server: "cas" }
25
- - "describe table sales in Public" → { table: "sales", lib: "Public", server: "cas" }
26
- - "show schema for mylib.iris on sas" → { table: "iris", lib: "mylib", server: "sas" }
27
-
28
- EXAMPLES
29
- - "what columns in cars" → { table: "cars", lib: "<lib>", server: "cas" }
30
- - "describe structure of customers in Public" → { table: "customers", lib: "Public", server: "cas" }
31
-
32
- NEGATIVE EXAMPLES (do not route here)
33
- - "read table cars" (use read-table)
34
- - "list tables in Public" (use list-tables)
35
- - "does table exist" (use find-table)
36
- - "query table" (use sas-query)
37
-
38
- ERRORS
39
- Returns columns array (name, type, label, format, length) and tableInfo (rowCount, fileSize, created, modified).
40
- `;
41
-
42
- let specs = {
43
- name: 'table-info',
44
- description: describe,
45
- inputSchema: z.object({
46
- table: z.string(),
47
- lib: z.string().optional(),
48
- server: z.string().optional()
49
- }),
50
- handler: async (params) => {
51
- params.describe = true;
52
- let r = await _tableInfo(params);
53
- return r;
54
- }
55
- }
56
- return specs;
57
- }
58
- export default tableInfo;