@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.
Files changed (45) hide show
  1. package/cli.js +118 -3
  2. package/openApi.yaml +121 -121
  3. package/package.json +4 -5
  4. package/skills/mcp-tool-description-optimizer/SKILL.md +129 -0
  5. package/skills/mcp-tool-description-optimizer/references/examples.md +123 -0
  6. package/skills/sas-read-and-score/SKILL.md +91 -0
  7. package/skills/sas-read-strategy/SKILL.md +143 -0
  8. package/skills/sas-score-workflow/SKILL.md +283 -0
  9. package/src/createMcpServer.js +11 -4
  10. package/src/expressMcpServer.js +1 -1
  11. package/src/handleGetDelete.js +1 -1
  12. package/src/openApi.yaml +121 -121
  13. package/src/toolHelpers/_jobSubmit.js +2 -0
  14. package/src/toolHelpers/_listLibrary.js +56 -39
  15. package/src/toolHelpers/readCerts.js +4 -4
  16. package/src/toolSet/devaScore.js +31 -44
  17. package/src/toolSet/findJob.js +37 -70
  18. package/src/toolSet/findJobdef.js +27 -58
  19. package/src/toolSet/findLibrary.js +29 -62
  20. package/src/toolSet/findModel.js +34 -57
  21. package/src/toolSet/findTable.js +29 -59
  22. package/src/toolSet/getEnv.js +26 -45
  23. package/src/toolSet/listJobdefs.js +30 -65
  24. package/src/toolSet/listJobs.js +30 -79
  25. package/src/toolSet/listLibraries.js +43 -55
  26. package/src/toolSet/listModels.js +25 -52
  27. package/src/toolSet/listTables.js +36 -66
  28. package/src/toolSet/makeTools.js +1 -0
  29. package/src/toolSet/modelInfo.js +21 -53
  30. package/src/toolSet/modelScore.js +30 -73
  31. package/src/toolSet/readTable.js +33 -72
  32. package/src/toolSet/runCasProgram.js +30 -51
  33. package/src/toolSet/runJob.js +24 -24
  34. package/src/toolSet/runJobdef.js +26 -29
  35. package/src/toolSet/runMacro.js +23 -24
  36. package/src/toolSet/runProgram.js +32 -80
  37. package/src/toolSet/sasQuery.js +31 -79
  38. package/src/toolSet/sasQueryTemplate.js +4 -5
  39. package/src/toolSet/sasQueryTemplate2.js +4 -5
  40. package/src/toolSet/scrInfo.js +4 -7
  41. package/src/toolSet/scrScore.js +2 -4
  42. package/src/toolSet/searchAssets.js +5 -6
  43. package/src/toolSet/setContext.js +30 -57
  44. package/src/toolSet/superstat.js +2 -3
  45. package/src/toolSet/tableInfo.js +32 -77
@@ -15,76 +15,44 @@ function findJobdef(_appContext) {
15
15
  "behavior": "Return only JSON matching response_schema when invoked by an LLM. If no matches, return { jobs: [] }"
16
16
  };
