@sassoftware/sas-score-mcp-serverjs 1.0.1-3 → 1.0.1-31
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/.skills/agents/sas-score-mcp-serverjs-agent.md +190 -0
- package/.skills/copilot-instructions.md +241 -0
- package/.skills/skills/README.md +125 -0
- package/.skills/skills/detail-strategy/SKILL.md +272 -0
- package/.skills/skills/find-resources/SKILL.md +155 -0
- package/.skills/skills/list-resource/SKILL.md +258 -0
- package/.skills/skills/read-strategy/SKILL.md +137 -0
- package/.skills/skills/request-routing/SKILL.md +107 -0
- package/.skills/skills/score-strategy/SKILL.md +231 -0
- package/README.md +96 -54
- package/cli.js +37 -27
- package/openApi.yaml +121 -121
- package/package.json +14 -14
- package/scripts/docs/oauth-http-transport.md +2 -2
- package/scripts/refreshtoken.js +58 -0
- package/src/createMcpServer.js +0 -1
- package/src/expressMcpServer.js +47 -49
- package/src/oauthHandlers/authorize.js +4 -1
- package/src/oauthHandlers/baseUrl.js +4 -0
- package/src/oauthHandlers/callback.js +5 -1
- package/src/oauthHandlers/getMetadata.js +4 -0
- package/src/oauthHandlers/index.js +4 -0
- package/src/oauthHandlers/token.js +4 -0
- package/src/openApi.yaml +121 -121
- package/src/processHeaders.js +10 -7
- package/src/setupSkills.js +12 -7
- package/src/toolHelpers/_findJob.js +12 -0
- package/src/toolHelpers/_findJobdef.js +10 -0
- package/src/toolHelpers/_findLibrary.js +10 -0
- package/src/toolHelpers/_findModel.js +12 -0
- package/src/toolHelpers/_findTable.js +10 -0
- package/src/toolHelpers/_listJobs.js +2 -1
- package/src/toolHelpers/_listLibrary.js +1 -1
- package/src/toolHelpers/_listTables.js +1 -1
- package/src/toolHelpers/getLogonPayload.js +2 -2
- package/src/toolSet/devaScore.js +61 -61
- package/src/toolSet/findJob.js +2 -1
- package/src/toolSet/findJobdef.js +7 -7
- package/src/toolSet/findLibrary.js +68 -68
- package/src/toolSet/findModel.js +2 -2
- package/src/toolSet/findTable.js +2 -2
- package/src/toolSet/jobInfo.js +59 -0
- package/src/toolSet/jobdefInfo.js +59 -0
- 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 +66 -66
- package/src/toolSet/makeTools.js +3 -0
- package/src/toolSet/modelInfo.js +1 -1
- package/src/toolSet/modelScore.js +23 -25
- package/src/toolSet/readTable.js +63 -63
- package/src/toolSet/runCasProgram.js +21 -10
- package/src/toolSet/runJob.js +15 -19
- package/src/toolSet/runJobdef.js +15 -19
- package/src/toolSet/runMacro.js +82 -82
- package/src/toolSet/sasQuery.js +77 -77
- package/src/toolSet/scrScore.js +60 -69
- package/src/toolSet/setContext.js +65 -65
- package/src/toolSet/superstat.js +61 -61
- package/src/toolSet/tableInfo.js +58 -58
- package/.skills_claude/README.md +0 -303
- package/.skills_claude/TESTING_GUIDE.md +0 -252
- package/.skills_claude/agents/sas-viya-scoring-expert.md +0 -58
- package/.skills_claude/claude-desktop-config.json +0 -16
- package/.skills_claude/claude-desktop-system-prompt.md +0 -127
- package/.skills_claude/copilot-instructions.md +0 -155
- package/.skills_claude/instructions.md +0 -184
- package/.skills_claude/skills/sas-find-library-smart/SKILL.md +0 -157
- package/.skills_claude/skills/sas-find-resource-strategy/SKILL.md +0 -105
- package/.skills_claude/skills/sas-list-resource-strategy/SKILL.md +0 -124
- package/.skills_claude/skills/sas-list-tables-smart/SKILL.md +0 -126
- package/.skills_claude/skills/sas-read-and-score/SKILL.md +0 -112
- package/.skills_claude/skills/sas-read-strategy/SKILL.md +0 -154
- package/.skills_claude/skills/sas-request-classifier/SKILL.md +0 -69
- package/.skills_claude/skills/sas-score-workflow/SKILL.md +0 -200
- package/.skills_claude/skills-index.md +0 -345
- package/.skills_github/agents/sas-viya-scoring-expert.md +0 -58
- package/.skills_github/copilot-instructions.md +0 -177
- package/.skills_github/skills/sas-find-library-smart/SKILL.md +0 -155
- package/.skills_github/skills/sas-find-resource-strategy/SKILL.md +0 -105
- package/.skills_github/skills/sas-list-resource-strategy/SKILL.md +0 -124
- package/.skills_github/skills/sas-list-tables-smart/SKILL.md +0 -128
- package/.skills_github/skills/sas-read-and-score/SKILL.md +0 -113
- package/.skills_github/skills/sas-read-strategy/SKILL.md +0 -154
- package/.skills_github/skills/sas-request-classifier/SKILL.md +0 -74
- package/.skills_github/skills/sas-score-workflow/SKILL.md +0 -314
- package/scripts/optimize_final.py +0 -140
- package/scripts/optimize_tools.py +0 -99
- package/scripts/setup-skills.js +0 -34
- package/scripts/update_descriptions.py +0 -46
- package/src/authpkce.js +0 -219
- package/src/handleGetDelete.js +0 -34
- package/src/handleRequest.js +0 -112
- package/src/hapiMcpServer.js +0 -241
- package/src/toolSet/.claude/settings.local.json +0 -13
package/src/toolSet/scrScore.js
CHANGED
|
@@ -1,70 +1,61 @@
|
|
|
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 _scrScore from '../toolHelpers/_scrScore.js';
|
|
8
|
-
|
|
9
|
-
function scrScore(_appContext) {
|
|
10
|
-
let description = `
|
|
11
|
-
## scr-score
|
|
12
|
-
|
|
13
|
-
Purpose
|
|
14
|
-
Score a scenario using a model deployed as a SCR container in Azure or another host).
|
|
15
|
-
|
|
16
|
-
Inputs
|
|
17
|
-
- url (string, required): SCR model identifier (URL)
|
|
18
|
-
- scenario (
|
|
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
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
let r = await _scrScore({ url: url, scenario: scenario , _appContext: _appContext});
|
|
63
|
-
return r;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return spec;
|
|
68
|
-
}
|
|
69
|
-
|
|
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 _scrScore from '../toolHelpers/_scrScore.js';
|
|
8
|
+
|
|
9
|
+
function scrScore(_appContext) {
|
|
10
|
+
let description = `
|
|
11
|
+
## scr-score
|
|
12
|
+
|
|
13
|
+
Purpose
|
|
14
|
+
Score a scenario using a model deployed as a SCR container in Azure or another host).
|
|
15
|
+
|
|
16
|
+
Inputs
|
|
17
|
+
- url (string, required): SCR model identifier (URL)
|
|
18
|
+
- scenario (object, optional): Input values to score as a JSON object (e.g. {age:45, income:60000}). If omitted, defaults to {} and the tool will return the model's input variable definitions.
|
|
19
|
+
|
|
20
|
+
What it returns
|
|
21
|
+
- When scoring: the SCR endpoint response (predictions, probabilities, scores) merged with or alongside the supplied inputs.
|
|
22
|
+
- When \`scenario\` is omitted: metadata describing the model's input variables (names, types, required/optional).
|
|
23
|
+
|
|
24
|
+
Usage notes
|
|
25
|
+
- Run \`scr-info\` first to inspect the expected input variables and types.
|
|
26
|
+
- Prefer structured objects for numeric/date values to avoid type ambiguity; the simple string parser keeps values as strings.
|
|
27
|
+
- Ensure network connectivity and any required credentials for the target SCR service.
|
|
28
|
+
|
|
29
|
+
Examples
|
|
30
|
+
- scrScore with url="loan" and scenario={age:45, income:60000}
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
let spec = {
|
|
34
|
+
name: 'scr-score',
|
|
35
|
+
description: description,
|
|
36
|
+
inputSchema: z.object({
|
|
37
|
+
url: z.string(),
|
|
38
|
+
scenario: z.union([z.record(z.any()), z.string()]).optional()
|
|
39
|
+
}),
|
|
40
|
+
|
|
41
|
+
handler: async (params) => {
|
|
42
|
+
let {url, _appContext} = params;
|
|
43
|
+
let scenario = params.scenario;
|
|
44
|
+
if (typeof scenario === 'string') {
|
|
45
|
+
try { scenario = JSON.parse(scenario); } catch { scenario = {}; }
|
|
46
|
+
}
|
|
47
|
+
if (url === null) {
|
|
48
|
+
return { status: { statusCode: 2, msg: `SCR model ${url} was not specified` }, results: {} };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const scenarioObj = (scenario != null && typeof scenario === 'object') ? scenario : {};
|
|
52
|
+
|
|
53
|
+
let r = await _scrScore({ url: url, scenario: scenarioObj, _appContext: _appContext});
|
|
54
|
+
return r;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return spec;
|
|
59
|
+
}
|
|
60
|
+
|
|
70
61
|
export default scrScore;
|
|
@@ -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
|
-
|
|
8
|
-
function setContext(_appContext) {
|
|
9
|
-
let description = `
|
|
10
|
-
set-context — set the CAS and SAS server contexts for subsequent tool calls.
|
|
11
|
-
|
|
12
|
-
USE when: switch to CAS server, change compute context, check current context, set both
|
|
13
|
-
DO NOT USE for: get variables (use get-env), read data (use read-table), run programs (use run-sas-program)
|
|
14
|
-
|
|
15
|
-
PARAMETERS
|
|
16
|
-
- cas: string — CAS server name (optional), e.g. 'cas-shared-default', 'finance-cas-server'
|
|
17
|
-
- sas: string — SAS compute context (optional), e.g. 'SAS Studio Compute Context', 'batch-compute'
|
|
18
|
-
|
|
19
|
-
ROUTING RULES
|
|
20
|
-
- "use finance-cas-server" → { cas: "finance-cas-server" }
|
|
21
|
-
- "switch to SAS Studio Compute Context" → { sas: "SAS Studio Compute Context" }
|
|
22
|
-
- "use finance-cas for CAS and batch-compute for SAS" → { cas: "finance-cas", sas: "batch-compute" }
|
|
23
|
-
- "what context am I using" → { } (no params, returns current)
|
|
24
|
-
|
|
25
|
-
EXAMPLES
|
|
26
|
-
- "use finance-cas-server" → { cas: "finance-cas-server" }
|
|
27
|
-
- "switch to batch-compute" → { sas: "batch-compute" }
|
|
28
|
-
- "what's my current context" → { }
|
|
29
|
-
|
|
30
|
-
NEGATIVE EXAMPLES (do not route here)
|
|
31
|
-
- "read table cars" (use read-table)
|
|
32
|
-
- "what's the value of X" (use get-env)
|
|
33
|
-
- "run program" (use run-sas-program)
|
|
34
|
-
|
|
35
|
-
ERRORS
|
|
36
|
-
Returns current or updated context values {cas, sas}. Error if server not found or invalid name.
|
|
37
|
-
`;
|
|
38
|
-
|
|
39
|
-
let spec = {
|
|
40
|
-
name: 'set-context',
|
|
41
|
-
description: description,
|
|
42
|
-
inputSchema: z.object({
|
|
43
|
-
cas: z.string().optional(),
|
|
44
|
-
sas: z.string().optional()
|
|
45
|
-
}),
|
|
46
|
-
handler: async (params) => {
|
|
47
|
-
|
|
48
|
-
let {cas, sas} = params;
|
|
49
|
-
if (typeof cas === 'string' && cas.trim().length > 0) {
|
|
50
|
-
_appContext.contexts.cas = cas.trim();
|
|
51
|
-
}
|
|
52
|
-
if (typeof sas === 'string' && sas.trim().length > 0) {
|
|
53
|
-
_appContext.contexts.sas = sas.trim();
|
|
54
|
-
}
|
|
55
|
-
// Return a structured response without extraneous keys
|
|
56
|
-
return {
|
|
57
|
-
content: [{ type: 'text', text: JSON.stringify(_appContext.contexts) }],
|
|
58
|
-
structuredContent: _appContext.contexts
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return spec;
|
|
63
|
-
}
|
|
64
|
-
export default setContext;
|
|
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
|
+
|
|
8
|
+
function setContext(_appContext) {
|
|
9
|
+
let description = `
|
|
10
|
+
set-context — set the CAS and SAS server contexts for subsequent tool calls.
|
|
11
|
+
|
|
12
|
+
USE when: switch to CAS server, change compute context, check current context, set both
|
|
13
|
+
DO NOT USE for: get variables (use get-env), read data (use read-table), run programs (use run-sas-program)
|
|
14
|
+
|
|
15
|
+
PARAMETERS
|
|
16
|
+
- cas: string — CAS server name (optional), e.g. 'cas-shared-default', 'finance-cas-server'
|
|
17
|
+
- sas: string — SAS compute context (optional), e.g. 'SAS Studio Compute Context', 'batch-compute'
|
|
18
|
+
|
|
19
|
+
ROUTING RULES
|
|
20
|
+
- "use finance-cas-server" → { cas: "finance-cas-server" }
|
|
21
|
+
- "switch to SAS Studio Compute Context" → { sas: "SAS Studio Compute Context" }
|
|
22
|
+
- "use finance-cas for CAS and batch-compute for SAS" → { cas: "finance-cas", sas: "batch-compute" }
|
|
23
|
+
- "what context am I using" → { } (no params, returns current)
|
|
24
|
+
|
|
25
|
+
EXAMPLES
|
|
26
|
+
- "use finance-cas-server" → { cas: "finance-cas-server" }
|
|
27
|
+
- "switch to batch-compute" → { sas: "batch-compute" }
|
|
28
|
+
- "what's my current context" → { }
|
|
29
|
+
|
|
30
|
+
NEGATIVE EXAMPLES (do not route here)
|
|
31
|
+
- "read table cars" (use read-table)
|
|
32
|
+
- "what's the value of X" (use get-env)
|
|
33
|
+
- "run program" (use run-sas-program)
|
|
34
|
+
|
|
35
|
+
ERRORS
|
|
36
|
+
Returns current or updated context values {cas, sas}. Error if server not found or invalid name.
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
let spec = {
|
|
40
|
+
name: 'set-context',
|
|
41
|
+
description: description,
|
|
42
|
+
inputSchema: z.object({
|
|
43
|
+
cas: z.string().optional(),
|
|
44
|
+
sas: z.string().optional()
|
|
45
|
+
}),
|
|
46
|
+
handler: async (params) => {
|
|
47
|
+
|
|
48
|
+
let {cas, sas} = params;
|
|
49
|
+
if (typeof cas === 'string' && cas.trim().length > 0) {
|
|
50
|
+
_appContext.contexts.cas = cas.trim();
|
|
51
|
+
}
|
|
52
|
+
if (typeof sas === 'string' && sas.trim().length > 0) {
|
|
53
|
+
_appContext.contexts.sas = sas.trim();
|
|
54
|
+
}
|
|
55
|
+
// Return a structured response without extraneous keys
|
|
56
|
+
return {
|
|
57
|
+
content: [{ type: 'text', text: JSON.stringify(_appContext.contexts) }],
|
|
58
|
+
structuredContent: _appContext.contexts
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return spec;
|
|
63
|
+
}
|
|
64
|
+
export default setContext;
|
|
65
|
+
|
package/src/toolSet/superstat.js
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © 2025, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
|
|
3
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
*/
|
|
5
|
-
import { type } from 'node:os';
|
|
6
|
-
import _submitCode from '../toolHelpers/_submitCode.js';
|
|
7
|
-
import { z } from 'zod';
|
|
8
|
-
|
|
9
|
-
function superstat(_appContext) {
|
|
10
|
-
let desc = `
|
|
11
|
-
## superstat: compute superstat for two numbers using SAS programming
|
|
12
|
-
|
|
13
|
-
## Details
|
|
14
|
-
This is a tool to demonstrate using SAS programming to score. The SAS program for suprestat is
|
|
15
|
-
below. In a real application this would be a more complex program that is
|
|
16
|
-
available to the SAS server.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
ods html style=barrettsblue;
|
|
20
|
-
data temp;
|
|
21
|
-
superstat = (&a + &b) * 42;
|
|
22
|
-
run;
|
|
23
|
-
proc print data=temp;
|
|
24
|
-
run;
|
|
25
|
-
ods html close;
|
|
26
|
-
run;
|
|
27
|
-
|
|
28
|
-
## Sample Prompt
|
|
29
|
-
|
|
30
|
-
- compute superstat for 1 and 2
|
|
31
|
-
- compute superstat for 3,5
|
|
32
|
-
|
|
33
|
-
`;
|
|
34
|
-
let spec = {
|
|
35
|
-
name: 'superstat',
|
|
36
|
-
description: desc,
|
|
37
|
-
inputSchema: z.object({
|
|
38
|
-
a: z.number().optional()
|
|
39
|
-
}),
|
|
40
|
-
required: ['a', 'b']
|
|
41
|
-
},
|
|
42
|
-
handler: async (params) => {
|
|
43
|
-
let src = `
|
|
44
|
-
ods html style=barrettsblue;
|
|
45
|
-
data temp;
|
|
46
|
-
superstat = (&a + &b) * 42;
|
|
47
|
-
run;
|
|
48
|
-
proc print data=temp;
|
|
49
|
-
run;
|
|
50
|
-
ods html close;
|
|
51
|
-
run;
|
|
52
|
-
`;
|
|
53
|
-
params.src = src;
|
|
54
|
-
let r = await _submitCode(params);
|
|
55
|
-
return r;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
};
|
|
59
|
-
return spec;
|
|
60
|
-
}
|
|
61
|
-
export default superstat;
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © 2025, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import { type } from 'node:os';
|
|
6
|
+
import _submitCode from '../toolHelpers/_submitCode.js';
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
|
|
9
|
+
function superstat(_appContext) {
|
|
10
|
+
let desc = `
|
|
11
|
+
## superstat: compute superstat for two numbers using SAS programming
|
|
12
|
+
|
|
13
|
+
## Details
|
|
14
|
+
This is a tool to demonstrate using SAS programming to score. The SAS program for suprestat is
|
|
15
|
+
below. In a real application this would be a more complex program that is
|
|
16
|
+
available to the SAS server.
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
ods html style=barrettsblue;
|
|
20
|
+
data temp;
|
|
21
|
+
superstat = (&a + &b) * 42;
|
|
22
|
+
run;
|
|
23
|
+
proc print data=temp;
|
|
24
|
+
run;
|
|
25
|
+
ods html close;
|
|
26
|
+
run;
|
|
27
|
+
|
|
28
|
+
## Sample Prompt
|
|
29
|
+
|
|
30
|
+
- compute superstat for 1 and 2
|
|
31
|
+
- compute superstat for 3,5
|
|
32
|
+
|
|
33
|
+
`;
|
|
34
|
+
let spec = {
|
|
35
|
+
name: 'superstat',
|
|
36
|
+
description: desc,
|
|
37
|
+
inputSchema: z.object({
|
|
38
|
+
a: z.number().optional()
|
|
39
|
+
}),
|
|
40
|
+
required: ['a', 'b']
|
|
41
|
+
},
|
|
42
|
+
handler: async (params) => {
|
|
43
|
+
let src = `
|
|
44
|
+
ods html style=barrettsblue;
|
|
45
|
+
data temp;
|
|
46
|
+
superstat = (&a + &b) * 42;
|
|
47
|
+
run;
|
|
48
|
+
proc print data=temp;
|
|
49
|
+
run;
|
|
50
|
+
ods html close;
|
|
51
|
+
run;
|
|
52
|
+
`;
|
|
53
|
+
params.src = src;
|
|
54
|
+
let r = await _submitCode(params);
|
|
55
|
+
return r;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
};
|
|
59
|
+
return spec;
|
|
60
|
+
}
|
|
61
|
+
export default superstat;
|
package/src/toolSet/tableInfo.js
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
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;
|
|
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;
|