Skip to main content
Glama

capture_thought

Capture and process thoughts to classify them, provide metacognitive feedback, and retrieve relevant ideas for structured thinking.

Instructions

Stores a new thought in memory and in the thought history and runs a pipeline to classify the thought, return metacognitive feedback, and retrieve relevant thoughts.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
thoughtYesThe content of the current thought
thought_numberYesCurrent position in the sequence
total_thoughtsYesExpected total number of thoughts
next_thought_neededYesWhether another thought should follow
stageYesCurrent thinking stage (e.g., 'Problem Definition', 'Analysis')
is_revisionNoWhether this revises a previous thought
revises_thoughtNoNumber of thought being revised
branch_from_thoughtNoStarting point for a new thought branch
branch_idNoIdentifier for the current branch
needs_more_thoughtsNoWhether additional thoughts are needed
scoreNoQuality score (0.0 to 1.0)
tagsNoCategories or labels for the thought

Implementation Reference

  • Core handler function that captures and processes a thought: validates input, applies reasoning, stores in memory and history, generates metacognitive feedback and retrieves related thoughts.
    captureThought(inputData: any): any {
      try {
        // Validate and create thought data
        const thoughtData = this.validateThoughtData(inputData);
        
        // Apply reasoning strategy
        const enhancedThought = this.reasoningEngine.applyReasoningStrategy(thoughtData);
        
        // Store in memory
        this.memoryManager.consolidateMemory(enhancedThought);
        
        // Get metacognitive insights
        const improvements = this.metacognitiveMonitor.suggestImprovements(enhancedThought);
        
        // Get related thoughts
        const relatedThoughts = this.memoryManager.retrieveRelevantThoughts(enhancedThought);
        
        // Store thought in history
        this.thoughtHistory.push(enhancedThought);
        
        // Handle branching
        if (enhancedThought.branchFromThought && enhancedThought.branchId) {
          if (!this.branches[enhancedThought.branchId]) {
            this.branches[enhancedThought.branchId] = [];
          }
          this.branches[enhancedThought.branchId].push(enhancedThought);
        }
        
        // Return in the format expected by tests
        return {
          content: [{
            type: "text",
            text: JSON.stringify({
              thoughtAnalysis: {
                currentThought: {
                  thoughtNumber: enhancedThought.thoughtNumber,
                  totalThoughts: enhancedThought.totalThoughts,
                  nextThoughtNeeded: enhancedThought.nextThoughtNeeded,
                  stage: enhancedThought.stage,
                  score: enhancedThought.score,
                  tags: enhancedThought.tags,
                  timestamp: enhancedThought.createdAt.toISO(),
                  branch: enhancedThought.branchId
                },
                analysis: {
                  relatedThoughtsCount: relatedThoughts.length,
                  qualityMetrics: this.metacognitiveMonitor.evaluateThoughtQuality(enhancedThought),
                  suggestedImprovements: improvements
                },
                context: {
                  activeBranches: Object.keys(this.branches),
                  thoughtHistoryLength: this.thoughtHistory.length,
                  currentStage: enhancedThought.stage
                }
              }
            }, null, 2)
          }]
        };
        
      } catch (e) {
        return this.handleError(e);
      }
    }
  • Zod schema defining the input parameters and validation for the capture_thought tool.
    export const captureThoughtSchema = z.object({
      thought: z.string().describe("The content of the current thought"),
      thought_number: z.number().int().positive().describe("Current position in the sequence"),
      total_thoughts: z.number().int().positive().describe("Expected total number of thoughts"),
      next_thought_needed: z.boolean().describe("Whether another thought should follow"),
      stage: z.string().describe("Current thinking stage (e.g., 'Problem Definition', 'Analysis')"),
      is_revision: z.boolean().optional().describe("Whether this revises a previous thought"),
      revises_thought: z.number().int().optional().describe("Number of thought being revised"),
      branch_from_thought: z.number().int().optional().describe("Starting point for a new thought branch"),
      branch_id: z.string().optional().describe("Identifier for the current branch"),
      needs_more_thoughts: z.boolean().optional().describe("Whether additional thoughts are needed"),
      score: z.number().min(0).max(1).optional().describe("Quality score (0.0 to 1.0)"),
      tags: z.array(z.string()).optional().describe("Categories or labels for the thought")
    });
  • src/tools.ts:45-49 (registration)
    Tool definition object for 'capture_thought' used in MCP tool listing.
    export const captureThoughtTool: Tool = {
      name: "capture_thought",
      description: "Stores a new thought in memory and in the thought history and runs a pipeline to classify the thought, return metacognitive feedback, and retrieve relevant thoughts.",
      parameters: captureThoughtSchema,
      inputSchema: zodToInputSchema(captureThoughtSchema)
  • index.ts:57-97 (registration)
    MCP tool call dispatch handler that processes 'capture_thought' requests, validates arguments, maps to internal format, and invokes the core handler.
    switch (params.name) {
      case "capture_thought": {        
        if (!params.arguments && params.arguments) {
          params.arguments = params.arguments;
        }
        
        if (!params.arguments) {
          console.error("ERROR: arguments are undefined in capture_thought request");
          return {
            content: [{
              type: "text",
              text: JSON.stringify({
                error: "Invalid request: arguments object is defined",
                status: "failed",
                received: JSON.stringify(params)
              })
            }],
            isError: true
          };
        }
        
        // Type assertion for the params.arguments
        const captureParams = params.arguments as z.infer<typeof captureThoughtSchema>;
        
        const inputData = {
          thought: captureParams.thought,
          thoughtNumber: captureParams.thought_number,
          totalThoughts: captureParams.total_thoughts,
          nextThoughtNeeded: captureParams.next_thought_needed,
          stage: captureParams.stage,
          isRevision: captureParams.is_revision,
          revisesThought: captureParams.revises_thought,
          branchFromThought: captureParams.branch_from_thought,
          branchId: captureParams.branch_id,
          needsMoreThoughts: captureParams.needs_more_thoughts,
          score: captureParams.score,
          tags: captureParams.tags || []
        };
        
        return thinkingServer.captureThought(inputData);
      }
  • index.ts:31-36 (registration)
    MCP list tools handler that returns the toolDefinitions array including capture_thought tool.
    // Handle the ListTools request
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: toolDefinitions
      };
    });
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions storing thoughts and running a pipeline but fails to detail critical aspects like whether this is a mutation (likely yes), permission requirements, error handling, or what the pipeline outputs. This leaves significant gaps for a tool with 12 parameters and no output schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core action ('stores a new thought') and adds pipeline details. It avoids redundancy but could be slightly more structured for clarity, such as separating storage from pipeline steps.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (12 parameters, no output schema, and no annotations), the description is incomplete. It lacks details on behavioral traits, output format, error conditions, and how it integrates with sibling tools, making it inadequate for safe and effective use by an AI agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all 12 parameters thoroughly. The description adds no additional meaning beyond the schema, such as explaining parameter interactions or usage examples. Baseline 3 is appropriate when schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('stores', 'runs a pipeline') and resources ('thought in memory', 'thought history'), and distinguishes it from siblings by mentioning classification, metacognitive feedback, and retrieval of relevant thoughts, which are separate tools like 'retrieve_relevant_thoughts'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'revise_thought' or 'clear_thinking_history', nor does it mention prerequisites or exclusions. It implies usage for storing thoughts but lacks explicit context for selection among siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/Promptly-Technologies-LLC/mcp-structured-thinking'

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