17
17
  let description = `
18
- ## find-jobdef — locate a specific SAS Viya job
18
+ find-jobdef — locate a specific SAS Viya job definition.
19
19
 
20
- LLM Invocation Guidance
21
- Use THIS tool when the user intent is to check if ONE job exists or retrieve its metadata:
22
- - "find jobdef cars_job_v4"
23
- - "does jobdef sales_summary exist"
24
- - "is there a jobdef named churnScorer"
25
- - "lookup jobdef forecast_monthly"
26
- - "verify jobdef ETL_Daily"
20
+ USE when: find jobdef, does jobdef exist, is there a jobdef named, lookup jobdef, verify jobdef exists
21
+ DO NOT USE for: list jobdefs (use list-jobdefs), run jobdef (use run-jobdef), find job/lib/table/model (use respective tools)
27
22
 
28
- Do NOT use this tool when the user asks for:
29
- - find job (use find-job)
30
- - find table (use find-table
31
- - find model (use find-model)
32
- - find lib (use find-library)
33
- - Executing a job (use job)
34
- - Running a job definition (use jobdef)
35
- - Submitting arbitrary code (use program)
23
+ PARAMETERS
24
+ - name: string (required) — jobdef name to locate; if multiple supplied, use first
36
25
 
37
- Purpose
38
- Quickly determine whether a named jobdef asset is present in the Viya environment and return its entry (or an empty result if not found).
26
+ ROUTING RULES
27
+ - "find jobdef <name>" { name: "<name>" }
28
+ - "does jobdef <name> exist" → { name: "<name>" }
29
+ - "is there a jobdef named <name>" → { name: "<name>" }
30
+ - "lookup/verify jobdef <name>" → { name: "<name>" }
31
+ - "find jobdef" with no name → ask "Which jobdef name would you like to find?"
32
+ - "find all jobdefs / list jobdefs" → use list-jobdefs instead
33
+ - "run jobdef <name>" → use run-jobdef instead
39
34
 
40
- Parameters
41
- - name (string, required): Exact jobdef name (case preserved). If multiple tokens/names supplied, take the first and ignore the rest; optionally ask for a single name.
35
+ EXAMPLES
36
+ - "find jobdef cars_job_v4" { name: "cars_job_v4" }
37
+ - "does jobdef ETL exist" → { name: "ETL" }
38
+ - "is there a jobdef named metricsRefresh" → { name: "metricsRefresh" }
42
39
 
43
- Behavior & Matching
44
- - Attempt exact match first (backend determines sensitivity).
45
- - Returns { jobdefs: [...] } where array length is 0 (not found) or 1+ (if backend returns multiple with the same display name).
46
- - No fuzzy guesses—never fabricate a job.
47
- - If no name provided: ask "Which jobdef name would you like to find?".
40
+ NEGATIVE EXAMPLES (do not route here)
41
+ - "list jobdefs" (use list-jobdefs)
42
+ - "run jobdef cars_job_v4" (use run-jobdef)
43
+ - "find job ETL" (use find-job)
44
+ - "find table cars" (use find-table)
48
45
 
49
- Response Contract
50
- - Always: { jobdefs: Array<string|object> }
51
- - On error: propagate structured server error (do not wrap in prose when invoked programmatically).
52
-
53
- Disambiguation Rules
54
- - Input only "find job" → ask for missing name.
55
- - Input contains verbs like "run" or "execute" → use run-job or run-jobdef instead.
56
- - Input requesting many (e.g., "find all jobs") → use list-jobs.
57
-
58
- Examples (→ mapped params)
59
- - "find jobdef cars_job_v4" → { name: "cars_job_v4" }
60
- - "does jobdef ETL exist" → { name: "ETL" }
61
- - "is there a jobdef named metricsRefresh" → { name: "metricsRefresh" }
62
-
63
- Negative Examples (should NOT call find-jobdef)
64
- - find lib (use find-library)
65
- - find table (use find-table)
66
- - find model (use find-model)
67
- - "list job" (list-jobdefs)
68
- - "run job cars_job_v4" (run-job)
69
- - "execute jobdef cars_job_v4" (run-jobdef)
70
-
71
- Clarifying Question Template
72
- - Missing name: "Which jobdef name would you like to find?"
73
- - Multiple names: "Please provide just one jobdef name (e.g. 'cars_job_v4')."
74
-
75
- Notes
76
- - For bulk existence checks loop over names and call find-jobdef per name.
77
- - Combine with run-jobdef tool if user wants to execute after confirming existence.
46
+ ERRORS
47
+ Returns { jobdefs: [] } if not found; { jobdefs: [name, ...] } if found. Never hallucinate jobdef names.
78
48
  `;
79
49
 
80
50
  let spec = {
81
51
  name: 'find-jobdef',
82
- aliases: ['findJobdef','find jobdef','find_jobdef'],
83
52
  description: description,
84
- schema: {
53
+ inputSchema: z.object({
85
54
  name: z.string()
86
- },
87
- required: ['name'],
55
+ }),
88
56
  handler: async (params) => {
89
57
  let r = await _listJobdefs(params);
90
58
  return r;
@@ -93,3 +61,4 @@ function findJobdef(_appContext) {
93
61
  return spec;
94
62
  }
95
63
  export default findJobdef;
64
+
@@ -7,80 +7,46 @@ import _listLibrary from '../toolHelpers/_listLibrary.js';
7
7
  function findLibrary(_appContext) {
8
8
 
9
9
  let description = `
10
- ## find-library — locate a specific CAS or SAS library
10
+ find-library — locate a specific CAS or SAS library.
11
11
 
12
- LLM Invocation Guidance
13
- Use THIS tool when the user asks any of the following (intent = existence / lookup of ONE library):
14
- - "find library Public"
15
- - "find lib Public"
16
- - "does library SASHELP exist"
17
- - "is PUBLIC library available in cas"
18
- - "lookup library sasuser in sas"
19
- - "show me library metadata for Models"
12
+ USE when: find library, find lib, does library exist, is library available, lookup library
13
+ DO NOT USE for: list libraries (use list-libraries), find table/job/jobdef/model (use respective tools), table structure (use table-info), create library (use run-sas-program)
20
14
 
21
- Aliases for lib are: library, caslib, libref
22
-
23
- Do NOT use this tool when the user wants:
24
- - find model -> use find-model
25
- - find table -> use find-table
26
- - find job -> use find-job
27
- - find jobdef -> use find-jobdef
28
- - Columns or schema of a table (use table-info)
29
- - Creating/assigning libraries (use run-sas-program or another admin tool)
30
-
31
- Purpose
32
- Quickly verify whether a single named library exists on CAS or SAS and return its entry (or empty if not found).
33
-
34
- Parameters
35
- - name (string, required) : Exact library (caslib) name to locate. If multiple names provided (comma/space separated), use the first and ignore the rest; optionally ask for one name.
36
- - server (cas|sas, default 'cas') : Target environment. If omitted or ambiguous default to 'cas'.
37
-
38
- Behavior & Matching
39
- - Performs an exact name match (case-insensitive where backend supports it).
40
- - Returns an object: { libraries: [...] } where the array contains zero or one items (backend may still return richer metadata).
41
- - If no match: { libraries: [] } (do NOT fabricate suggestions).
42
- - If user supplies no name: ask a clarifying question: "Which library name would you like to find?".
43
- - If user clearly wants a list ("list", "show all", "enumerate") route to listLibrary instead.
15
+ PARAMETERS
16
+ - name: string (required) — library/caslib name; if multiple supplied, use first
17
+ - server: 'cas' | 'sas' (default: 'cas') target environment
44
18
 
45
- Response Contract
46
- - Always: { libraries: Array<string|object> }
47
- - Never include prose when invoked programmatically; only the JSON structure.
19
+ ROUTING RULES
20
+ - "find lib <name>" → { name: "<name>", server: "cas" }
21
+ - "find lib <name> in cas" { name: "<name>", server: "cas" }
22
+ - "find library <name> in sas" → { name: "<name>", server: "sas" }
23
+ - "does library <name> exist" → { name: "<name>", server: "cas" }
24
+ - "find lib" with no name → ask "Which library name would you like to find?"
25
+ - "list libraries / list libs" → use list-libraries instead
26
+ - "tables in <lib>" → use list-tables instead
48
27
 
49
- Disambiguation Rules
50
- - Input only "find library" → ask for the missing name.
51
- - Input with both library name and words like "tables" prefer listTables.
52
- - Input like "find libraries" (plural) prefer listLibrary unless user clarifies to a single name.
28
+ EXAMPLES
29
+ - "find lib Public" → { name: "Public", server: "cas" }
30
+ - "find library sasuser in sas" { name: "sasuser", server: "sas" }
31
+ - "does library Formats exist" → { name: "Formats", server: "cas" }
53
32
 
54
- Examples ( mapped params)
55
- - "find lib Public" { name: "Public", server: "cas" }
56
- - "find library sasuser in sas" { name: "sasuser", server: "sas" }
57
- - "does library Formats exist" → { name: "Formats", server: "cas" }
58
- - "is SystemData library in cas" { name: "SystemData", server: "cas" }
33
+ NEGATIVE EXAMPLES (do not route here)
34
+ - "list libs" (use list-libraries)
35
+ - "show tables in Public" (use list-tables)
36
+ - "find table cars in sashelp" (use find-table)
37
+ - "find job cars_job" (use find-job)
59
38
 
60
- Negative Examples (should NOT call find-library)
61
- - "list libs" (list-libraries)
62
- - Do not use this tool if the user want to find table, find job, find model, find job, find jobdef and similar requests
63
- - "show tables in Public" (list-tables)
64
- - "describe table cars in sashelp" (table-info)
65
-
66
- Clarifying Question Template
67
- - Missing name: "Which library name would you like to find?"
68
- - Multiple names: "Please provide just one library name to look up (e.g. 'Public')."
69
-
70
- Notes
71
- - For bulk validation of many names, call this tool repeatedly per name.
72
- - For pagination or discovery, switch to list-libraries.
39
+ ERRORS
40
+ Returns { libraries: [] } if not found; { libraries: [name, ...] } if found. Never hallucinate library names.
73
41
  `;
74
42
 
75
43
  let spec = {
76
44
  name: 'find-library',
77
- aliases: ['findLibrary','find library','find_library'],
78
45
  description: description,
79
- schema: {
46
+ inputSchema: z.object({
80
47
  name: z.string(),
81
- server: z.string().default('cas')
82
- },
83
- required: ['name'],
48
+ server: z.string()
49
+ }),
84
50
  handler: async (params) => {
85
51
  // normalize server to lowercase & default
86
52
  if (!params.server) params.server = 'cas';
@@ -98,3 +64,4 @@ function findLibrary(_appContext) {
98
64
  return spec;
99
65
  }
100
66
  export default findLibrary;
67
+
@@ -9,69 +9,45 @@ import _listModels from '../toolHelpers/_listModels.js';
9
9
 
10
10
  function findModel(_appContext) {
11
11
  let description = `
12
- ## find-model — locate a specific model deployed to MAS (Model Publish / Scoring service)
13
-
14
- LLM Invocation Guidance (When to use)
15
- Use THIS tool when the user wants to know whether ONE model exists or is deployed:
16
- - "find model cancerRisk"
17
- - "does model churn_tree exist"
18
- - "is model sales_forecast deployed"
19
- - "lookup model claimFraud"
20
- - "verify model credit_score_v2 exists"
21
-
22
- Do NOT use this tool for:
23
- - Listing many / browsing models (use list-models)
24
- - Retrieving detailed input/output variable metadata (use model-info)
25
- - Scoring or running a model (use model-score)
26
- - Searching model execution containers or SCR endpoints (use scr-info / scr-score if appropriate)
27
- - Finding a table (use find-table)
28
- - Finding a library (use find-library)
29
- - Finding a job or jobdef (use find-job / find-jobdef)
30
-
31
- Purpose
32
- Quick existence / lookup check for a MAS‑published model. Returns a list with zero or more matches (typically 0 or 1 for an exact name).
33
-
34
- Parameters
35
- - name (string, required): Exact model name. If user supplies phrases like "model named X" extract X. If multiple names are given (comma or space separated), prefer the first and (optionally) ask for a single name.
36
-
37
- Matching Rules
38
- - Attempt exact match first. If backend supports partial search, a substring match MAY return multiple models; preserve order.
39
- - Do not fabricate models. Empty array means not found.
40
-
41
- Response Contract
42
- - Always: { models: Array<object|string> }
43
- - Never return prose when invoked programmatically; only the JSON structure.
44
- - On error: surface backend error object directly (no rewriting) so the caller can display/log it.
45
-
46
- Disambiguation & Clarification
47
- - Missing name (e.g., "find model") → ask: "Which model name would you like to find?"
48
- - Plural intent (e.g., "find models" / "list models") → use list-models instead.
49
- - If user requests scoring ("score model X") → route to model-score not find-model.
50
-
51
- Examples (→ mapped params)
52
- - "find model myModel" → { name: "myModel" }
53
- - "does model churn_score exist" → { name: "churn_score" }
54
- - "is model riskModel deployed" → { name: "riskModel" }
55
- - "lookup model claims_fraud_v1" → { name: "claims_fraud_v1" }
56
-
57
- Negative Examples (should NOT call find-model)
58
- - "list models" (list-models)
59
- - "score model myModel" (model-score)
60
- - "describe model myModel" (model-info)
61
-
62
- Notes
63
- - Chain usage: find-model → model-info → model-score.
64
- - For batch existence checks iterate over a list and call find-model per entry.
12
+ find-model — locate a specific model deployed to MAS (Model Aggregation Service).
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.
65
43
  `;
66
44
 
67
45
  let spec = {
68
46
  name: 'find-model',
69
- aliases: ['findModel','find model','find_model'],
70
47
  description: description,
71
- schema: {
48
+ inputSchema: z.object({
72
49
  'name': z.string()
73
- },
74
- required: ['name'],
50
+ }),
75
51
  handler: async (params) => {
76
52
  let r = await _listModels(params);
77
53
  return r;
@@ -81,3 +57,4 @@ function findModel(_appContext) {
81
57
  }
82
58
 
83
59
  export default findModel;
60
+
@@ -9,79 +9,48 @@ import _listTables from '../toolHelpers/_listTables.js';
9
9
 
10
10
  function findTable(_appContext) {
11
11
  let description = `
12
- ## find-table — locate a specific table in a CAS or SAS library
12
+ find-table — locate a specific table in a CAS or SAS library.
13
13
 
14
- LLM Invocation Guidance (When to use)
15
- Use THIS tool when the user wants to find or verify a table in a specific library:
16
- - "find table iris in Public library in cas"
17
- - "find table cars in sashelp in sas server"
18
- - "does table customers exist in mylib?"
19
- - "is there a table named sales in the Samples library?"
20
- - "verify table orders exists in Public"
14
+ USE when: find table, does table exist, is table in library, verify table exists, locate table
15
+ DO NOT USE for: list tables (use list-tables), table schema/columns (use table-info), read table data (use read-table), find lib/job/model (use respective tools)
21
16
 
22
- Do NOT use this tool when the user wants:
23
- - find lib -> use find-library
24
- - find model -> use find-model
25
- - find job -> use find-job
26
- - find jobdef -> use find-jobdef
27
- - Columns or schema of a table (use table-info)
28
- - Reading data from a table (use read-table)
29
- - Listing all tables in a library (use list-tables)
17
+ PARAMETERS
18
+ - lib: string (required) library name (e.g., 'Public', 'sashelp')
19
+ - name: string (required) table name to locate
20
+ - server: 'cas' | 'sas' (default: 'cas') — target environment
30
21
 
31
- Purpose
32
- Locate a table contained in a specified library (caslib or libref) on a CAS or SAS server. Returns matching table names or empty array if not found.
22
+ ROUTING RULES
23
+ - "find table <name> in <lib>" { lib: "<lib>", name: "<name>", server: "cas" }
24
+ - "find table <name> in <lib> in sas" → { lib: "<lib>", name: "<name>", server: "sas" }
25
+ - "does table <name> exist in <lib>" → { lib: "<lib>", name: "<name>", server: "cas" }
26
+ - "find table" with missing lib → ask "Which library contains the table?"
27
+ - "find table" with missing name → ask "Which table name would you like to find?"
28
+ - "list tables in <lib>" → use list-tables instead
33
29
 
34
- Parameters
35
- - lib (string, required): The library to search in (e.g., 'Public', 'sashelp', or a caslib name)
36
- - name (string, required): Table name or substring to search for. Matching is case-insensitive.
37
- - server (string, default 'cas'): Either 'cas' or 'sas'. Defaults to 'cas' when omitted.
38
-
39
- Response Contract
40
- Returns a JSON object with:
41
- - tables: Array of matching table names (strings)
42
- - Empty array { tables: [] } when no matches found
43
- - Do not fabricate table names; only return actual matches
44
-
45
- Disambiguation & Clarification
46
- - Missing library: ask "Which library do you want to search in?"
47
- - Missing table name: ask "Which table name would you like to find?"
48
- - Server ambiguous: ask "Do you mean CAS or SAS?"
49
- - If user wants multiple tables: suggest "Use list-tables to see all tables in a library"
50
-
51
- Examples (→ mapped params)
52
- - "find table iris in Public library in cas" → { lib: "Public", name: "iris", server: "cas" }
53
- - "find table cars in sashelp in sas server" → { lib: "sashelp", name: "cars", server: "sas" }
30
+ EXAMPLES
31
+ - "find table iris in Public" { lib: "Public", name: "iris", server: "cas" }
32
+ - "find table cars in sashelp in sas" { lib: "sashelp", name: "cars", server: "sas" }
54
33
  - "does customers exist in mylib" → { lib: "mylib", name: "customers", server: "cas" }
55
34
  - "verify table orders in Samples" → { lib: "Samples", name: "orders", server: "cas" }
56
35
 
57
- Negative Examples (should NOT call find-table)
58
- - "list tables in Public" (use list-tables instead)
59
- - "find library Public" (use find-library instead)
60
- - "what columns in cars table?" (use table-info instead)
61
- - "read data from customers" (use read-table instead)
36
+ NEGATIVE EXAMPLES (do not route here)
37
+ - "list tables in Public" (use list-tables)
38
+ - "find library Public" (use find-library)
39
+ - "what columns in cars?" (use table-info)
40
+ - "read data from customers" (use read-table)
62
41
 
63
- Usage Tips
64
- - Use this tool to verify table existence before reading or querying
65
- - For discovery of multiple tables, use list-tables instead
66
- - After finding a table, use table-info for schema or read-table for data
67
-
68
- Related Tools
69
- - find-table → table-info → read-table (typical workflow)
70
- - list-tables — to discover all tables in a library
71
- - find-library — to verify library exists
72
- - table-info — to inspect table structure after finding it
73
- `;
42
+ ERRORS
43
+ Returns { tables: [] } if not found; { tables: [name, ...] } if found. Never hallucinate table names.
44
+ `;
74
45
 
75
46
  let spec = {
76
47
  name: 'find-table',
77
- aliases: ['findTable','find table','find_table'],
78
48
  description: description,
79
- schema: {
80
- server: z.string().default('cas'), // default server is 'cas',
49
+ inputSchema: z.object({
50
+ server: z.string(), // default server is 'cas',
81
51
  name: z.string(),
82
52
  lib: z.string()
83
- },
84
- required: ['name', 'lib'],
53
+ }),
85
54
  handler: async (params) => {
86
55
  // Check if the params.scenario is a string and parse it
87
56
  let r = await _listTables(params);
@@ -92,3 +61,4 @@ Related Tools
92
61
  }
93
62
 
94
63
  export default findTable;
64
+
@@ -7,66 +7,47 @@ import {z} from 'zod';
7
7
  import _getEnv from '../toolHelpers/_getEnv.js';
8
8
  function getEnv(_appContext) {
9
9
  let description = `
10
- ## get-env — retrieve a variable value from the runtime environment
10
+ get-env — retrieve a variable value from the runtime environment.
11
11
 
12
- LLM Invocation Guidance (When to use)
13
- Use THIS tool when:
14
- - The user wants to access a specific environment variable or context value
15
- - "What is the value of [variable name]?"
16
- - "Get me the [variable] value"
17
- - "Show the current [variable]"
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 read-table), model info (use model-info), find/run job (use find-job/run-job), set context (use set-context)
18
14
 
19
- Do NOT use this tool for:
20
- - Retrieving table data (use read-table)
21
- - Getting model information (use model-info)
22
- - Looking up job status (use find-job or run-job)
23
- - Setting environment variables (use set-context to set CAS/SAS contexts)
15
+ PARAMETERS
16
+ - name: string (required) — variable name to retrieve (case-sensitive)
24
17
 
25
- Purpose
26
- Retrieve the current value of a named variable from the runtime environment. This is useful for debugging, accessing context information, or verifying current configuration values.
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 set-context instead (no params)
24
+ - "set <var> to <value>" → use set-context or run-sas-program instead
27
25
 
28
- Parameters
29
- - name (string, required): The name of the variable to retrieve. Variable names are case-sensitive.
30
-
31
- Response Contract
32
- Returns a JSON object containing:
33
- - The requested variable name as a key
34
- - The current value of that variable
35
- - If the variable does not exist, returns null or an error message
36
-
37
- Disambiguation & Clarification
38
- - If variable name is missing: ask "Which variable would you like to retrieve?"
39
- - If user says "context" without specifying which variable: clarify "Do you mean the CAS context, SAS context, or a specific variable?"
40
- - Multiple variable request: handle one at a time or ask for clarification
41
-
42
- Examples (→ mapped params)
26
+ EXAMPLES
43
27
  - "What's the value of myVar" → { name: "myVar" }
44
28
  - "Get me the configuration variable" → { name: "configuration" }
45
29
  - "Show the current server setting" → { name: "server" }
46
30
 
47
- Negative Examples (should NOT call get-env)
48
- - "Read all rows from the customers table" (use read-table instead)
49
- - "Get model details for myModel" (use model-info instead)
50
- - "Set the CAS server to finance-prod" (use set-context instead)
31
+ NEGATIVE EXAMPLES (do not route here)
32
+ - "Read rows from customers" (use read-table)
33
+ - "Get model details for myModel" (use model-info)
34
+ - "Set the CAS server to finance-prod" (use set-context)
51
35
 
52
- Related Tools
53
- - setContext to set environment context values (CAS and SAS servers)
54
- - readTable — to retrieve table data
55
- - modelInfo — to retrieve model metadata
56
- `;
36
+ ERRORS
37
+ Returns variable name with current value, or null if not found. Return structured error with message field.
38
+ `;
57
39
 
58
40
  let spec = {
59
- name: 'get-env',
60
- aliases: ['get-env','get env','get environment'],
61
- description: description,
62
- schema: {
41
+ name: 'get-env',
42
+ description: description,
43
+ inputSchema: z.object({
63
44
  name: z.string()
64
- },
65
-
66
- handler: async (params) => {
45
+ }),
46
+ handler: async (params) => {
67
47
  return await _getEnv(params);
68
48
  }
69
49
  }
70
50
  return spec;
71
51
  }
72
52
  export default getEnv;
53
+