Skip to main content
Glama
fmangot

Sequential Thinking MVP Server

by fmangot

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

TableJSON Schema
NameRequiredDescriptionDefault
branchIdYesThe identifier of the branch to retrieve
sessionIdNoOptional session ID (defaults to current session)

Implementation Reference

  • 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
            ),
          },
        ],
      };
    }
  • 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);
    });
  • Tool list registration in HTTP server, exposing 'get_thought_branch' via ALL_TOOLS.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return { tools: ALL_TOOLS };
    });

Latest Blog Posts

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/fmangot/Mcp'

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