@sassoftware/mcp-serverjs
Version:
A mcp server for SAS Viya
51 lines (42 loc) • 1.42 kB
JavaScript
/*
* Copyright © 2025, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
import { z } from 'zod';
import debug from 'debug';
import _scrScore from '../toolhelpers/_scrScore.js';
import scrModels from '../db/scrModels.js';
function scrScore() {
const log = debug('scr');
let description = `
Azure.
The input to this tool is:
- name - the name of the deployed SCR container.
- scenario - The scenario is a key-values pairs like x=1, y=2, z=3
- if scenario is not specified, the tool will return the variables in the model
- scrscore with url for x1=1,x2=2
Use scrInfo to get the input variables for the model.
`;
let spec = {
name: 'scrScore',
description: description,
schema: {
name: z.string(),
scenario: z.string()
},
required: ['name', 'scenario'],
handler: async (params) => {
let url= scrModels(params.name);
if (url === null) {
return { status: { statusCode: 2, msg: `SCR model ${params.name} not found` }, results: {} };
}
let r = await _scrScore({url: url, scenario: params.scenario});
return r;
}
}
return spec;
}
export default scrScore;