creative_exploration
Explore diverse perspectives and creative connections on a topic, incorporating metaphors and optional constraints to generate novel insights and solutions.
Instructions
Generate novel perspectives and connections for a topic
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| constraints | No | Optional constraints or parameters to consider | |
| include_metaphors | No | Whether to include metaphorical thinking | |
| perspective_count | No | Number of perspectives to generate | |
| session_id | No | Optional session ID for maintaining state between calls | |
| topic | Yes | The topic or problem to explore creatively |
Input Schema (JSON Schema)
{
"properties": {
"constraints": {
"description": "Optional constraints or parameters to consider",
"items": {
"type": "string"
},
"type": "array"
},
"include_metaphors": {
"default": true,
"description": "Whether to include metaphorical thinking",
"type": "boolean"
},
"perspective_count": {
"default": 3,
"description": "Number of perspectives to generate",
"type": "number"
},
"session_id": {
"description": "Optional session ID for maintaining state between calls",
"type": "string"
},
"topic": {
"description": "The topic or problem to explore creatively",
"type": "string"
}
},
"required": [
"topic"
],
"type": "object"
}
Implementation Reference
- src/tools/creative-exploration.ts:90-150 (handler)The core handler function `exploreCreatively` that implements the tool logic: extracts concepts, generates creative perspectives, connections, metaphors using imported patterns, compiles insights, and formats output.export async function exploreCreatively( topic: string, constraints: string[] = [], creativePatterns: CreativePatterns, ucpfCore: UcpfCore, stateManager: StateManager, sessionId?: string, options: ExplorationOptions = {} ): Promise<string> { // Set defaults for options const { perspectiveCount = 3, connectionCount = 3, metaphorCount = 3, includeMetaphors = true, focusAreas = [] } = options; // Extract concepts from the topic and constraints const topicWords = topic.split(' '); const constraintWords = constraints.join(' ').split(' '); const allWords = [...topicWords, ...constraintWords]; // Filter for potential concepts (words longer than 3 characters) const concepts = Array.from(new Set( allWords .filter(word => word.length > 3) .map(word => word.replace(/[^\w]/g, '')) .filter(word => word.length > 0) )); // Generate perspectives, connections, and metaphors const perspectives = creativePatterns.generatePerspectives( topic, perspectiveCount ); const connections = creativePatterns.generateConnections( concepts, connectionCount ); const metaphors = includeMetaphors ? creativePatterns.generateMetaphors(topic, metaphorCount) : []; // Generate some insights based on all of the above const insights = [ "Consider combining elements from different perspectives to create hybrid solutions", "Look for patterns that emerge across the different viewpoints", "Challenge your initial assumptions about the constraints of the problem" ]; // Construct the result const result: ExplorationResult = { perspectives, connections, metaphors, insights }; // Format and return the results return formatExploration(result); }
- src/index.ts:367-397 (schema)MCP input schema for the 'creative_exploration' tool defining required 'topic' and optional parameters like constraints, perspective_count, include_metaphors, session_id.inputSchema: { type: "object", properties: { topic: { type: "string", description: "The topic or problem to explore creatively" }, constraints: { type: "array", items: { type: "string" }, description: "Optional constraints or parameters to consider" }, perspective_count: { type: "number", description: "Number of perspectives to generate", default: 3 }, include_metaphors: { type: "boolean", description: "Whether to include metaphorical thinking", default: true }, session_id: { type: "string", description: "Optional session ID for maintaining state between calls" } }, required: ["topic"] }
- src/index.ts:364-398 (registration)Registration of the 'creative_exploration' tool in the MCP server's ListToolsRequestSchema handler, including name, description, and input schema.{ name: "creative_exploration", description: "Generate novel perspectives and connections for a topic", inputSchema: { type: "object", properties: { topic: { type: "string", description: "The topic or problem to explore creatively" }, constraints: { type: "array", items: { type: "string" }, description: "Optional constraints or parameters to consider" }, perspective_count: { type: "number", description: "Number of perspectives to generate", default: 3 }, include_metaphors: { type: "boolean", description: "Whether to include metaphorical thinking", default: true }, session_id: { type: "string", description: "Optional session ID for maintaining state between calls" } }, required: ["topic"] } },
- src/index.ts:478-517 (registration)Dispatch handler in CallToolRequestSchema that validates inputs, prepares options, calls exploreCreatively, and returns MCP-formatted response.case "creative_exploration": { // Validate required parameters if (!args?.topic || typeof args.topic !== "string") { throw new McpError( ErrorCode.InvalidParams, "Required parameter 'topic' must be a string" ); } // Optional parameters const constraints = Array.isArray(args.constraints) ? args.constraints.map(String) : []; const perspectiveCount = typeof args.perspective_count === "number" ? Math.max(1, Math.min(5, args.perspective_count)) : 3; const includeMetaphors = args.include_metaphors !== false; const sessionId = args.session_id as string | undefined; // Process the creative exploration const results = await exploreCreatively( args.topic, constraints, creativePatterns, ucpfCore, stateManager, sessionId, { perspectiveCount, includeMetaphors } ); return { content: [ { type: "text", text: results } ] }; }
- Supporting function to format ExplorationResult into structured Markdown output with sections for perspectives, connections, metaphors, and key insights.export function formatExploration(result: ExplorationResult): string { const formatSection = (title: string, content: string): string => { return `## ${title}\n\n${content}\n\n`; }; let output = ""; // Format perspectives if (result.perspectives.length > 0) { output += formatSection("Alternative Perspectives", result.perspectives .map(p => ( `### ${p.viewpoint}\n` + `**Rationale:** ${p.rationale}\n` + (p.implications.length > 0 ? "**Implications:**\n" + p.implications.map(i => `- ${i}`).join("\n") : "") + (p.limitingBeliefs.length > 0 ? "\n\n**Limiting Beliefs to Challenge:**\n" + p.limitingBeliefs.map(b => `- ${b}`).join("\n") : "") + (p.potentialOutcomes.length > 0 ? "\n\n**Potential Outcomes:**\n" + p.potentialOutcomes.map(o => `- ${o}`).join("\n") : "") )) .join("\n\n") ); } // Format connections if (result.connections.length > 0) { output += formatSection("Creative Connections", result.connections .map(c => ( `### ${c.type.charAt(0).toUpperCase() + c.type.slice(1)}: ${c.source} ↔ ${c.target}\n` + `${c.description}\n\n` + `**Insight:** ${c.insight}` )) .join("\n\n") ); } // Format metaphors if (result.metaphors.length > 0) { output += formatSection("Metaphorical Thinking", "Consider these metaphors to spark new insights:\n\n" + result.metaphors.map(m => `- ${m}`).join("\n") ); } // Format insights if (result.insights.length > 0) { output += formatSection("Key Insights", result.insights.map(i => `- ${i}`).join("\n") ); } return output; }