Entropic 2.3.8
Local-first agentic inference engine
Loading...
Searching...
No Matches
entropic::ToolCallHistory Class Reference

Fixed-size ring buffer of recent tool calls. More...

#include <entropic/mcp/tool_call_history.h>

Public Member Functions

 ToolCallHistory (size_t capacity=100)
 Construct with buffer capacity.
 
void record (const ToolCallRecord &entry)
 Record a completed tool call.
 
std::vector< ToolCallRecordrecent (size_t count) const
 Get the N most recent entries (newest first).
 
std::vector< ToolCallRecordall () const
 Get all stored entries (oldest first, insertion order).
 
std::string to_json (size_t count) const
 Serialize recent entries to JSON array string.
 
size_t size () const
 Current number of stored entries.
 

Detailed Description

Fixed-size ring buffer of recent tool calls.

Capacity set at construction (default 100). When full, oldest entries are overwritten. Thread-safe reads via shared_mutex.

Usage
ToolCallHistory history(100);
history.record({.sequence=1, .tool_name="fs.read", ...});
auto last5 = history.recent(5); // newest first
auto all = history.all(); // oldest first
Fixed-size ring buffer of recent tool calls.
std::vector< ToolCallRecord > all() const
Get all stored entries (oldest first, insertion order).
Version
1.9.12

Definition at line 62 of file tool_call_history.h.

Constructor & Destructor Documentation

◆ ToolCallHistory()

entropic::ToolCallHistory::ToolCallHistory ( size_t  capacity = 100)
explicit

Construct with buffer capacity.

Parameters
capacityMaximum entries to retain (default 100).
Version
1.9.12
Parameters
capacityMaximum entries to retain.

Definition at line 25 of file tool_call_history.cpp.

Member Function Documentation

◆ all()

std::vector< ToolCallRecord > entropic::ToolCallHistory::all ( ) const

Get all stored entries (oldest first, insertion order).

Get all stored entries in insertion (oldest-first) order.

Returns
Vector of all records.
Version
1.9.12
Returns
Vector of all records.

Definition at line 74 of file tool_call_history.cpp.

◆ recent()

std::vector< ToolCallRecord > entropic::ToolCallHistory::recent ( size_t  count) const

Get the N most recent entries (newest first).

Parameters
countMaximum entries to return.
Returns
Vector of records, newest first.
Version
1.9.12
Parameters
countMaximum entries to return.
Returns
Vector of records, newest first.

Definition at line 55 of file tool_call_history.cpp.

◆ record()

void entropic::ToolCallHistory::record ( const ToolCallRecord entry)

Record a completed tool call.

Parameters
entryTool call record to store.
Version
1.9.12
Parameters
entryTool call record.

Definition at line 37 of file tool_call_history.cpp.

◆ size()

size_t entropic::ToolCallHistory::size ( ) const

Current number of stored entries.

Returns
Entry count (<= capacity).
Version
1.9.12
Returns
Entry count.

Definition at line 132 of file tool_call_history.cpp.

◆ to_json()

std::string entropic::ToolCallHistory::to_json ( size_t  count) const

Serialize recent entries to JSON array string.

Parameters
countMaximum entries to include (0 = all).
Returns
JSON array of ToolCallRecord objects.
Version
1.9.12
Parameters
countMaximum entries (0 = all).
Returns
JSON array string.

Definition at line 117 of file tool_call_history.cpp.


The documentation for this class was generated from the following files: