UNPKG

ableton-mcp-server-rag

Version:
54 lines 2.6 kB
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; import { z } from 'zod'; import { tool } from '../mcp/decorators/tool.js'; import { Result } from '../utils/common.js'; import { getDeviceById, getDeviceParameterById } from '../utils/obj-utils.js'; import { getDeviceProps, modifyDeviceParameterVal } from '../utils/obj-utils.js'; import { DeviceGettableProperties } from '../types/zod-types.js'; class DeviceTools { async getDeviceProperties({ device_id, properties }) { const device = getDeviceById(device_id); return getDeviceProps(device, properties); } async setDeviceParameter({ parameter_id, value }) { const parameter = getDeviceParameterById(parameter_id); modifyDeviceParameterVal(parameter, value); return Result.ok(); } } __decorate([ tool({ name: 'get_device_properties', description: 'get device properties. To get specific properties, set the corresponding property name to true in the properties parameter', paramsSchema: { device_id: z.string(), properties: DeviceGettableProperties, } }), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", Promise) ], DeviceTools.prototype, "getDeviceProperties", null); __decorate([ tool({ name: 'modify_device_parameter_value', description: 'set device parameter value, only support built-in Live devices', paramsSchema: { parameter_id: z.string().describe('parameter id, get from get_device_properties'), value: z.number(), } }), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", Promise) ], DeviceTools.prototype, "setDeviceParameter", null); export default DeviceTools; //# sourceMappingURL=device-tools.js.map