ableton-mcp-server-rag
Version:
Ableton Live MCP depend on Ableton JS
47 lines • 1.2 kB
JavaScript
import { z } from 'zod';
import { logger } from '../main.js';
import { ErrorTypes } from '../mcp/error-handler.js';
import { installAbletonJsScripts } from './install-scripts.js';
/**
* Result class for operation outcomes
*/
export class Result {
static ok() {
return 'ok';
}
static error(message) {
return { error: message };
}
static data(data) {
return { data };
}
}
/**
* Create a Zod schema
* @param props Properties object
* @returns Zod schema
*/
export function createZodSchema(props) {
return z
.object(props)
.partial();
}
/**
* Copy midi-scripts from ableton-js library to Ableton Live's MIDI Remote Scripts folder
*/
export function initAbletonJs() {
try {
installAbletonJsScripts(logger);
}
catch (error) {
logger.error(error instanceof Error ? error.message : String(error));
throw ErrorTypes.INTERNAL_ERROR('init ableton-js error');
}
}
export function getLocalDate() {
const localTime = new Date().toLocaleString(undefined, {
hour12: false
}).replace(/\//g, '-').replace(',', '');
return new Date(localTime);
}
//# sourceMappingURL=common.js.map