UNPKG

pollo-mcp

Version:

Pollo AI Model Context Protocol (MCP) Server for video generation

41 lines (39 loc) 1.69 kB
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; import * as resources from "./resources.js"; export class Text2VideoTool { constructor(config) { this.config = config; } getName() { return `text2video_${this.config.modelAlias}`; } getDescription() { return ` Generate a video from a text prompt. COST WARNING: This tool makes an API call to Pollo.ai which may incur costs. Only use when explicitly requested by the user.`; } getInputSchema() { return this.config.schema; } execute(request) { return __awaiter(this, void 0, void 0, function* () { const response = yield resources.generateVideo(this.config.modelBrand, this.config.modelAlias, request.params.arguments); return { content: [ { type: 'text', text: `The generation task status is ${response.status}, and task id is ${response.taskId}.`, }, ], }; }); } }