branch_thought
Generate alternative perspectives by branching existing thoughts in specified directions to explore unconventional solutions.
Instructions
Create a new branch of thinking from an existing thought. Returns only metadata, not full content.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| thoughtId | Yes | ID of the thought to branch from | |
| direction | Yes | Direction for the new branch (e.g. 'more_extreme', 'opposite', 'tangential') |
Implementation Reference
- src/index.ts:214-252 (handler)Main execution logic for the branch_thought tool: validates input, generates new branched thought using helper, persists it, returns metadata URI.case "branch_thought": { const { thoughtId, direction } = request.params.arguments as any; const thoughts = loadThoughts(); const sourceThought = thoughts[thoughtId]; if (!sourceThought) { throw new McpError(ErrorCode.InvalidParams, "Source thought not found"); } const newBranchId = `branch_${++branchCounter}`; const newThoughtId = `thought_${Date.now()}`; const thought: Thought = { id: newThoughtId, content: generateBranchedThought(sourceThought, direction), isRebellion: direction === 'opposite', challengesAssumption: true, branchFromThought: thoughtId, branchId: newBranchId, timestamp: Date.now() }; thoughts[newThoughtId] = thought; saveThoughts(thoughts); // Return only metadata - the full thought content stays in the resource return { content: [{ type: "text", text: JSON.stringify({ thoughtId: newThoughtId, resourceUri: `thought://${newThoughtId}`, branchInfo: `New branch ${newBranchId} from thought ${thoughtId}`, direction, message: "New thought branch created. Use resource URI to access full content." }, null, 2) }] }; }
- src/index.ts:86-99 (schema)Input schema definition for branch_thought tool specifying thoughtId and direction parameters.inputSchema: { type: "object", properties: { thoughtId: { type: "string", description: "ID of the thought to branch from" }, direction: { type: "string", description: "Direction for the new branch (e.g. 'more_extreme', 'opposite', 'tangential')" } }, required: ["thoughtId", "direction"] }
- src/index.ts:83-100 (registration)Tool registration in ListTools response, including name, description, and schema.{ name: "branch_thought", description: "Create a new branch of thinking from an existing thought. Returns only metadata, not full content.", inputSchema: { type: "object", properties: { thoughtId: { type: "string", description: "ID of the thought to branch from" }, direction: { type: "string", description: "Direction for the new branch (e.g. 'more_extreme', 'opposite', 'tangential')" } }, required: ["thoughtId", "direction"] } },
- src/index.ts:314-325 (helper)Helper function that generates the content for the new branched thought based on direction.function generateBranchedThought(sourceThought: Thought, direction: string): string { switch (direction) { case 'more_extreme': return `Taking it further: ${sourceThought.content}\n→ What if we amplify this 1000x? What becomes possible?`; case 'opposite': return `Complete reversal: If the opposite of "${sourceThought.content}" were true, what would that imply?`; case 'tangential': return `Unexpected connection: ${sourceThought.content}\n→ How does this apply to a completely different domain?`; default: return `Building on: ${sourceThought.content}\n→ Taking this in a new direction...`; } }