@sassoftware/sas-score-mcp-serverjs 1.1.1 → 1.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/cli.js +2 -2
- package/package.json +1 -1
- package/src/oauthHandlers/authorize.js +7 -2
- 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
package/src/toolSet/findJob.js
CHANGED
|
@@ -1,74 +1,74 @@
|
|
|
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 _listJobs from '../toolHelpers/_listJobs.js';
|
|
7
|
-
import _findJob from '../toolHelpers/_findJob.js';
|
|
8
|
-
function findJob(_appContext) {
|
|
9
|
-
const isAgent = _appContext && _appContext.agent;
|
|
10
|
-
let description = isAgent ? `
|
|
11
|
-
find-job — verify a Job model exists.
|
|
12
|
-
PARAMS: name (string, required)
|
|
13
|
-
RETURNS: job metadata if found, error if not found
|
|
14
|
-
` : `
|
|
15
|
-
find-job — locate a specific SAS Viya job.
|
|
16
|
-
|
|
17
|
-
USE when: find job, does job exist, is there a job named, lookup job, verify job exists
|
|
18
|
-
DO NOT USE for: list jobs (use ${_appContext.brand}-list-jobs), score job (use ${_appContext.brand}-job-score), score jobdef (use ${_appContext.brand}-jobdef-score), find lib/table/model (use respective tools)
|
|
19
|
-
|
|
20
|
-
PARAMETERS
|
|
21
|
-
- name: string (required) — job name to locate; if multiple supplied, use first
|
|
22
|
-
|
|
23
|
-
Naming Rules:
|
|
24
|
-
- If user provides name with "job" suffix ".job", strip the suffix (e.g., "cars_job_v4.job"), and look for "cars_job_v4".
|
|
25
|
-
|
|
26
|
-
ROUTING RULES
|
|
27
|
-
- "find job <name>" → { name: "<name>" }
|
|
28
|
-
- "find name.job" → { name: "<name>" }
|
|
29
|
-
- "does job <name> exist" → { name: "<name>" }
|
|
30
|
-
- "is there a job named <name>" → { name: "<name>" }
|
|
31
|
-
- "lookup/verify job <name>" → { name: "<name>" }
|
|
32
|
-
- "find job" with no name → ask "Which job name would you like to find?"
|
|
33
|
-
- "find all jobs / list jobs" → use ${_appContext.brand}-list-jobs instead
|
|
34
|
-
- "score job <name>" → use ${_appContext.brand}-job-score instead
|
|
35
|
-
|
|
36
|
-
EXAMPLES
|
|
37
|
-
- "find job cars_job_v4" → { name: "cars_job_v4" }
|
|
38
|
-
- "does job ETL exist" → { name: "ETL" }
|
|
39
|
-
- "is there a job named metricsRefresh" → { name: "metricsRefresh" }
|
|
40
|
-
|
|
41
|
-
NEGATIVE EXAMPLES (do not route here)
|
|
42
|
-
- "list jobs" (use ${_appContext.brand}-list-jobs)
|
|
43
|
-
- "score job cars_job_v4" (use ${_appContext.brand}-job-score)
|
|
44
|
-
- "score jobdef cars_job_v4" (use ${_appContext.brand}-jobdef-score)
|
|
45
|
-
|
|
46
|
-
ERRORS
|
|
47
|
-
Returns { jobs: [] } if not found; { jobs: [name, ...] } if found. Never hallucinate job names.
|
|
48
|
-
`;
|
|
49
|
-
|
|
50
|
-
let spec = {
|
|
51
|
-
name: 'find-job',
|
|
52
|
-
description: description,
|
|
53
|
-
inputSchema: z.object({
|
|
54
|
-
name: z.string()
|
|
55
|
-
}),
|
|
56
|
-
handler: async (params) => {
|
|
57
|
-
if (params.name != null) {
|
|
58
|
-
if (params.name.endsWith('.job')) {
|
|
59
|
-
params.name = params.name.slice(0, -4);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
params.tool = 'find';
|
|
63
|
-
let r = await _findJob(params);
|
|
64
|
-
return r;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
/* correct spec for registerTool with inputSchema */
|
|
70
|
-
|
|
71
|
-
return spec;
|
|
72
|
-
}
|
|
73
|
-
export default findJob;
|
|
74
|
-
|
|
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 _listJobs from '../toolHelpers/_listJobs.js';
|
|
7
|
+
import _findJob from '../toolHelpers/_findJob.js';
|
|
8
|
+
function findJob(_appContext) {
|
|
9
|
+
const isAgent = _appContext && _appContext.agent;
|
|
10
|
+
let description = isAgent ? `
|
|
11
|
+
find-job — verify a Job model exists.
|
|
12
|
+
PARAMS: name (string, required)
|
|
13
|
+
RETURNS: job metadata if found, error if not found
|
|
14
|
+
` : `
|
|
15
|
+
find-job — locate a specific SAS Viya job.
|
|
16
|
+
|
|
17
|
+
USE when: find job, does job exist, is there a job named, lookup job, verify job exists
|
|
18
|
+
DO NOT USE for: list jobs (use ${_appContext.brand}-list-jobs), score job (use ${_appContext.brand}-job-score), score jobdef (use ${_appContext.brand}-jobdef-score), find lib/table/model (use respective tools)
|
|
19
|
+
|
|
20
|
+
PARAMETERS
|
|
21
|
+
- name: string (required) — job name to locate; if multiple supplied, use first
|
|
22
|
+
|
|
23
|
+
Naming Rules:
|
|
24
|
+
- If user provides name with "job" suffix ".job", strip the suffix (e.g., "cars_job_v4.job"), and look for "cars_job_v4".
|
|
25
|
+
|
|
26
|
+
ROUTING RULES
|
|
27
|
+
- "find job <name>" → { name: "<name>" }
|
|
28
|
+
- "find name.job" → { name: "<name>" }
|
|
29
|
+
- "does job <name> exist" → { name: "<name>" }
|
|
30
|
+
- "is there a job named <name>" → { name: "<name>" }
|
|
31
|
+
- "lookup/verify job <name>" → { name: "<name>" }
|
|
32
|
+
- "find job" with no name → ask "Which job name would you like to find?"
|
|
33
|
+
- "find all jobs / list jobs" → use ${_appContext.brand}-list-jobs instead
|
|
34
|
+
- "score job <name>" → use ${_appContext.brand}-job-score instead
|
|
35
|
+
|
|
36
|
+
EXAMPLES
|
|
37
|
+
- "find job cars_job_v4" → { name: "cars_job_v4" }
|
|
38
|
+
- "does job ETL exist" → { name: "ETL" }
|
|
39
|
+
- "is there a job named metricsRefresh" → { name: "metricsRefresh" }
|
|
40
|
+
|
|
41
|
+
NEGATIVE EXAMPLES (do not route here)
|
|
42
|
+
- "list jobs" (use ${_appContext.brand}-list-jobs)
|
|
43
|
+
- "score job cars_job_v4" (use ${_appContext.brand}-job-score)
|
|
44
|
+
- "score jobdef cars_job_v4" (use ${_appContext.brand}-jobdef-score)
|
|
45
|
+
|
|
46
|
+
ERRORS
|
|
47
|
+
Returns { jobs: [] } if not found; { jobs: [name, ...] } if found. Never hallucinate job names.
|
|
48
|
+
`;
|
|
49
|
+
|
|
50
|
+
let spec = {
|
|
51
|
+
name: 'find-job',
|
|
52
|
+
description: description,
|
|
53
|
+
inputSchema: z.object({
|
|
54
|
+
name: z.string()
|
|
55
|
+
}),
|
|
56
|
+
handler: async (params) => {
|
|
57
|
+
if (params.name != null) {
|
|
58
|
+
if (params.name.endsWith('.job')) {
|
|
59
|
+
params.name = params.name.slice(0, -4);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
params.tool = 'find';
|
|
63
|
+
let r = await _findJob(params);
|
|
64
|
+
return r;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
/* correct spec for registerTool with inputSchema */
|
|
70
|
+
|
|
71
|
+
return spec;
|
|
72
|
+
}
|
|
73
|
+
export default findJob;
|
|
74
|
+
|
|
@@ -1,67 +1,67 @@
|
|
|
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 _findJobdef from '../toolHelpers/_findJobdef.js';
|
|
7
|
-
function findJobdef(_appContext) {
|
|
8
|
-
const isAgent = _appContext && _appContext.agent;
|
|
9
|
-
let description = isAgent ? `
|
|
10
|
-
find-jobdef — verify a JobDef model exists.
|
|
11
|
-
PARAMS: name (string, required)
|
|
12
|
-
RETURNS: jobdef metadata if found, error if not found
|
|
13
|
-
` : `
|
|
14
|
-
find-jobdef — locate a specific SAS Viya job definition.
|
|
15
|
-
|
|
16
|
-
USE when: find jobdef, does jobdef exist, is there a jobdef named, lookup jobdef, verify jobdef exists
|
|
17
|
-
DO NOT USE for: list jobdefs (use ${_appContext.brand}-list-jobdefs), score jobdef (use ${_appContext.brand}-jobdef-score), find job/lib/table/model (use respective tools)
|
|
18
|
-
|
|
19
|
-
PARAMETERS
|
|
20
|
-
- name: string (required) — jobdef name to locate; if multiple supplied, use first
|
|
21
|
-
|
|
22
|
-
ROUTING RULES
|
|
23
|
-
- "find jobdef <name>" → { name: "<name>" }
|
|
24
|
-
- "find name.jobdef" → { name: "<name>" }
|
|
25
|
-
- "does jobdef <name> exist" → { name: "<name>" }
|
|
26
|
-
- "is there a jobdef named <name>" → { name: "<name>" }
|
|
27
|
-
- "lookup/verify jobdef <name>" → { name: "<name>" }
|
|
28
|
-
- "find jobdef" with no name → ask "Which jobdef name would you like to find?"
|
|
29
|
-
- "find all jobdefs / list jobdefs" → use ${_appContext.brand}-list-jobdefs instead
|
|
30
|
-
- "score jobdef <name>" → use ${_appContext.brand}-jobdef-score instead
|
|
31
|
-
|
|
32
|
-
EXAMPLES
|
|
33
|
-
- "find jobdef cars_job_v4" → { name: "cars_job_v4" }
|
|
34
|
-
- "does jobdef ETL exist" → { name: "ETL" }
|
|
35
|
-
- "is there a jobdef named metricsRefresh" → { name: "metricsRefresh" }
|
|
36
|
-
|
|
37
|
-
NEGATIVE EXAMPLES (do not route here)
|
|
38
|
-
- "list jobdefs" (use ${_appContext.brand}-list-jobdefs)
|
|
39
|
-
- "score jobdef cars_job_v4" (use ${_appContext.brand}-jobdef-score)
|
|
40
|
-
- "find job ETL" (use ${_appContext.brand}-find-job)
|
|
41
|
-
- "find table cars" (use ${_appContext.brand}-find-table)
|
|
42
|
-
|
|
43
|
-
ERRORS
|
|
44
|
-
Returns { jobdefs: [] } if not found; { jobdefs: [name, ...] } if found. Never hallucinate jobdef names.
|
|
45
|
-
`;
|
|
46
|
-
|
|
47
|
-
let spec = {
|
|
48
|
-
name: 'find-jobdef',
|
|
49
|
-
description: description,
|
|
50
|
-
inputSchema: z.object({
|
|
51
|
-
name: z.string()
|
|
52
|
-
}),
|
|
53
|
-
handler: async (params) => {
|
|
54
|
-
if (params.name != null) {
|
|
55
|
-
if (params.name.endsWith('.jobdef')) {
|
|
56
|
-
params.name = params.name.slice(0, -7);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
params.tool = 'find';
|
|
60
|
-
let r = await _findJobdef(params);
|
|
61
|
-
return r;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
return spec;
|
|
65
|
-
}
|
|
66
|
-
export default findJobdef;
|
|
67
|
-
|
|
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 _findJobdef from '../toolHelpers/_findJobdef.js';
|
|
7
|
+
function findJobdef(_appContext) {
|
|
8
|
+
const isAgent = _appContext && _appContext.agent;
|
|
9
|
+
let description = isAgent ? `
|
|
10
|
+
find-jobdef — verify a JobDef model exists.
|
|
11
|
+
PARAMS: name (string, required)
|
|
12
|
+
RETURNS: jobdef metadata if found, error if not found
|
|
13
|
+
` : `
|
|
14
|
+
find-jobdef — locate a specific SAS Viya job definition.
|
|
15
|
+
|
|
16
|
+
USE when: find jobdef, does jobdef exist, is there a jobdef named, lookup jobdef, verify jobdef exists
|
|
17
|
+
DO NOT USE for: list jobdefs (use ${_appContext.brand}-list-jobdefs), score jobdef (use ${_appContext.brand}-jobdef-score), find job/lib/table/model (use respective tools)
|
|
18
|
+
|
|
19
|
+
PARAMETERS
|
|
20
|
+
- name: string (required) — jobdef name to locate; if multiple supplied, use first
|
|
21
|
+
|
|
22
|
+
ROUTING RULES
|
|
23
|
+
- "find jobdef <name>" → { name: "<name>" }
|
|
24
|
+
- "find name.jobdef" → { name: "<name>" }
|
|
25
|
+
- "does jobdef <name> exist" → { name: "<name>" }
|
|
26
|
+
- "is there a jobdef named <name>" → { name: "<name>" }
|
|
27
|
+
- "lookup/verify jobdef <name>" → { name: "<name>" }
|
|
28
|
+
- "find jobdef" with no name → ask "Which jobdef name would you like to find?"
|
|
29
|
+
- "find all jobdefs / list jobdefs" → use ${_appContext.brand}-list-jobdefs instead
|
|
30
|
+
- "score jobdef <name>" → use ${_appContext.brand}-jobdef-score instead
|
|
31
|
+
|
|
32
|
+
EXAMPLES
|
|
33
|
+
- "find jobdef cars_job_v4" → { name: "cars_job_v4" }
|
|
34
|
+
- "does jobdef ETL exist" → { name: "ETL" }
|
|
35
|
+
- "is there a jobdef named metricsRefresh" → { name: "metricsRefresh" }
|
|
36
|
+
|
|
37
|
+
NEGATIVE EXAMPLES (do not route here)
|
|
38
|
+
- "list jobdefs" (use ${_appContext.brand}-list-jobdefs)
|
|
39
|
+
- "score jobdef cars_job_v4" (use ${_appContext.brand}-jobdef-score)
|
|
40
|
+
- "find job ETL" (use ${_appContext.brand}-find-job)
|
|
41
|
+
- "find table cars" (use ${_appContext.brand}-find-table)
|
|
42
|
+
|
|
43
|
+
ERRORS
|
|
44
|
+
Returns { jobdefs: [] } if not found; { jobdefs: [name, ...] } if found. Never hallucinate jobdef names.
|
|
45
|
+
`;
|
|
46
|
+
|
|
47
|
+
let spec = {
|
|
48
|
+
name: 'find-jobdef',
|
|
49
|
+
description: description,
|
|
50
|
+
inputSchema: z.object({
|
|
51
|
+
name: z.string()
|
|
52
|
+
}),
|
|
53
|
+
handler: async (params) => {
|
|
54
|
+
if (params.name != null) {
|
|
55
|
+
if (params.name.endsWith('.jobdef')) {
|
|
56
|
+
params.name = params.name.slice(0, -7);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
params.tool = 'find';
|
|
60
|
+
let r = await _findJobdef(params);
|
|
61
|
+
return r;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return spec;
|
|
65
|
+
}
|
|
66
|
+
export default findJobdef;
|
|
67
|
+
|
|
@@ -1,73 +1,73 @@
|
|
|
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 findLibrary(_appContext) {
|
|
8
|
-
const isAgent = _appContext && _appContext.agent;
|
|
9
|
-
let description = isAgent ? `
|
|
10
|
-
find-library — verify a library exists.
|
|
11
|
-
PARAMS: name (string, required), server ('cas'|'sas', required)
|
|
12
|
-
RETURNS: library metadata if found, error if not found
|
|
13
|
-
` : `
|
|
14
|
-
find-library — locate a specific CAS or SAS library.
|
|
15
|
-
|
|
16
|
-
USE when: find library, find lib, does library exist, is library available, lookup library
|
|
17
|
-
DO NOT USE for: list libraries (use ${_appContext.brand}-list-libraries), find table/job/jobdef/model (use respective tools), table structure (use ${_appContext.brand}-table-describe), create library (use ${_appContext.brand}-program-score)
|
|
18
|
-
|
|
19
|
-
PARAMETERS
|
|
20
|
-
- name: string (required) — library/caslib name; if multiple supplied, use first
|
|
21
|
-
- server: 'cas' | 'sas' (required) — target environment
|
|
22
|
-
|
|
23
|
-
ROUTING RULES
|
|
24
|
-
- "find lib <name>" → { name: "<name>", server: "cas" }
|
|
25
|
-
- "find lib <name> in cas" → { name: "<name>", server: "cas" }
|
|
26
|
-
- "find library <name> in sas" → { name: "<name>", server: "sas" }
|
|
27
|
-
- "does library <name> exist" → { name: "<name>", server: "cas" }
|
|
28
|
-
- "find lib" with no name → ask "Which library name would you like to find?"
|
|
29
|
-
- "list libraries / list libs" → use ${_appContext.brand}-list-libraries instead
|
|
30
|
-
- "tables in <lib>" → use ${_appContext.brand}-list-tables instead
|
|
31
|
-
|
|
32
|
-
EXAMPLES
|
|
33
|
-
- "find lib Public" → { name: "Public", server: "cas" }
|
|
34
|
-
- "find library sasuser in sas" → { name: "sasuser", server: "sas" }
|
|
35
|
-
- "does library Formats exist" → { name: "Formats", server: "cas" }
|
|
36
|
-
|
|
37
|
-
NEGATIVE EXAMPLES (do not route here)
|
|
38
|
-
- "list libs" (use ${_appContext.brand}-list-libraries)
|
|
39
|
-
- "show tables in Public" (use ${_appContext.brand}-list-tables)
|
|
40
|
-
- "find table cars in sashelp" (use ${_appContext.brand}-find-table)
|
|
41
|
-
- "find job cars_job" (use ${_appContext.brand}-find-job)
|
|
42
|
-
|
|
43
|
-
ERRORS
|
|
44
|
-
Returns { libraries: [] } if not found; { libraries: [name, ...] } if found. Never hallucinate library names.
|
|
45
|
-
`;
|
|
46
|
-
|
|
47
|
-
let spec = {
|
|
48
|
-
name: 'find-library',
|
|
49
|
-
description: description,
|
|
50
|
-
inputSchema: z.object({
|
|
51
|
-
name: z.string(),
|
|
52
|
-
server: z.string().optional()
|
|
53
|
-
}),
|
|
54
|
-
|
|
55
|
-
handler: async (params) => {
|
|
56
|
-
// normalize server to lowercase & default
|
|
57
|
-
if (!params.server) params.server = 'cas';
|
|
58
|
-
params.server = params.server.toLowerCase();
|
|
59
|
-
|
|
60
|
-
// If multiple names passed (comma or space separated), take the first token (defensive)
|
|
61
|
-
if (params.name && /[,\s]+/.test(params.name.trim())) {
|
|
62
|
-
params.name = params.name.split(/[,\s]+/).filter(Boolean)[0];
|
|
63
|
-
}
|
|
64
|
-
params.tool = 'find';
|
|
65
|
-
let r = await _listLibrary(params);
|
|
66
|
-
return r;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return spec;
|
|
70
|
-
}
|
|
71
|
-
export default findLibrary;
|
|
72
|
-
|
|
73
|
-
|
|
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 findLibrary(_appContext) {
|
|
8
|
+
const isAgent = _appContext && _appContext.agent;
|
|
9
|
+
let description = isAgent ? `
|
|
10
|
+
find-library — verify a library exists.
|
|
11
|
+
PARAMS: name (string, required), server ('cas'|'sas', required)
|
|
12
|
+
RETURNS: library metadata if found, error if not found
|
|
13
|
+
` : `
|
|
14
|
+
find-library — locate a specific CAS or SAS library.
|
|
15
|
+
|
|
16
|
+
USE when: find library, find lib, does library exist, is library available, lookup library
|
|
17
|
+
DO NOT USE for: list libraries (use ${_appContext.brand}-list-libraries), find table/job/jobdef/model (use respective tools), table structure (use ${_appContext.brand}-table-describe), create library (use ${_appContext.brand}-program-score)
|
|
18
|
+
|
|
19
|
+
PARAMETERS
|
|
20
|
+
- name: string (required) — library/caslib name; if multiple supplied, use first
|
|
21
|
+
- server: 'cas' | 'sas' (required) — target environment
|
|
22
|
+
|
|
23
|
+
ROUTING RULES
|
|
24
|
+
- "find lib <name>" → { name: "<name>", server: "cas" }
|
|
25
|
+
- "find lib <name> in cas" → { name: "<name>", server: "cas" }
|
|
26
|
+
- "find library <name> in sas" → { name: "<name>", server: "sas" }
|
|
27
|
+
- "does library <name> exist" → { name: "<name>", server: "cas" }
|
|
28
|
+
- "find lib" with no name → ask "Which library name would you like to find?"
|
|
29
|
+
- "list libraries / list libs" → use ${_appContext.brand}-list-libraries instead
|
|
30
|
+
- "tables in <lib>" → use ${_appContext.brand}-list-tables instead
|
|
31
|
+
|
|
32
|
+
EXAMPLES
|
|
33
|
+
- "find lib Public" → { name: "Public", server: "cas" }
|
|
34
|
+
- "find library sasuser in sas" → { name: "sasuser", server: "sas" }
|
|
35
|
+
- "does library Formats exist" → { name: "Formats", server: "cas" }
|
|
36
|
+
|
|
37
|
+
NEGATIVE EXAMPLES (do not route here)
|
|
38
|
+
- "list libs" (use ${_appContext.brand}-list-libraries)
|
|
39
|
+
- "show tables in Public" (use ${_appContext.brand}-list-tables)
|
|
40
|
+
- "find table cars in sashelp" (use ${_appContext.brand}-find-table)
|
|
41
|
+
- "find job cars_job" (use ${_appContext.brand}-find-job)
|
|
42
|
+
|
|
43
|
+
ERRORS
|
|
44
|
+
Returns { libraries: [] } if not found; { libraries: [name, ...] } if found. Never hallucinate library names.
|
|
45
|
+
`;
|
|
46
|
+
|
|
47
|
+
let spec = {
|
|
48
|
+
name: 'find-library',
|
|
49
|
+
description: description,
|
|
50
|
+
inputSchema: z.object({
|
|
51
|
+
name: z.string(),
|
|
52
|
+
server: z.string().optional()
|
|
53
|
+
}),
|
|
54
|
+
|
|
55
|
+
handler: async (params) => {
|
|
56
|
+
// normalize server to lowercase & default
|
|
57
|
+
if (!params.server) params.server = 'cas';
|
|
58
|
+
params.server = params.server.toLowerCase();
|
|
59
|
+
|
|
60
|
+
// If multiple names passed (comma or space separated), take the first token (defensive)
|
|
61
|
+
if (params.name && /[,\s]+/.test(params.name.trim())) {
|
|
62
|
+
params.name = params.name.split(/[,\s]+/).filter(Boolean)[0];
|
|
63
|
+
}
|
|
64
|
+
params.tool = 'find';
|
|
65
|
+
let r = await _listLibrary(params);
|
|
66
|
+
return r;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return spec;
|
|
70
|
+
}
|
|
71
|
+
export default findLibrary;
|
|
72
|
+
|
|
73
|
+
|
package/src/toolSet/findMas.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { z } from 'zod';
|
|
7
|
-
import
|
|
7
|
+
import _findMas from '../toolHelpers/_findMas.js';
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
function findMas(_appContext) {
|
|
@@ -60,7 +60,7 @@ Returns { mass: [] } if not found; { mass: [name, ...] } if found. Never halluci
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
params.tool = 'find';
|
|
63
|
-
let r = await
|
|
63
|
+
let r = await _findMas(params);
|
|
64
64
|
return r;
|
|
65
65
|
}
|
|
66
66
|
}
|
package/src/toolSet/getEnv.js
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
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 _getEnv from '../toolHelpers/_getEnv.js';
|
|
8
|
-
function getEnv(_appContext) {
|
|
9
|
-
let description = `
|
|
10
|
-
get-env — retrieve a variable value from the runtime environment.
|
|
11
|
-
|
|
12
|
-
USE when: what is the value of, get me, show current, what's the, retrieve environment variable
|
|
13
|
-
DO NOT USE for: read table data (use ${_appContext.brand}-read-table), model info (use ${_appContext.brand}-model-info), find/score job (use ${_appContext.brand}-find-job/${_appContext.brand}-job-score), set context (use ${_appContext.brand}-set-context)
|
|
14
|
-
|
|
15
|
-
PARAMETERS
|
|
16
|
-
- name: string (required) — variable name to retrieve (case-sensitive)
|
|
17
|
-
|
|
18
|
-
ROUTING RULES
|
|
19
|
-
- "what is the value of <var>" → { name: "<var>" }
|
|
20
|
-
- "get me <var>" → { name: "<var>" }
|
|
21
|
-
- "show <var>" → { name: "<var>" }
|
|
22
|
-
- "get" with no variable → ask "Which variable would you like to retrieve?"
|
|
23
|
-
- "what context am I using" → use ${_appContext.brand}-set-context instead (no params)
|
|
24
|
-
- "set <var> to <value>" → use ${_appContext.brand}-set-context or ${_appContext.brand}-program-score instead
|
|
25
|
-
|
|
26
|
-
EXAMPLES
|
|
27
|
-
- "What's the value of myVar" → { name: "myVar" }
|
|
28
|
-
- "Get me the configuration variable" → { name: "configuration" }
|
|
29
|
-
- "Show the current server setting" → { name: "server" }
|
|
30
|
-
|
|
31
|
-
NEGATIVE EXAMPLES (do not route here)
|
|
32
|
-
-- "Read rows from customers" (use ${_appContext.brand}-read-table)
|
|
33
|
-
-- "Get model details for myModel" (use ${_appContext.brand}-model-info)
|
|
34
|
-
-- "Set the CAS server to finance-prod" (use ${_appContext.brand}-set-context)
|
|
35
|
-
|
|
36
|
-
ERRORS
|
|
37
|
-
Returns variable name with current value, or null if not found. Return structured error with message field.
|
|
38
|
-
`;
|
|
39
|
-
|
|
40
|
-
let spec = {
|
|
41
|
-
name: 'get-env',
|
|
42
|
-
description: description,
|
|
43
|
-
inputSchema: {
|
|
44
|
-
type: 'object',
|
|
45
|
-
properties: {
|
|
46
|
-
name: { type: 'string' }
|
|
47
|
-
},
|
|
48
|
-
required: ['name']
|
|
49
|
-
},
|
|
50
|
-
handler: async (params) => {
|
|
51
|
-
return await _getEnv(params);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return spec;
|
|
55
|
-
}
|
|
56
|
-
export default getEnv;
|
|
57
|
-
|
|
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 _getEnv from '../toolHelpers/_getEnv.js';
|
|
8
|
+
function getEnv(_appContext) {
|
|
9
|
+
let description = `
|
|
10
|
+
get-env — retrieve a variable value from the runtime environment.
|
|
11
|
+
|
|
12
|
+
USE when: what is the value of, get me, show current, what's the, retrieve environment variable
|
|
13
|
+
DO NOT USE for: read table data (use ${_appContext.brand}-read-table), model info (use ${_appContext.brand}-model-info), find/score job (use ${_appContext.brand}-find-job/${_appContext.brand}-job-score), set context (use ${_appContext.brand}-set-context)
|
|
14
|
+
|
|
15
|
+
PARAMETERS
|
|
16
|
+
- name: string (required) — variable name to retrieve (case-sensitive)
|
|
17
|
+
|
|
18
|
+
ROUTING RULES
|
|
19
|
+
- "what is the value of <var>" → { name: "<var>" }
|
|
20
|
+
- "get me <var>" → { name: "<var>" }
|
|
21
|
+
- "show <var>" → { name: "<var>" }
|
|
22
|
+
- "get" with no variable → ask "Which variable would you like to retrieve?"
|
|
23
|
+
- "what context am I using" → use ${_appContext.brand}-set-context instead (no params)
|
|
24
|
+
- "set <var> to <value>" → use ${_appContext.brand}-set-context or ${_appContext.brand}-program-score instead
|
|
25
|
+
|
|
26
|
+
EXAMPLES
|
|
27
|
+
- "What's the value of myVar" → { name: "myVar" }
|
|
28
|
+
- "Get me the configuration variable" → { name: "configuration" }
|
|
29
|
+
- "Show the current server setting" → { name: "server" }
|
|
30
|
+
|
|
31
|
+
NEGATIVE EXAMPLES (do not route here)
|
|
32
|
+
-- "Read rows from customers" (use ${_appContext.brand}-read-table)
|
|
33
|
+
-- "Get model details for myModel" (use ${_appContext.brand}-model-info)
|
|
34
|
+
-- "Set the CAS server to finance-prod" (use ${_appContext.brand}-set-context)
|
|
35
|
+
|
|
36
|
+
ERRORS
|
|
37
|
+
Returns variable name with current value, or null if not found. Return structured error with message field.
|
|
38
|
+
`;
|
|
39
|
+
|
|
40
|
+
let spec = {
|
|
41
|
+
name: 'get-env',
|
|
42
|
+
description: description,
|
|
43
|
+
inputSchema: {
|
|
44
|
+
type: 'object',
|
|
45
|
+
properties: {
|
|
46
|
+
name: { type: 'string' }
|
|
47
|
+
},
|
|
48
|
+
required: ['name']
|
|
49
|
+
},
|
|
50
|
+
handler: async (params) => {
|
|
51
|
+
return await _getEnv(params);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return spec;
|
|
55
|
+
}
|
|
56
|
+
export default getEnv;
|
|
57
|
+
|