collaborativereasoning
Simulate expert collaboration to tackle complex problems by coordinating diverse perspectives and integrating insights through structured reasoning frameworks.
Instructions
A detailed tool for simulating expert collaboration with diverse perspectives. This tool helps models tackle complex problems by coordinating multiple viewpoints. It provides a framework for structured collaborative reasoning and perspective integration.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| topic | Yes | ||
| personas | Yes | ||
| contributions | Yes | ||
| stage | Yes | ||
| activePersonaId | Yes | ||
| nextPersonaId | No | ||
| consensusPoints | No | ||
| disagreements | No | ||
| keyInsights | No | ||
| openQuestions | No | ||
| finalRecommendation | No | ||
| sessionId | Yes | Unique identifier for this collaboration session | |
| iteration | Yes | Current iteration of the collaboration | |
| suggestedContributionTypes | No | ||
| nextContributionNeeded | Yes | Whether another contribution is needed |
Implementation Reference
- Implementation of the CollaborativeReasoningServer class which handles processing the collaborative reasoning task.
export class CollaborativeReasoningServer { private validateInputData(input: unknown): CollaborativeReasoningData { const data = input as CollaborativeReasoningData; if (!data.topic || !data.personas || !data.contributions || !data.stage || !data.activePersonaId || !data.sessionId) { throw new Error("Invalid input for CollaborativeReasoning: Missing required fields."); } if (typeof data.iteration !== 'number' || data.iteration < 0) { throw new Error("Invalid iteration value for CollaborativeReasoningData."); } if (typeof data.nextContributionNeeded !== 'boolean') { throw new Error("Invalid nextContributionNeeded value for CollaborativeReasoningData."); } return data; } private formatOutput(data: CollaborativeReasoningData): string { const { topic, personas, contributions, stage, activePersonaId, iteration } = data; let output = `\n${chalk.bold.blue('Collaborative Reasoning Session')}\n`; output += `${chalk.bold.green('Topic:')} ${topic}\n`; output += `${chalk.bold.yellow('Stage:')} ${stage} (Iteration: ${iteration})\n`; // Active persona const activePersona = personas.find(p => p.id === activePersonaId); if (activePersona) { output += `\n${chalk.bold.magenta('Active Persona:')} ${activePersona.name}\n`; output += `${chalk.bold.cyan('Expertise:')} ${activePersona.expertise.join(', ')}\n`; output += `${chalk.bold.cyan('Perspective:')} ${activePersona.perspective}\n`; } // Contributions if (contributions.length > 0) { output += `\n${chalk.bold.green('Contributions:')}\n`; for (const contribution of contributions) { const persona = personas.find(p => p.id === contribution.personaId); const personaName = persona ? persona.name : contribution.personaId; output += `${chalk.bold(`${personaName} (${contribution.type}, confidence: ${contribution.confidence.toFixed(2)}):`)} `; output += `${contribution.content}\n\n`; } } // Consensus points if (data.consensusPoints && data.consensusPoints.length > 0) { output += `\n${chalk.bold.green('Consensus Points:')}\n`; data.consensusPoints.forEach((point, i) => { output += `${chalk.bold(`${i+1}.`)} ${point}\n`; }); } // Key insights if (data.keyInsights && data.keyInsights.length > 0) { output += `\n${chalk.bold.yellow('Key Insights:')}\n`; data.keyInsights.forEach((insight, i) => { output += `${chalk.bold(`${i+1}.`)} ${insight}\n`; }); } // Final recommendation if (data.finalRecommendation) { output += `\n${chalk.bold.cyan('Final Recommendation:')}\n${data.finalRecommendation}\n`; } return output; } public processCollaborativeReasoning(input: unknown): CollaborativeReasoningData { const validatedData = this.validateInputData(input); // Log formatted output to console const formattedOutput = this.formatOutput(validatedData); console.error(formattedOutput); return validatedData; } } - src/index.ts:1096-1109 (handler)The tool registration handler in src/index.ts that invokes the collaborativeReasoningServer instance.
case "collaborativereasoning": { const result = collaborativeReasoningServer.processCollaborativeReasoning( request.params.arguments ); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; }