UNPKG

mira-app-server

Version:

Mira Server - standalone server application using mira-app-core

58 lines 2.11 kB
"use strict"; /** * devices 模块工具 */ Object.defineProperty(exports, "__esModule", { value: true }); exports.registerDeviceTools = registerDeviceTools; const zod_1 = require("zod"); const helpers_1 = require("../helpers"); function registerDeviceTools(mcp, ctx) { mcp.registerTool('devices_list', { description: '获取所有设备连接信息(可按素材库筛选)', inputSchema: { libraryId: zod_1.z.string().optional() }, }, async (args) => { return (0, helpers_1.run)(async () => { const client = ctx.getClient(); if (args.libraryId) { return await client.devices().getByLibrary(args.libraryId); } const byLib = (await client.devices().getAll()); return byLib; }); }); mcp.registerTool('devices_stats', { description: '获取设备统计信息', inputSchema: {}, }, async () => { return (0, helpers_1.run)(async () => { const client = ctx.getClient(); return await client.devices().getStats(); }); }); mcp.registerTool('devices_disconnect', { description: '断开指定设备的连接', inputSchema: { clientId: zod_1.z.string(), libraryId: zod_1.z.string(), }, }, async (args) => { return (0, helpers_1.run)(async () => { const client = ctx.getClient(); return await client.devices().disconnect(args.clientId, args.libraryId); }); }); mcp.registerTool('devices_send', { description: '向指定设备发送消息', inputSchema: { clientId: zod_1.z.string(), libraryId: zod_1.z.string(), message: zod_1.z.any().describe('消息内容(对象或字符串)'), }, }, async (args) => { return (0, helpers_1.run)(async () => { const client = ctx.getClient(); return await client.devices().sendMessage(args.clientId, args.libraryId, args.message); }); }); } //# sourceMappingURL=devices.js.map