Skip to main content
Glama

think

Capture and organize development thoughts by category and depth for structured analysis. Enables hierarchical reference and review within agile workflows.

Instructions

Record a thought for later reference and analysis.

This tool allows you to record thoughts during development or analysis processes. Thoughts can be organized by category and depth to create a hierarchical structure of analysis.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryNodefault
depthNo
metadataNo
referencesNo
thoughtYes
timestampNo

Implementation Reference

  • MCP registration (@mcp.tool()), schema (function parameters with descriptions), and wrapper handler for the 'think' tool. Delegates to think_impl from think_tool.py.
    @mcp.tool()
    def think(
        thought: str,
        category: str = "default",
        depth: int = 0,
        timestamp: Optional[int] = None,
        references: Optional[List[str]] = None,
        metadata: Optional[Dict[str, Any]] = None,
    ) -> str:
        """
        Record a thought for later reference and analysis.
    
        This tool allows you to record thoughts during development or analysis processes.
        Thoughts can be organized by category and depth to create a hierarchical structure
        of analysis.
        """
        # Extract actual values if they're Field objects
        if hasattr(thought, "default"):
            thought = thought.default
        if hasattr(category, "default"):
            category = category.default
        if hasattr(depth, "default"):
            depth = depth.default
        if hasattr(timestamp, "default"):
            timestamp = timestamp.default
        if hasattr(references, "default"):
            references = references.default
        if hasattr(metadata, "default"):
            metadata = metadata.default
    
        result = think_impl(thought, category, depth, None)
        # Convert dict to formatted JSON string
        return json.dumps(result, indent=2)
  • Core handler function that implements the logic for recording a thought, creating a thought record, storing it via _storage, and returning success response.
    def think(
        thought: str,
        category: Optional[str] = None,
        depth: int = 1,
        previous_thought_id: Optional[int] = None,
    ) -> Dict[str, Any]:
        """Record a thought."""
        thought_id = len(_storage.get_thoughts()) + 1
        timestamp = datetime.now().isoformat()
    
        thought_record = {
            "thought_id": thought_id,
            "id": thought_id,  # Alias for backward compatibility
            "index": thought_id,  # Another alias used in some tests
            "thought": thought,
            "timestamp": timestamp,
            "category": category,
            "depth": depth,
            "previous_thought_id": previous_thought_id,
        }
    
        _storage.add_thought(thought_record)
    
        message = f"Thought recorded with ID {thought_id}"
        if category:
            message += f" in category '{category}'"
        if depth > 1:
            message += f" at depth {depth} (deeper analysis)"
        if depth > 2:
            message = message.replace("deeper analysis", "much deeper analysis")
    
        return {"success": True, "thought_id": thought_id, "message": message}
  • ThoughtStorage class: helper utility for persisting thoughts to a temporary JSON file.
    class ThoughtStorage:
        def __init__(self):
            self._storage_file = None
            self._thoughts = []
            self._init_storage()
    
        def _init_storage(self):
            """Initialize temporary file for thought storage."""
            temp = tempfile.NamedTemporaryFile(prefix="mcp_thoughts_", suffix=".tmp", delete=False)
            self._storage_file = temp.name
            temp.close()
            logger.debug(f"Initialized thought storage using temporary file: {self._storage_file}")
    
        def add_thought(self, thought: Dict[str, Any]):
            """Add a thought to storage."""
            self._thoughts.append(thought)
            self._save()
    
        def get_thoughts(self) -> List[Dict[str, Any]]:
            """Get all stored thoughts."""
            return self._thoughts
    
        def clear_thoughts(self, category: Optional[str] = None):
            """Clear stored thoughts, optionally by category."""
            if category:
                self._thoughts = [t for t in self._thoughts if t.get("category") != category]
            else:
                self._thoughts = []
            self._save()
    
        def _save(self):
            """Save thoughts to storage file."""
            with open(self._storage_file, "w") as f:
                json.dump(self._thoughts, f)
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states the tool records thoughts for later reference, implying persistence and non-destructive behavior, but doesn't clarify where thoughts are stored (e.g., database, memory), whether recording is idempotent, or if there are rate limits. The description adds basic context about organization but misses critical operational details for a tool with 6 parameters.

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 appropriately sized with three sentences that are front-loaded (core purpose first) and avoid redundancy. Each sentence adds value: the first states the primary function, the second reinforces the action, and the third explains organizational capabilities. No wasted words, though it could be slightly more structured for clarity.

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 (6 parameters, no annotations, no output schema), the description is incomplete. It covers the basic purpose and hints at organization but lacks details on storage behavior, error handling, return values, and parameter usage. For a tool with rich input schema and sibling tools, more contextual guidance is needed to ensure correct invocation.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate for all 6 parameters. It mentions 'category' and 'depth' for hierarchical organization, which adds meaning beyond schema titles, but doesn't explain 'thought' (required), 'metadata', 'references', or 'timestamp'. With 4 parameters undocumented in the description, it fails to adequately compensate for the schema gap.

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

Purpose4/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 as 'Record a thought for later reference and analysis' with the specific verb 'record' and resource 'thought'. It distinguishes from siblings like 'get_thoughts' (retrieval) and 'clear_thoughts' (deletion) by focusing on creation. However, it doesn't explicitly differentiate from 'think_more' which might be a similar recording operation.

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

Usage Guidelines3/5

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

The description provides implied usage context ('during development or analysis processes') and mentions organization by category and depth, suggesting when hierarchical structuring is beneficial. However, it lacks explicit guidance on when to use this tool versus alternatives like 'think_more' or 'should_think', and doesn't mention prerequisites or exclusions.

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

Related 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/smian0/mcp-agile-flow'

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