get_thought_branch
Retrieve a specific branch of alternative reasoning paths to explore different approaches to complex problems during structured analysis.
Instructions
Retrieves a specific branch of alternative reasoning paths
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| branchId | Yes | The identifier of the branch to retrieve | |
| sessionId | No | Optional session ID (defaults to current session) |
Input Schema (JSON Schema)
{
"properties": {
"branchId": {
"description": "The identifier of the branch to retrieve",
"type": "string"
},
"sessionId": {
"description": "Optional session ID (defaults to current session)",
"type": "string"
}
},
"required": [
"branchId"
],
"type": "object"
}
Implementation Reference
- src/tools/handlers.ts:57-82 (handler)The core handler logic for the 'get_thought_branch' tool. It validates the required 'branchId' parameter, retrieves the specific thought branch using the SequentialThinkingManager, and formats the response as MCP content with JSON-serialized branch details including thought count and thoughts.case 'get_thought_branch': { const { branchId, sessionId } = args as { branchId: string; sessionId?: string }; if (!branchId) { throw new ValidationError('branchId is required'); } const branch = thinkingManager.getBranch(branchId, sessionId); return { content: [ { type: 'text', text: JSON.stringify( { branchId, thoughtCount: branch.length, thoughts: branch, }, null, 2 ), }, ], }; }
- src/tools/definitions.ts:69-86 (schema)The input schema and metadata definition for the 'get_thought_branch' tool, specifying required 'branchId' and optional 'sessionId' parameters.export const GET_BRANCH_TOOL: Tool = { name: 'get_thought_branch', description: 'Retrieves a specific branch of alternative reasoning paths', inputSchema: { type: 'object', properties: { branchId: { type: 'string', description: 'The identifier of the branch to retrieve', }, sessionId: { type: 'string', description: 'Optional session ID (defaults to current session)', }, }, required: ['branchId'], }, };
- src/index.ts:32-34 (registration)Registration of tool list handler that returns ALL_TOOLS array, which includes the 'get_thought_branch' tool schema.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: ALL_TOOLS }; });
- src/index.ts:37-39 (registration)Registration of the generic tool call handler that dispatches to handleToolCall, which contains the specific logic for 'get_thought_branch'.server.setRequestHandler(CallToolRequestSchema, async (request) => { return handleToolCall(request.params, thinkingManager); });
- src/server-http.ts:45-47 (registration)Tool list registration in HTTP server, exposing 'get_thought_branch' via ALL_TOOLS.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: ALL_TOOLS }; });