Skip to content

[FEATURE] Add Tool Call History for MCP Operations #265

@groksrc

Description

@groksrc

Feature Description

Add a new MCP tool that provides access to the history of previous tool calls, enabling users to query and review past Basic Memory operations within their session.

Problem This Feature Solves

Currently, there's no way to programmatically access the history of previous Basic Memory tool calls. Users cannot easily:

  • Review what operations were performed in their current session
  • Check the inputs/parameters of previous calls (e.g., "What was the input for my last write_note call?")
  • Debug or audit their workflow
  • Reference previous operations for follow-up questions

Proposed Solution

Implement a new MCP tool: mcp__basic-memory__tool_history that provides:

Core Functionality

  • List Recent Tool Calls: Show the last N tool calls with timestamp, tool name, and status
  • Get Specific Tool Call Details: Retrieve full input parameters and output for a specific call
  • Filter Capabilities: Filter by tool name, time range, or status (success/failure)

Example Interface

def tool_history(
    limit: int = 10,
    tool_name: Optional[str] = None,
    include_inputs: bool = True,
    include_outputs: bool = False,
    since: Optional[str] = None  # e.g., "1h ago", "2024-01-20"
) -> ToolHistoryResponse

Example Usage

  • "Show me the input for my last Basic Memory operation"
  • "What searches did I run in the last hour?"
  • "List all write_note calls from today"

Alternative Solutions

Considered:

  1. Manual logging to files - Requires users to implement their own tracking
  2. Using existing sync_status - Only shows sync operations, not all tool calls
  3. External audit tools - Would require separate integration

Additional Context

Storage Options

  • In-Memory Cache (Session-based): Fast but lost on restart
  • SQLite Database (Persistent): Queryable across sessions
  • Hybrid Approach: Recent calls in memory, older in SQLite

Response Format Example

{
  "tool_calls": [
    {
      "id": "call_123abc",
      "timestamp": "2024-01-20T10:30:00Z",
      "tool_name": "write_note",
      "status": "success",
      "execution_time_ms": 245,
      "input": {
        "title": "Meeting Notes",
        "content": "...",
        "folder": "work"
      }
    }
  ],
  "total_count": 42
}

Impact

This feature would significantly improve:

  • Debugging: Easily review what operations were performed and with what parameters
  • Auditability: Track changes and operations over time
  • Context Recovery: Quickly reference previous operations without scrolling through conversation
  • Developer Experience: Better understanding of tool usage patterns
  • Error Recovery: Review failed operations to understand and fix issues

This would benefit all Basic Memory users, especially developers integrating Basic Memory into their workflows and those debugging complex operations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions