Skip to main content
Glama
sassoftware

SAS MCP Server

Official
by sassoftware

execute_sas_code

Execute SAS code in Viya, retrieve results with logs and output, and persist state across calls via a reusable compute session.

Instructions

Executes the provided SAS code in the Viya environment and returns information about the completed Job. This will create a job definition for the SAS code, execute it, and then retrieve the results.

IMPORTANT — state persists between calls: the code runs in a reusable compute session that is kept warm and shared across calls (per user), so SAS state — WORK tables, macro variables, and assigned librefs — survives between successive execute_sas_code calls. A re-run can therefore see leftovers from earlier calls (e.g. a check that counts results twice). Pass fresh_session=True (or call reset_compute_session) when the code must start from a clean slate.

Tip: to reach CAS data, prefer libname casuser cas; (or a targeted caslib statement) over caslib _all_ assign; — on tenants with many caslibs the latter floods the log with assignment NOTEs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sas_codeYesthe SAS code snippet to be executed using the Viya Job Execution API Service
fresh_sessionNoWhen True, discard any cached compute session first so the code runs with no inherited SAS state (equivalent to calling ``reset_compute_session`` immediately before).

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It goes above and beyond by clearly warning that state persists between calls and explaining the consequences (e.g., counting results twice). It also describes the side effects of creating a job definition and retrieving results, and offers a practical tip about CAS libname usage. This is exemplary transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured: a concise main summary, followed by an IMPORTANT note about state persistence, and a practical tip. Every sentence adds meaningful value, and the formatting with bold and code blocks improves readability without unnecessary verbosity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity and the absence of annotations, the description is remarkably complete. It covers what the tool does, how it works, critical statefulness behavior, how to reset state, and a performance-related tip for CAS. The presence of an output schema means return values need no further explanation, so the description meets all the necessary contextual needs.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% and both parameters have detailed descriptions in the schema. The tool description adds a bit of extra context for fresh_session by clarifying it is equivalent to calling reset_compute_session, but overall it does not significantly expand on the schema. A baseline of 3 is appropriate because the schema already does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's function: 'Executes the provided SAS code in the Viya environment and returns information about the completed Job.' It uses a specific verb, resource, and scope, and explains the mechanism (create job definition, execute, retrieve results). However, it does not explicitly distinguish itself from similar siblings like submit_batch_job, so it falls short of a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides in-depth guidance on state persistence and recommends using fresh_session or reset_compute_session for a clean slate, which is helpful for correct usage. However, it does not explicitly state when to prefer this tool over alternatives such as submit_batch_job or list_jobs, or when not to use it. The guidance is implied rather than explicit, meriting a 3.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sassoftware/sas-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server