Skip to main content
Glama
zqushair
by zqushair
archiveConversation.ts1.7 kB
import { BaseRequestHandler } from '../base.js'; import { ArchiveConversationArguments, ToolResponse } from '../../../models/mcp.js'; import { frontappClient } from '../../../clients/frontapp/index.js'; /** * Handler for the archive_conversation tool * Archives a conversation in Frontapp */ export class ArchiveConversationHandler extends BaseRequestHandler<ArchiveConversationArguments> { /** * Validate the arguments passed to the tool * @param args The arguments to validate * @throws Error if the arguments are invalid */ protected validateArgs(args: ArchiveConversationArguments): void { // Validate conversation_id if (!args.conversation_id) { throw new Error('conversation_id is required'); } if (typeof args.conversation_id !== 'string') { throw new Error('conversation_id must be a string'); } } /** * Execute the request to archive a conversation * @param args The validated arguments * @returns A response indicating success or failure */ protected async execute(args: ArchiveConversationArguments): Promise<ToolResponse> { try { // Call the Frontapp API to archive the conversation await frontappClient.archiveConversation(args.conversation_id); // Create a success response return this.createSuccessResponse({ message: `Conversation ${args.conversation_id} archived successfully`, }); } catch (error: any) { // Create an error response return this.createErrorResponse(`Failed to archive conversation: ${error.message}`); } } } // Export a singleton instance of the handler export const archiveConversationHandler = new ArchiveConversationHandler();

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/zqushair/Frontapp-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server