Skip to main content
Glama
sassoftware

SAS MCP Server

Official
by sassoftware

Create Custom Function

create_custom_function

Create a DS2 custom function from a method, compile-checked first, so rule expressions can call it; assign a category to organize it for use in decision rules.

Instructions

Create a DS2 custom function that rule expressions can call, after checking that it compiles.

The code is one DS2 method: method risk_band(double score) returns varchar(10); ... return 'LOW'; end;. Its name is the function's name. A rule then uses it in an expression, e.g. an assignment risk_band(credit_score). A new function takes a few seconds to be visible to validate_decision_expression.

Input Schema

NameRequiredDescriptionDefault
codeYesThe DS2 method.
categoryYesThe function category, by name or ID; a name that does not exist yet is created.
descriptionNoOptional description.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.19.0

TDQS

A3.8/5.0
Behavior4/5

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

Annotations declare non-readonly, non-destructive, non-idempotent, closed-world. The description adds meaningful behavioral context beyond that: the function is compile-checked on creation, and there is a propagation delay ('a few seconds to be visible to validate_decision_expression'). It omits what happens on failed compilation (error vs. partial creation), keeping it from a 5.

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

Conciseness4/5

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

Front-loaded with the verb and resource, followed by a concrete code example and the visibility caveat. Every sentence carries information; the inline DS2 snippet is longer than strictly necessary but earns its place as a template. No wasted preamble.

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

Completeness4/5

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

An output schema exists, so return values needn't be described, and annotations cover the safety profile. The description fills the important gaps – compile validation, naming rule, propagation delay. It stops short of describing failure behavior or required permissions for a mutation tool, so a minor gap remains.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3, but the description genuinely adds semantics: the `code` value is exactly one DS2 method whose name becomes the function name, which is not in the schema. That name-derivation rule is the key insight an agent needs and raises the score.

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?

Starts with a specific verb+resource: 'Create a DS2 custom function that rule expressions can call, after checking that it compiles.' An agent can distinguish this from update_custom_function and validate_custom_function by the create intent. Sibling differentiation is implicit (validate/update variants exist) rather than called out explicitly, so not 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?

It explains the creation context – the code is a DS2 method used by rules in expressions like risk_band(credit_score) – and hints at verification via validate_decision_expression. However, it never explicitly states when to use this versus update_custom_function or validate_custom_function, and there are no exclusions. Usage is implied rather than stated.

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

Deploy Server

Other Tools