@sassoftware/sas-score-mcp-serverjs 1.1.1 → 1.1.2
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/toolHelpers/_casScore.js +31 -31
- package/src/toolSet/casModelScore.js +93 -93
- package/src/toolSet/casProgramScore.js +105 -105
- package/src/toolSet/devaScore.js +66 -66
- package/src/toolSet/findJob.js +74 -74
- package/src/toolSet/findJobdef.js +67 -67
- package/src/toolSet/findLibrary.js +73 -73
- package/src/toolSet/findMas.js +2 -2
- package/src/toolSet/getEnv.js +57 -57
- package/src/toolSet/jobDescribe.js +65 -65
- package/src/toolSet/jobScore.js +90 -90
- package/src/toolSet/jobdefDescribe.js +67 -67
- package/src/toolSet/jobdefScore.js +85 -85
- package/src/toolSet/listJobdefs.js +70 -70
- package/src/toolSet/listJobs.js +68 -68
- package/src/toolSet/listLibraries.js +84 -84
- package/src/toolSet/masScore.js +95 -95
- package/src/toolSet/programScore.js +96 -96
- package/src/toolSet/readTable.js +80 -80
- package/src/toolSet/sasQuery.js +83 -83
- package/src/toolSet/setContext.js +70 -70
|
@@ -1,70 +1,70 @@
|
|
|
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
|
-
|
|
8
|
-
function setContext(_appContext) {
|
|
9
|
-
const isAgent = _appContext && _appContext.agent;
|
|
10
|
-
let description = isAgent ? `
|
|
11
|
-
set-context — set runtime context variables (CAS server, SAS server, etc.).
|
|
12
|
-
PARAMS: cas (string, optional), sas (string, optional), other key=value context fields
|
|
13
|
-
RETURNS: updated context confirmation
|
|
14
|
-
` : `
|
|
15
|
-
set-context — set the CAS and SAS server contexts for subsequent tool calls.
|
|
16
|
-
|
|
17
|
-
USE when: switch to CAS server, change compute context, check current context, set both
|
|
18
|
-
DO NOT USE for: get variables (use get-env), read data (use read-table), score programs (use program-score)
|
|
19
|
-
|
|
20
|
-
PARAMETERS
|
|
21
|
-
- cas: string — CAS server name (optional), e.g. 'cas-shared-default', 'finance-cas-server'
|
|
22
|
-
- sas: string — SAS compute context (optional), e.g. 'SAS Studio Compute Context', 'batch-compute'
|
|
23
|
-
|
|
24
|
-
ROUTING RULES
|
|
25
|
-
- "use finance-cas-server" → { cas: "finance-cas-server" }
|
|
26
|
-
- "switch to SAS Studio Compute Context" → { sas: "SAS Studio Compute Context" }
|
|
27
|
-
- "use finance-cas for CAS and batch-compute for SAS" → { cas: "finance-cas", sas: "batch-compute" }
|
|
28
|
-
- "what context am I using" → { } (no params, returns current)
|
|
29
|
-
|
|
30
|
-
EXAMPLES
|
|
31
|
-
- "use finance-cas-server" → { cas: "finance-cas-server" }
|
|
32
|
-
- "switch to batch-compute" → { sas: "batch-compute" }
|
|
33
|
-
- "what's my current context" → { }
|
|
34
|
-
|
|
35
|
-
NEGATIVE EXAMPLES (do not route here)
|
|
36
|
-
- "read table cars" (use read-table)
|
|
37
|
-
- "what's the value of X" (use get-env)
|
|
38
|
-
- "score program" (use program-score)
|
|
39
|
-
|
|
40
|
-
ERRORS
|
|
41
|
-
Returns current or updated context values {cas, sas}. Error if server not found or invalid name.
|
|
42
|
-
`;
|
|
43
|
-
|
|
44
|
-
let spec = {
|
|
45
|
-
name: 'set-context',
|
|
46
|
-
description: description,
|
|
47
|
-
inputSchema: z.object({
|
|
48
|
-
cas: z.string().optional(),
|
|
49
|
-
sas: z.string().optional()
|
|
50
|
-
}),
|
|
51
|
-
handler: async (params) => {
|
|
52
|
-
|
|
53
|
-
let {cas, sas} = params;
|
|
54
|
-
if (typeof cas === 'string' && cas.trim().length > 0) {
|
|
55
|
-
_appContext.contexts.cas = cas.trim();
|
|
56
|
-
}
|
|
57
|
-
if (typeof sas === 'string' && sas.trim().length > 0) {
|
|
58
|
-
_appContext.contexts.sas = sas.trim();
|
|
59
|
-
}
|
|
60
|
-
// Return a structured response without extraneous keys
|
|
61
|
-
return {
|
|
62
|
-
content: [{ type: 'text', text: JSON.stringify(_appContext.contexts) }],
|
|
63
|
-
structuredContent: _appContext.contexts
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return spec;
|
|
68
|
-
}
|
|
69
|
-
export default setContext;
|
|
70
|
-
|
|
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
|
+
|
|
8
|
+
function setContext(_appContext) {
|
|
9
|
+
const isAgent = _appContext && _appContext.agent;
|
|
10
|
+
let description = isAgent ? `
|
|
11
|
+
set-context — set runtime context variables (CAS server, SAS server, etc.).
|
|
12
|
+
PARAMS: cas (string, optional), sas (string, optional), other key=value context fields
|
|
13
|
+
RETURNS: updated context confirmation
|
|
14
|
+
` : `
|
|
15
|
+
set-context — set the CAS and SAS server contexts for subsequent tool calls.
|
|
16
|
+
|
|
17
|
+
USE when: switch to CAS server, change compute context, check current context, set both
|
|
18
|
+
DO NOT USE for: get variables (use get-env), read data (use read-table), score programs (use program-score)
|
|
19
|
+
|
|
20
|
+
PARAMETERS
|
|
21
|
+
- cas: string — CAS server name (optional), e.g. 'cas-shared-default', 'finance-cas-server'
|
|
22
|
+
- sas: string — SAS compute context (optional), e.g. 'SAS Studio Compute Context', 'batch-compute'
|
|
23
|
+
|
|
24
|
+
ROUTING RULES
|
|
25
|
+
- "use finance-cas-server" → { cas: "finance-cas-server" }
|
|
26
|
+
- "switch to SAS Studio Compute Context" → { sas: "SAS Studio Compute Context" }
|
|
27
|
+
- "use finance-cas for CAS and batch-compute for SAS" → { cas: "finance-cas", sas: "batch-compute" }
|
|
28
|
+
- "what context am I using" → { } (no params, returns current)
|
|
29
|
+
|
|
30
|
+
EXAMPLES
|
|
31
|
+
- "use finance-cas-server" → { cas: "finance-cas-server" }
|
|
32
|
+
- "switch to batch-compute" → { sas: "batch-compute" }
|
|
33
|
+
- "what's my current context" → { }
|
|
34
|
+
|
|
35
|
+
NEGATIVE EXAMPLES (do not route here)
|
|
36
|
+
- "read table cars" (use read-table)
|
|
37
|
+
- "what's the value of X" (use get-env)
|
|
38
|
+
- "score program" (use program-score)
|
|
39
|
+
|
|
40
|
+
ERRORS
|
|
41
|
+
Returns current or updated context values {cas, sas}. Error if server not found or invalid name.
|
|
42
|
+
`;
|
|
43
|
+
|
|
44
|
+
let spec = {
|
|
45
|
+
name: 'set-context',
|
|
46
|
+
description: description,
|
|
47
|
+
inputSchema: z.object({
|
|
48
|
+
cas: z.string().optional(),
|
|
49
|
+
sas: z.string().optional()
|
|
50
|
+
}),
|
|
51
|
+
handler: async (params) => {
|
|
52
|
+
|
|
53
|
+
let {cas, sas} = params;
|
|
54
|
+
if (typeof cas === 'string' && cas.trim().length > 0) {
|
|
55
|
+
_appContext.contexts.cas = cas.trim();
|
|
56
|
+
}
|
|
57
|
+
if (typeof sas === 'string' && sas.trim().length > 0) {
|
|
58
|
+
_appContext.contexts.sas = sas.trim();
|
|
59
|
+
}
|
|
60
|
+
// Return a structured response without extraneous keys
|
|
61
|
+
return {
|
|
62
|
+
content: [{ type: 'text', text: JSON.stringify(_appContext.contexts) }],
|
|
63
|
+
structuredContent: _appContext.contexts
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return spec;
|
|
68
|
+
}
|
|
69
|
+
export default setContext;
|
|
70
|
+
|