UNPKG

dbx-mcp-server

Version:

A Model Context Protocol server for Dropbox integration with AI-powered PDF analysis, multi-directory indexing, and parallel processing

79 lines 2.78 kB
// Example prompt for getting help with file operations const helpPrompt = { name: 'dbx_help', description: 'Get help with file operations and commands (integrates with Dropbox)', messages: [ { role: 'user', content: { type: 'text', text: 'How can I help you with your file operations today?' } } ] }; // Prompt for reviewing file operations before execution const reviewOperationPrompt = { name: 'review_operation', description: 'Review a file operation before executing it (integrates with Dropbox)', arguments: [ { name: 'operation', description: 'The operation to review (e.g., delete, move, copy)', required: true }, { name: 'path', description: 'The file/folder path involved', required: true } ], messages: [ { role: 'assistant', content: { type: 'text', text: 'I will help you review the {operation} operation on path "{path}". This helps ensure safe execution of file operations.\n\nOperation details:\n- Type: {operation}\n- Path: {path}\n\nWould you like me to explain what this operation will do?' } } ] }; // Collection of all available prompts export const promptDefinitions = [ helpPrompt, reviewOperationPrompt ]; // Handler for getting a specific prompt with arguments export const getPromptWithArgs = (name, args) => { const prompt = promptDefinitions.find(p => p.name === name); if (!prompt) return null; // Clone the prompt to avoid modifying the original const promptCopy = JSON.parse(JSON.stringify(prompt)); // If the prompt has arguments, validate and inject them if (args && promptCopy.arguments) { // Validate required arguments for (const arg of promptCopy.arguments) { if (arg.required && !args[arg.name]) { throw new Error(`Missing required argument: ${arg.name}`); } } // Inject arguments into the messages promptCopy.messages = promptCopy.messages.map((msg) => { if (msg.content.type === 'text') { let text = msg.content.text; // Replace argument placeholders Object.entries(args).forEach(([key, value]) => { text = text.replaceAll(`{${key}}`, String(value)); }); return { ...msg, content: { ...msg.content, text } }; } return msg; }); } return promptCopy; }; //# sourceMappingURL=prompt-definitions.js.map