UNPKG

@answerai/answeragent-mcp

Version:

A lightweight Model Context Protocol (MCP) server for Answer AI chatflow and document store management

69 lines (68 loc) 2.18 kB
import { AssistantsService } from "../services/assistants.js"; const service = AssistantsService.getInstance(); export const listAssistantsTool = { name: "list_assistants", description: "List assistants", inputSchema: { type: "object", properties: {} }, handler: async () => { const result = await service.listAssistants(); return { content: [{ type: "text", text: JSON.stringify(result) }] }; }, }; export const getAssistantTool = { name: "get_assistant", description: "Get assistant by ID", inputSchema: { type: "object", properties: { id: { type: "string" } }, required: ["id"], }, handler: async ({ id }) => { const result = await service.getAssistant(id); return { content: [{ type: "text", text: JSON.stringify(result) }] }; }, }; export const createAssistantTool = { name: "create_assistant", description: "Create assistant", inputSchema: { type: "object", properties: { details: { type: "object" }, }, required: ["details"], }, handler: async (data) => { const result = await service.createAssistant(data); return { content: [{ type: "text", text: JSON.stringify(result) }] }; }, }; export const updateAssistantTool = { name: "update_assistant", description: "Update assistant", inputSchema: { type: "object", properties: { id: { type: "string" }, updates: { type: "object" }, }, required: ["id", "updates"], }, handler: async ({ id, updates }) => { const result = await service.updateAssistant(id, updates); return { content: [{ type: "text", text: JSON.stringify(result) }] }; }, }; export const deleteAssistantTool = { name: "delete_assistant", description: "Delete assistant", inputSchema: { type: "object", properties: { id: { type: "string" } }, required: ["id"], }, handler: async ({ id }) => { await service.deleteAssistant(id); return { content: [{ type: "text", text: JSON.stringify({ success: true }) }] }; }, };