UNPKG

mcp-chat-adapter

Version:
53 lines (52 loc) 1.97 kB
import { ChatArgs, CreateConversationArgs, Conversation, ConversationMetadata } from './types.js'; import { SerializableValue } from 'fastmcp'; export type Logger = { debug: (message: string, data?: SerializableValue) => void; error: (message: string, data?: SerializableValue) => void; info: (message: string, data?: SerializableValue) => void; warn: (message: string, data?: SerializableValue) => void; }; /** * Sleep for a specified number of milliseconds */ export declare const sleep: (ms: number) => Promise<void>; /** * Validate create conversation arguments */ export declare const isValidCreateConversationArgs: (args: unknown) => args is CreateConversationArgs; /** * Validate chat arguments */ export declare const isValidChatArgs: (args: unknown) => args is ChatArgs; /** * Ensure the conversations directory exists */ export declare const ensureConversationDir: () => Promise<void>; /** * Get conversation filename from ID */ export declare const getConversationFilePath: (conversationId: string) => string; /** * Read conversation from disk */ export declare const readConversation: (conversationId: string) => Promise<Conversation>; /** * Write conversation to disk */ export declare const writeConversation: (conversation: Conversation) => Promise<void>; /** * List all conversations */ export declare const listConversations: (log: Logger) => Promise<ConversationMetadata[]>; /** * Delete a conversation */ export declare const deleteConversation: (conversationId: string) => Promise<void>; /** * Get the next available conversation ID by finding the highest existing ID and incrementing it * * Using sequential IDs (1, 2, 3, ...) instead of UUIDs makes for a better user experience, * as they are easier to remember, type, and reference. This is especially helpful when users * need to manually specify conversation IDs in the chat tool. */ export declare const getNextConversationId: () => Promise<string>;