@sassoftware/sas-score-mcp-serverjs 0.3.29-0 → 0.4.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.
- package/cli.js +118 -3
- package/openApi.yaml +121 -121
- package/package.json +4 -5
- package/skills/mcp-tool-description-optimizer/SKILL.md +129 -0
- package/skills/mcp-tool-description-optimizer/references/examples.md +123 -0
- package/skills/sas-read-and-score/SKILL.md +91 -0
- package/skills/sas-read-strategy/SKILL.md +143 -0
- package/skills/sas-score-workflow/SKILL.md +283 -0
- package/src/createMcpServer.js +11 -4
- package/src/expressMcpServer.js +1 -1
- package/src/handleGetDelete.js +1 -1
- package/src/openApi.yaml +121 -121
- package/src/toolHelpers/_jobSubmit.js +2 -0
- package/src/toolHelpers/_listLibrary.js +56 -39
- package/src/toolHelpers/readCerts.js +4 -4
- package/src/toolSet/devaScore.js +31 -44
- package/src/toolSet/findJob.js +37 -70
- package/src/toolSet/findJobdef.js +27 -58
- package/src/toolSet/findLibrary.js +29 -62
- package/src/toolSet/findModel.js +34 -57
- package/src/toolSet/findTable.js +29 -59
- package/src/toolSet/getEnv.js +26 -45
- package/src/toolSet/listJobdefs.js +30 -65
- package/src/toolSet/listJobs.js +30 -79
- package/src/toolSet/listLibraries.js +43 -55
- package/src/toolSet/listModels.js +25 -52
- package/src/toolSet/listTables.js +36 -66
- package/src/toolSet/makeTools.js +1 -0
- package/src/toolSet/modelInfo.js +21 -53
- package/src/toolSet/modelScore.js +30 -73
- package/src/toolSet/readTable.js +33 -72
- package/src/toolSet/runCasProgram.js +30 -51
- package/src/toolSet/runJob.js +24 -24
- package/src/toolSet/runJobdef.js +26 -29
- package/src/toolSet/runMacro.js +23 -24
- package/src/toolSet/runProgram.js +32 -80
- package/src/toolSet/sasQuery.js +31 -79
- package/src/toolSet/sasQueryTemplate.js +4 -5
- package/src/toolSet/sasQueryTemplate2.js +4 -5
- package/src/toolSet/scrInfo.js +4 -7
- package/src/toolSet/scrScore.js +2 -4
- package/src/toolSet/searchAssets.js +5 -6
- package/src/toolSet/setContext.js +30 -57
- package/src/toolSet/superstat.js +2 -3
- package/src/toolSet/tableInfo.js +32 -77
package/src/toolSet/runMacro.js
CHANGED
|
@@ -9,43 +9,41 @@ import _submitCode from '../toolHelpers/_submitCode.js';
|
|
|
9
9
|
|
|
10
10
|
function runMacro(_appContext) {
|
|
11
11
|
let description = `
|
|
12
|
-
|
|
12
|
+
run-macro — submit and execute a SAS macro on SAS Viya server.
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
USE when: run macro, execute macro with parameters
|
|
15
|
+
DO NOT USE for: arbitrary SAS code (use run-sas-program), jobs, jobdefs
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
- macro
|
|
18
|
-
- scenario
|
|
19
|
-
- Comma-separated key=value pairs (e.g. "x=1, y=abc") — converted to SAS %let statements.
|
|
20
|
-
- Raw SAS macro code (e.g. "%let x=1; %let y=abc;") — passed through unchanged when it already contains SAS macro syntax.
|
|
17
|
+
PARAMETERS
|
|
18
|
+
- macro: string — macro name without "%" (required)
|
|
19
|
+
- scenario: string — parameters or setup code (optional). Accepts: "x=1, y=abc" or "%let x=1; %let y=abc;"
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
21
|
+
ROUTING RULES
|
|
22
|
+
- "run macro abc" → { macro: "abc", scenario: "" }
|
|
23
|
+
- "run macro abc with x=1, y=2" → { macro: "abc", scenario: "x=1, y=2" }
|
|
24
|
+
- "run macro xyz with %let a=1; %let b=2;" → { macro: "xyz", scenario: "%let a=1; %let b=2;" }
|
|
26
25
|
|
|
27
|
-
|
|
28
|
-
-
|
|
26
|
+
EXAMPLES
|
|
27
|
+
- "run macro abc" → { macro: "abc", scenario: "" }
|
|
28
|
+
- "run macro summarize with x=1, y=2" → { macro: "summarize", scenario: "x=1, y=2" }
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
30
|
+
NEGATIVE EXAMPLES (do not route here)
|
|
31
|
+
- "run SAS code" (use run-sas-program)
|
|
32
|
+
- "run job X" (use run-job)
|
|
33
|
+
- "run jobdef X" (use run-jobdef)
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
`;
|
|
35
|
+
ERRORS
|
|
36
|
+
Returns log, ods, tables created by macro. Auto-converts "x=1, y=2" to "%let x=1; %let y=2;" format.
|
|
37
|
+
`;
|
|
38
38
|
|
|
39
39
|
let spec = {
|
|
40
40
|
name: 'run-macro',
|
|
41
|
-
aliases: ['runMacro','run macro','run_macro'],
|
|
42
41
|
description: description,
|
|
43
42
|
|
|
44
|
-
|
|
43
|
+
inputSchema: z.object({
|
|
45
44
|
macro: z.string(),
|
|
46
45
|
scenario: z.string()
|
|
47
|
-
},
|
|
48
|
-
required: ['macro'],
|
|
46
|
+
}),
|
|
49
47
|
handler: async (params) => {
|
|
50
48
|
const scenarioRaw = (params.scenario || '').trim();
|
|
51
49
|
let setup = '';
|
|
@@ -80,3 +78,4 @@ Examples
|
|
|
80
78
|
}
|
|
81
79
|
|
|
82
80
|
export default runMacro;
|
|
81
|
+
|
|
@@ -8,101 +8,52 @@ import _submitCode from '../toolHelpers/_submitCode.js';
|
|
|
8
8
|
|
|
9
9
|
function runProgram(_appContext) {
|
|
10
10
|
let description = `
|
|
11
|
-
|
|
11
|
+
run-sas-program — execute SAS code or programs on SAS Viya server.
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
- "run program 'data a; x=1; run;'"
|
|
16
|
-
- "execute this SAS code: proc print data=sashelp.cars; run;"
|
|
17
|
-
- "program 'data work.a; x=1; run;' output=a limit=50"
|
|
18
|
-
- "run sas program sample folder=/Public/models output=A limit=50"
|
|
19
|
-
- "run sas program with parameters name=John, age=45"
|
|
20
|
-
- "execute SAS file myprogram.sas from /Public folder"
|
|
13
|
+
USE when: run program, execute SAS code, run .sas file
|
|
14
|
+
DO NOT USE for: macros (use run-macro), jobs (use run-job), jobdefs (use run-jobdef), SQL queries (use sas-query), read data (use read-table)
|
|
21
15
|
|
|
22
|
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
- find job -> use find-job
|
|
29
|
-
- find jobdef -> use find-jobdef
|
|
30
|
-
- find model -> use find-model
|
|
31
|
-
- Query tables with SQL -> use sas-query
|
|
32
|
-
- Read table data -> use read-table
|
|
16
|
+
PARAMETERS
|
|
17
|
+
- src: string — SAS code or .sas filename (required)
|
|
18
|
+
- folder: string (default: '') — server folder path for .sas files
|
|
19
|
+
- scenario: string | object — parameter values. Accepts: "x=1, y=2" or {x:1, y:2}
|
|
20
|
+
- output: string (default: '') — table name to return (case-sensitive)
|
|
21
|
+
- limit: number (default: 100) — max rows from output
|
|
33
22
|
|
|
34
|
-
|
|
35
|
-
Execute SAS code or programs on a SAS Viya server. Can run inline SAS code or execute .sas files stored on the server. Supports parameter passing via scenario values and can return output tables.
|
|
36
|
-
|
|
37
|
-
Parameters
|
|
38
|
-
- src (string, required): The SAS program to execute. Can be either:
|
|
39
|
-
- Inline SAS code as a string (e.g., "data a; x=1; run;")
|
|
40
|
-
- Name of a .sas file stored on the server (used with folder parameter)
|
|
41
|
-
- folder (string, default ''): Server folder path where the .sas file is located (e.g., "/Public/models")
|
|
42
|
-
- scenario (string | object, optional): Input parameter values. Accepts:
|
|
43
|
-
- Comma-separated key=value string (e.g., "x=1, y=2")
|
|
44
|
-
- JSON object with field names and values (recommended)
|
|
45
|
-
- output (string, default ''): Table name to return in response (case-sensitive)
|
|
46
|
-
- limit (number, default 100): Maximum number of rows to return from output table
|
|
47
|
-
|
|
48
|
-
Response Contract
|
|
49
|
-
Returns a JSON object containing:
|
|
50
|
-
- log: Execution log from SAS
|
|
51
|
-
- ods: ODS output if generated
|
|
52
|
-
- tables: Array of table names created during execution
|
|
53
|
-
- data: If output parameter specified, returns the table data (up to limit rows)
|
|
54
|
-
- error: Error message if execution fails
|
|
55
|
-
- Empty content if no results produced
|
|
56
|
-
|
|
57
|
-
Disambiguation & Clarification
|
|
58
|
-
- Missing SAS code: ask "What SAS program or code would you like to execute?"
|
|
59
|
-
- Inline code vs file unclear: ask "Do you want to run inline SAS code or execute a .sas file from the server?"
|
|
60
|
-
- If output table not returned: clarify "The output table name is case-sensitive. Did you specify the exact name?"
|
|
61
|
-
- If unclear about parameters: ask "What parameter values should I pass to the program?"
|
|
62
|
-
|
|
63
|
-
Examples (→ mapped params)
|
|
23
|
+
ROUTING RULES
|
|
64
24
|
- "run program 'data a; x=1; run;'" → { src: "data a; x=1; run;", folder: "", output: "", limit: 100 }
|
|
65
|
-
- "
|
|
66
|
-
- "run
|
|
67
|
-
- "run program mycode.sas in /Public with name=John, age=45" → { src: "mycode", folder: "/Public", scenario: { name: "John", age: 45 }, output: "", limit: 100 }
|
|
25
|
+
- "run sas program sample folder=/Public/models" → { src: "sample", folder: "/Public/models", output: "", limit: 100 }
|
|
26
|
+
- "run program with name=John, age=45" → { src: "<code>", scenario: {name:"John", age:45}, output: "", limit: 100 }
|
|
68
27
|
|
|
69
|
-
|
|
70
|
-
- "run
|
|
71
|
-
- "run
|
|
72
|
-
- "run jobdef etl_process" (use run-jobdef instead)
|
|
73
|
-
- "how many customers by region in Public.customers" (use sas-query instead)
|
|
74
|
-
- "read 10 rows from cars" (use read-table instead)
|
|
28
|
+
EXAMPLES
|
|
29
|
+
- "run program 'data a; x=1; run;'" → { src: "data a; x=1; run;", folder: "", output: "", limit: 100 }
|
|
30
|
+
- "run sas file sample in /Public" → { src: "sample", folder: "/Public", output: "", limit: 100 }
|
|
75
31
|
|
|
76
|
-
|
|
77
|
-
-
|
|
78
|
-
-
|
|
79
|
-
-
|
|
80
|
-
-
|
|
81
|
-
-
|
|
32
|
+
NEGATIVE EXAMPLES (do not route here)
|
|
33
|
+
- "run macro X" (use run-macro)
|
|
34
|
+
- "run job X" (use run-job)
|
|
35
|
+
- "run jobdef X" (use run-jobdef)
|
|
36
|
+
- "SQL query" (use sas-query)
|
|
37
|
+
- "read table" (use read-table)
|
|
82
38
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
- sas-query — for natural language SQL queries
|
|
87
|
-
- read-table — for simple data retrieval
|
|
88
|
-
`;
|
|
39
|
+
ERRORS
|
|
40
|
+
Returns log, ods, tables array, data (if output specified). Error if execution fails.
|
|
41
|
+
`;
|
|
89
42
|
|
|
90
43
|
let spec = {
|
|
91
|
-
name: 'run-
|
|
92
|
-
aliases: ['Program','run program'],
|
|
44
|
+
name: 'run-program',
|
|
93
45
|
description: description,
|
|
94
|
-
|
|
46
|
+
inputSchema: z.object({
|
|
95
47
|
src: z.string(),
|
|
96
|
-
scenario: z.any()
|
|
97
|
-
output: z.string()
|
|
98
|
-
folder: z.string()
|
|
99
|
-
limit: z.number()
|
|
100
|
-
},
|
|
48
|
+
scenario: z.any(),
|
|
49
|
+
output: z.string(),
|
|
50
|
+
folder: z.string(),
|
|
51
|
+
limit: z.number()
|
|
52
|
+
}),
|
|
101
53
|
// NOTE: Previously 'required' incorrectly listed 'program' which does not
|
|
102
54
|
// exist in the schema. This prevented execution in some orchestrators that
|
|
103
55
|
// enforce required parameter presence, causing only descriptions to appear.
|
|
104
56
|
// Corrected to 'src'.
|
|
105
|
-
required: ['src'],
|
|
106
57
|
handler: async (params) => {
|
|
107
58
|
let {src, folder, scenario, _appContext} = params;
|
|
108
59
|
// figure out src
|
|
@@ -143,3 +94,4 @@ Related Tools
|
|
|
143
94
|
}
|
|
144
95
|
|
|
145
96
|
export default runProgram;
|
|
97
|
+
|
package/src/toolSet/sasQuery.js
CHANGED
|
@@ -5,99 +5,50 @@
|
|
|
5
5
|
import {z} from 'zod';
|
|
6
6
|
import _jobSubmit from '../toolHelpers/_jobSubmit.js';
|
|
7
7
|
|
|
8
|
-
|
|
9
8
|
function sasQuery() {
|
|
10
9
|
|
|
11
10
|
let description = `
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
LLM Invocation Guidance (When to use)
|
|
15
|
-
Use THIS tool when:
|
|
16
|
-
- User asks a natural language question about table data: "how many customers by region?"
|
|
17
|
-
- User wants aggregated analytics: "show total sales by year"
|
|
18
|
-
- User needs complex filtering: "find all orders over $1000 from last month"
|
|
19
|
-
- User requests joined data: "show products with their category names"
|
|
20
|
-
- User wants statistical summaries: "average, min, max salary by department"
|
|
21
|
-
- User asks for specific calculations: "percentage of customers by state"
|
|
22
|
-
|
|
23
|
-
Do NOT use this tool for:
|
|
24
|
-
- Reading raw table data without filtering (use read-table)
|
|
25
|
-
- Getting table structure or column info (use table-info)
|
|
26
|
-
- Running pre-written SAS programs (use run-sas-program)
|
|
27
|
-
- Running jobs or job definitions (use run-job or run-jobdef)
|
|
28
|
-
- Executing macros (use run-macro)
|
|
29
|
-
- Simple table reads with no aggregation (use read-table)
|
|
30
|
-
|
|
31
|
-
Purpose
|
|
32
|
-
Convert natural language queries into SAS PROC SQL SELECT statements and execute them to retrieve analyzed data. The LLM generates the SQL from the natural language query, and this tool executes it against the specified table.
|
|
11
|
+
sas-query — convert natural language questions into SQL queries and execute them.
|
|
33
12
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
- query (string, required): Natural language description of what data you want
|
|
37
|
-
- sql (string, optional): Pre-generated SQL SELECT statement (LLM should generate this from the query)
|
|
38
|
-
- job (string, default 'program'): Job name to execute the query (default is 'program')
|
|
13
|
+
USE when: how many/count/total/average by, aggregated analytics, complex filtering, statistical summaries
|
|
14
|
+
DO NOT USE for: raw reads without filtering (use read-table), table structure (use table-info), SAS programs (use run-sas-program), jobs/jobdefs
|
|
39
15
|
|
|
40
|
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
- SQL
|
|
44
|
-
-
|
|
45
|
-
- Returns data in JSON format
|
|
16
|
+
PARAMETERS
|
|
17
|
+
- table: string — table in lib.table format (required), e.g. "Public.cars" or "sashelp.class"
|
|
18
|
+
- query: string — natural language question (required)
|
|
19
|
+
- sql: string — pre-generated SQL SELECT (optional, LLM generates)
|
|
20
|
+
- job: string (default: 'program') — job name to execute
|
|
46
21
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
-
|
|
50
|
-
- columns: Column metadata from the query result
|
|
51
|
-
- log: Execution log if available
|
|
52
|
-
- If error: structured error message
|
|
53
|
-
- If more than 10 rows: only first 10 displayed (ask user if they want more)
|
|
22
|
+
ROUTING RULES
|
|
23
|
+
- "how many cars by make in sashelp.cars" → { table: "sashelp.cars", query: "how many cars by make", sql: "SELECT make, COUNT(*) FROM sashelp.cars GROUP BY make" }
|
|
24
|
+
- "average salary by department in Public.employees" → { table: "Public.employees", query: "average salary by department", sql: "SELECT department, AVG(salary) FROM Public.employees GROUP BY department" }
|
|
54
25
|
|
|
55
|
-
|
|
56
|
-
-
|
|
57
|
-
-
|
|
58
|
-
- If table format unclear: ask "Please specify table as library.tablename (e.g., Public.cars)"
|
|
59
|
-
- If ambiguous calculation: ask for clarification on what to aggregate or filter
|
|
26
|
+
EXAMPLES
|
|
27
|
+
- "how many cars by make in sashelp.cars" → { table: "sashelp.cars", query: "how many cars by make", sql: "SELECT make, COUNT(*) FROM sashelp.cars GROUP BY make" }
|
|
28
|
+
- "total sales by region from mylib.sales" → { table: "mylib.sales", query: "total sales by region", sql: "SELECT region, SUM(amount) FROM mylib.sales GROUP BY region" }
|
|
60
29
|
|
|
61
|
-
|
|
62
|
-
- "
|
|
63
|
-
- "
|
|
64
|
-
- "
|
|
65
|
-
- "
|
|
30
|
+
NEGATIVE EXAMPLES (do not route here)
|
|
31
|
+
- "read table cars" (use read-table)
|
|
32
|
+
- "show 10 rows" (use read-table)
|
|
33
|
+
- "table structure" (use table-info)
|
|
34
|
+
- "run SAS code" (use run-sas-program)
|
|
35
|
+
- "run job/macro" (use run-job/run-macro)
|
|
66
36
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
- "what columns are in the sales table?" (use table-info instead)
|
|
71
|
-
- "run this SAS code: proc sql; select * from..." (use run-sas-program instead)
|
|
72
|
-
- "execute job monthly_report" (use run-job instead)
|
|
73
|
-
- "run macro summarize_data" (use run-macro instead)
|
|
74
|
-
|
|
75
|
-
Usage Tips
|
|
76
|
-
- Ensure table is specified in lib.tablename format
|
|
77
|
-
- Be specific in natural language queries for better SQL generation
|
|
78
|
-
- Use table-info first to understand column names and types
|
|
79
|
-
- For simple reads without filtering/aggregation, prefer read-table
|
|
80
|
-
|
|
81
|
-
Related Tools
|
|
82
|
-
- read-table — for simple data reading without SQL queries
|
|
83
|
-
- table-info — to inspect table schema before querying
|
|
84
|
-
- run-sas-program — for executing pre-written SAS/SQL code
|
|
85
|
-
- find-table — to verify table exists before querying
|
|
86
|
-
`;
|
|
37
|
+
ERRORS
|
|
38
|
+
Returns rows array, columns metadata, log. Returns error if SQL invalid or table not found.
|
|
39
|
+
`;
|
|
87
40
|
|
|
88
41
|
|
|
89
42
|
let spec = {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
schema: {
|
|
43
|
+
name: 'sas-query',
|
|
44
|
+
description: description,
|
|
45
|
+
inputSchema: z.object({
|
|
94
46
|
query: z.string(),
|
|
95
47
|
table: z.string(),
|
|
96
|
-
sql: z.string()
|
|
97
|
-
job: z.string()
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
handler: async (params) => {
|
|
48
|
+
sql: z.string(),
|
|
49
|
+
job: z.string()
|
|
50
|
+
}),
|
|
51
|
+
handler: async (params) => {
|
|
101
52
|
let {table,query, sql, job, _appContext} = params;
|
|
102
53
|
let sqlinput = (sql == null) ? ' ' : sql.replaceAll(';', ' ').replaceAll('\n', ' ').replaceAll('\r', ' ');
|
|
103
54
|
|
|
@@ -124,3 +75,4 @@ Related Tools
|
|
|
124
75
|
return spec;
|
|
125
76
|
}
|
|
126
77
|
export default sasQuery;
|
|
78
|
+
|
|
@@ -108,13 +108,12 @@ async function sasQueryTemplate(uparams) {
|
|
|
108
108
|
name: toolname,
|
|
109
109
|
description: description,
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
inputSchema: z.object({
|
|
112
112
|
query: z.string(),
|
|
113
113
|
table: z.string().default(uTable),
|
|
114
|
-
sql: z.string()
|
|
115
|
-
},
|
|
116
|
-
|
|
117
|
-
handler: async (params) => {
|
|
114
|
+
sql: z.string()
|
|
115
|
+
}),
|
|
116
|
+
handler: async (params) => {
|
|
118
117
|
|
|
119
118
|
|
|
120
119
|
let { table, query, sql, _appContext} = params;
|
|
@@ -102,14 +102,13 @@ async function sasQueryTemplate2(uparams) {
|
|
|
102
102
|
name: toolname,
|
|
103
103
|
description: description,
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
inputSchema: z.object({
|
|
106
106
|
query: z.string(),
|
|
107
107
|
table: z.string().default(uTable),
|
|
108
|
-
sql: z.string()
|
|
108
|
+
sql: z.string(),
|
|
109
109
|
|
|
110
|
-
},
|
|
111
|
-
|
|
112
|
-
handler: async (params) => {
|
|
110
|
+
}),
|
|
111
|
+
handler: async (params) => {
|
|
113
112
|
|
|
114
113
|
let { table, query, sql } = params;
|
|
115
114
|
let sqlinput = (sql == null) ? ' ' : sql.replaceAll(';', ' ').replaceAll('\n', ' ').replaceAll('\r', ' ');
|
package/src/toolSet/scrInfo.js
CHANGED
|
@@ -15,7 +15,7 @@ Purpose
|
|
|
15
15
|
Return the input/output schema and metadata for an SCR (Score Code Runtime) model.
|
|
16
16
|
|
|
17
17
|
Inputs
|
|
18
|
-
-
|
|
18
|
+
- url (string): The SCR model identifier.
|
|
19
19
|
What it returns
|
|
20
20
|
- A JSON object describing the model's interface, typically including:
|
|
21
21
|
- Input variables (names, types, required/optional)
|
|
@@ -23,7 +23,6 @@ What it returns
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
Usage notes
|
|
26
|
-
- If no local mapping exists and \`name\` looks like a URL, the tool will attempt to fetch the schema from that URL.
|
|
27
26
|
- Ensure network connectivity and credentials for the remote SCR service when needed.
|
|
28
27
|
- Use scr-score to score data after inspecting the schema.
|
|
29
28
|
|
|
@@ -34,12 +33,10 @@ Examples
|
|
|
34
33
|
|
|
35
34
|
let spec = {
|
|
36
35
|
name: 'scr-info',
|
|
37
|
-
aliases: ['scrInfo','scr info','scr_info'],
|
|
38
36
|
description: description,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
},
|
|
42
|
-
required: ['name'],
|
|
37
|
+
inputSchema: z.object({
|
|
38
|
+
url: z.string(),
|
|
39
|
+
}),
|
|
43
40
|
handler: async (params) => {
|
|
44
41
|
let {url, _appContext} = params;
|
|
45
42
|
if (url === null) {
|
package/src/toolSet/scrScore.js
CHANGED
|
@@ -36,13 +36,11 @@ Examples
|
|
|
36
36
|
|
|
37
37
|
let spec = {
|
|
38
38
|
name: 'scr-score',
|
|
39
|
-
aliases: ['scrScore','scr score','scr_score'],
|
|
40
39
|
description: description,
|
|
41
|
-
|
|
40
|
+
inputSchema: z.object({
|
|
42
41
|
url: z.string(),
|
|
43
42
|
scenario: z.any()
|
|
44
|
-
},
|
|
45
|
-
required: ['url'],
|
|
43
|
+
}),
|
|
46
44
|
handler: async (params) => {
|
|
47
45
|
let {url, scenario,_appContext} = params;
|
|
48
46
|
|
|
@@ -30,16 +30,15 @@ function searchAssets(_appContext) {
|
|
|
30
30
|
`;
|
|
31
31
|
|
|
32
32
|
let specs = {
|
|
33
|
-
name: '
|
|
33
|
+
name: 'search-assets',
|
|
34
34
|
description: description,
|
|
35
|
-
|
|
35
|
+
inputSchema: z.object({
|
|
36
36
|
searchstring: z.string(),
|
|
37
37
|
assetType: z.string(),
|
|
38
|
-
start: z.number()
|
|
39
|
-
limit: z.number()
|
|
38
|
+
start: z.number(),
|
|
39
|
+
limit: z.number()
|
|
40
40
|
|
|
41
|
-
},
|
|
42
|
-
required: ['assetType'],
|
|
41
|
+
}),
|
|
43
42
|
handler: async (params) => {
|
|
44
43
|
log('searchAssets params', params);
|
|
45
44
|
return await _catalogSearch(params, 'search');
|
|
@@ -7,71 +7,43 @@ import {z} from 'zod';
|
|
|
7
7
|
|
|
8
8
|
function setContext(_appContext) {
|
|
9
9
|
let description = `
|
|
10
|
-
|
|
10
|
+
set-context — set the CAS and SAS server contexts for subsequent tool calls.
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
- User wants to switch to a different CAS server: "Use the finance-cas-server"
|
|
15
|
-
- User wants to change the compute context: "Switch to 'SAS Studio Compute Context'"
|
|
16
|
-
- User wants to check current context: "What context am I using?"
|
|
17
|
-
- User wants to set both: "Use finance-cas-server for CAS and my-compute for SAS"
|
|
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)
|
|
18
14
|
|
|
19
|
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
- Running programs or queries (use run-sas-program or sas-query)
|
|
23
|
-
- Listing available servers or contexts (no tool for this; would require backend support)
|
|
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'
|
|
24
18
|
|
|
25
|
-
|
|
26
|
-
|
|
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)
|
|
27
24
|
|
|
28
|
-
|
|
29
|
-
- cas
|
|
30
|
-
-
|
|
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" → { }
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
- If no parameters provided, returns the current context values
|
|
37
|
-
- If parameters provided, updates and returns the new context values
|
|
38
|
-
- On error: error message if context cannot be set (e.g., invalid server name)
|
|
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)
|
|
39
34
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
- If user says "reset context": ask "Should I reset the CAS context, SAS context, or both?"
|
|
44
|
-
- If user only says "context": ask "Would you like to check the current context or set a new one?"
|
|
45
|
-
|
|
46
|
-
Examples (→ mapped params)
|
|
47
|
-
- "Use the finance-cas-server" → { cas: "finance-cas-server" }
|
|
48
|
-
- "Switch to SAS Studio Compute Context" → { sas: "SAS Studio Compute Context" }
|
|
49
|
-
- "Set CAS to prod-cas and SAS to batch-compute" → { cas: "prod-cas", sas: "batch-compute" }
|
|
50
|
-
- "What's my current context?" → { } (no parameters returns current context)
|
|
51
|
-
- "Show me the active CAS server" → { } (no parameters returns current context)
|
|
52
|
-
|
|
53
|
-
Negative Examples (should NOT call set-context)
|
|
54
|
-
- "Read 10 rows from the customers table" (use read-table instead)
|
|
55
|
-
- "What's the value of myVariable?" (use get-env instead)
|
|
56
|
-
- "Run this SAS program" (use run-sas-program instead)
|
|
57
|
-
|
|
58
|
-
Related Tools
|
|
59
|
-
- get-env — to retrieve individual environment variable values
|
|
60
|
-
- read-table — to read data using the current context
|
|
61
|
-
- run-sas-program — to execute SAS programs in the current context
|
|
62
|
-
- sas-query — to execute SQL queries in the current context
|
|
63
|
-
`;
|
|
35
|
+
ERRORS
|
|
36
|
+
Returns current or updated context values {cas, sas}. Error if server not found or invalid name.
|
|
37
|
+
`;
|
|
64
38
|
|
|
65
39
|
let spec = {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
handler: async (params) => {
|
|
40
|
+
name: 'set-context',
|
|
41
|
+
description: description,
|
|
42
|
+
inputSchema: z.object({
|
|
43
|
+
cas: z.string(),
|
|
44
|
+
sas: z.string()
|
|
45
|
+
}),
|
|
46
|
+
handler: async (params) => {
|
|
75
47
|
|
|
76
48
|
let {cas, sas} = params;
|
|
77
49
|
if (typeof cas === 'string' && cas.trim().length > 0) {
|
|
@@ -90,3 +62,4 @@ Related Tools
|
|
|
90
62
|
return spec;
|
|
91
63
|
}
|
|
92
64
|
export default setContext;
|
|
65
|
+
|
package/src/toolSet/superstat.js
CHANGED
|
@@ -33,11 +33,10 @@ function superstat(_appContext) {
|
|
|
33
33
|
let spec = {
|
|
34
34
|
name: 'superstat',
|
|
35
35
|
description: desc,
|
|
36
|
-
|
|
36
|
+
inputSchema: z.object({
|
|
37
37
|
a: z.number(),
|
|
38
38
|
b: z.number()
|
|
39
|
-
},
|
|
40
|
-
required: ['a', 'b'],
|
|
39
|
+
}),
|
|
41
40
|
handler: async (params) => {
|
|
42
41
|
let src = `
|
|
43
42
|
ods html style=barrettsblue;
|