Skip to main content
Glama

MCP Project Orchestrator

prompt-combiner-interface.json9.18 kB
{ "id": "prompt-combiner-interface", "name": "PromptCombiner Interface", "description": "Base interface for combining multiple prompts into sophisticated workflows", "content": "/**\n * PromptCombiner Interface for {{project_name}}\n * \n * This interface defines the contract for combining multiple prompts\n * into sophisticated, multi-step workflows with contextual awareness.\n */\n\n// ============================\n// Base Combiner Interface\n// ============================\n\n/**\n * PromptCombiner interface\n * Provides methods for composing complex workflows from individual prompts\n */\nexport interface PromptCombiner {\n /**\n * Combines multiple prompts into a single workflow\n * @param promptIds Array of prompt IDs to combine\n * @param context Additional context for the combination\n * @returns The combined prompt result\n */\n combinePrompts(promptIds: string[], context?: CombinerContext): Promise<CombinedPromptResult>;\n \n /**\n * Gets available prompt suggestions for combining\n * @param category Optional category to filter by\n * @param context Current context to inform suggestions\n * @returns Array of prompt suggestions\n */\n getPromptSuggestions(category?: string, context?: CombinerContext): Promise<PromptSuggestion[]>;\n \n /**\n * Validates if the prompts can be combined\n * @param promptIds Array of prompt IDs to validate\n * @returns Validation result with any issues\n */\n validateCombination(promptIds: string[]): Promise<CombinationValidationResult>;\n \n /**\n * Creates a saved workflow from a successful combination\n * @param name Name for the new workflow\n * @param promptIds Component prompt IDs\n * @param config Configuration for the combination\n * @returns The created workflow\n */\n saveWorkflow(name: string, promptIds: string[], config: WorkflowConfig): Promise<SavedWorkflow>;\n \n /**\n * Loads a previously saved workflow\n * @param workflowId ID of the saved workflow\n * @returns The loaded workflow\n */\n loadWorkflow(workflowId: string): Promise<SavedWorkflow>;\n}\n\n// ============================\n// Supporting Types\n// ============================\n\n/**\n * Context for prompt combination\n */\nexport interface CombinerContext {\n /** User-provided variables */\n variables?: Record<string, any>;\n \n /** Current project information */\n project?: {\n name: string;\n type: string;\n technologies: string[];\n };\n \n /** Resource URIs to include */\n resources?: string[];\n \n /** History of previous combinations */\n history?: {\n promptId: string;\n result: string;\n timestamp: string;\n }[];\n \n /** Additional context properties */\n {{additional_context_properties}}\n}\n\n/**\n * Result of combining prompts\n */\nexport interface CombinedPromptResult {\n /** The combined content */\n content: string;\n \n /** The component prompts that were used */\n components: {\n id: string;\n name: string;\n contribution: string;\n }[];\n \n /** Variables that were applied */\n appliedVariables: Record<string, any>;\n \n /** Variables that are still required */\n requiredVariables?: string[];\n \n /** Suggested next steps or actions */\n nextSteps?: {\n action: string;\n description: string;\n }[];\n \n /** Additional result properties */\n {{additional_result_properties}}\n}\n\n/**\n * Prompt suggestion for combining\n */\nexport interface PromptSuggestion {\n /** The prompt ID */\n id: string;\n \n /** The prompt name */\n name: string;\n \n /** Relevance score (0-100) */\n relevance: number;\n \n /** Compatible prompt IDs to combine with */\n compatibleWith: string[];\n \n /** Why this prompt is suggested */\n reason: string;\n}\n\n/**\n * Result of validating a prompt combination\n */\nexport interface CombinationValidationResult {\n /** Whether the combination is valid */\n isValid: boolean;\n \n /** Issues with the combination if any */\n issues?: {\n promptId: string;\n issue: string;\n severity: 'warning' | 'error';\n suggestion?: string;\n }[];\n \n /** Suggested alternatives if invalid */\n suggestions?: {\n promptIds: string[];\n reason: string;\n }[];\n}\n\n/**\n * Configuration for a saved workflow\n */\nexport interface WorkflowConfig {\n /** The order in which to execute prompts */\n executionOrder: string[];\n \n /** Default variables for the workflow */\n defaultVariables?: Record<string, any>;\n \n /** Conditions for when to execute each prompt */\n conditions?: {\n promptId: string;\n condition: string;\n }[];\n \n /** Variables to pass between prompts */\n variableMapping?: {\n fromPromptId: string;\n toPromptId: string;\n mappings: {\n fromVariable: string;\n toVariable: string;\n }[];\n }[];\n \n /** Additional configuration properties */\n {{additional_config_properties}}\n}\n\n/**\n * Saved workflow\n */\nexport interface SavedWorkflow {\n /** Unique identifier */\n id: string;\n \n /** Name of the workflow */\n name: string;\n \n /** Description of what the workflow does */\n description?: string;\n \n /** Component prompt IDs */\n promptIds: string[];\n \n /** The workflow configuration */\n config: WorkflowConfig;\n \n /** Category for organization */\n category?: string;\n \n /** Tags for filtering */\n tags?: string[];\n \n /** When the workflow was created */\n createdAt: string;\n \n /** When the workflow was last updated */\n updatedAt: string;\n \n /** The workflow version */\n version: number;\n}\n\n// ============================\n// Implementation Guidelines\n// ============================\n\n/**\n * Implementing a PromptCombiner requires:\n * \n * 1. Determining compatibility between prompts\n * 2. Resolving variable dependencies and conflicts\n * 3. Creating a logical execution flow\n * 4. Handling errors and edge cases gracefully\n * 5. Supporting both synchronous and asynchronous content\n * 6. Maintaining context between prompt executions\n * 7. Providing clear error messages for invalid combinations\n * \n * Example implementation:\n * \n * ```typescript\n * class BasicPromptCombiner implements PromptCombiner {\n * constructor(private promptService: PromptService) {}\n * \n * async combinePrompts(promptIds: string[], context?: CombinerContext): Promise<CombinedPromptResult> {\n * // Validate the combination\n * const validation = await this.validateCombination(promptIds);\n * if (!validation.isValid) {\n * throw new Error(`Invalid prompt combination: ${validation.issues?.[0]?.issue}`);\n * }\n * \n * // Load all prompts\n * const prompts = await Promise.all(\n * promptIds.map(id => this.promptService.getPrompt(id))\n * );\n * \n * // Extract all required variables\n * const allVariables = new Set<string>();\n * prompts.forEach(prompt => {\n * if (prompt.variables) {\n * prompt.variables.forEach(v => allVariables.add(typeof v === 'string' ? v : v.name));\n * }\n * });\n * \n * // Check for missing variables\n * const providedVariables = context?.variables || {};\n * const missingVariables = Array.from(allVariables).filter(v => !(v in providedVariables));\n * \n * // Combine the prompts\n * let combinedContent = '';\n * const components = [];\n * \n * for (const prompt of prompts) {\n * // Apply variables to this prompt\n * const result = await this.promptService.applyTemplate(prompt.id, providedVariables);\n * \n * // Add to the combined content\n * combinedContent += result.content + '\\n\\n';\n * \n * // Record this component's contribution\n * components.push({\n * id: prompt.id,\n * name: prompt.name,\n * contribution: result.content\n * });\n * }\n * \n * return {\n * content: combinedContent.trim(),\n * components,\n * appliedVariables: providedVariables,\n * requiredVariables: missingVariables.length > 0 ? missingVariables : undefined\n * };\n * }\n * \n * // Other method implementations...\n * }\n * ```\n */\n\n// ============================\n// Extension Points\n// ============================\n\n/**\n * The PromptCombiner interface can be extended for specific use cases:\n * \n * 1. DevelopmentPromptCombiner - For software development workflows\n * 2. DocumentationPromptCombiner - For creating comprehensive documentation\n * 3. DiagramPromptCombiner - For generating diagrams from multiple inputs\n * 4. WorkflowPromptCombiner - For business process automation\n * 5. {{additional_specializations}}\n */", "isTemplate": true, "variables": [ "project_name", "additional_context_properties", "additional_result_properties", "additional_config_properties", "additional_specializations" ], "tags": [ "development", "interfaces", "prompt-engineering", "workflows", "integration" ], "category": "architecture", "createdAt": "2024-08-08T17:00:00.000Z", "updatedAt": "2024-08-08T17:00:00.000Z", "version": 1 }

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/sparesparrow/mcp-project-orchestrator'

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