Skip to content

Interface: ISessionToolLedger

Makaio Framework


Makaio Framework / ai-adapters-core / ISessionToolLedger

Defined in: ../../../adapters/core/src/agent/session-tool-ledger.ts:47

Public contract for the session-scoped tool ledger. Tracks injection, discovery, and call state for all MCP tools during a session.

getAllEntries(): readonly ToolLedgerEntry[]

Defined in: ../../../adapters/core/src/agent/session-tool-ledger.ts:96

Return all tracked entries regardless of state.

readonly ToolLedgerEntry[]

Snapshot of all ledger entries


getCallCount(toolFullName): number

Defined in: ../../../adapters/core/src/agent/session-tool-ledger.ts:83

Return the total call count for a tool, or 0 if not tracked.

string

The namespaced tool name

number

Call count (0 for unknown tools)


getEntry(toolFullName): ToolLedgerEntry | undefined

Defined in: ../../../adapters/core/src/agent/session-tool-ledger.ts:90

Return a single ledger entry by full name, or undefined if not tracked.

string

The namespaced tool name

ToolLedgerEntry | undefined

The entry, or undefined


getInjectedTools(): readonly ToolLedgerEntry[]

Defined in: ../../../adapters/core/src/agent/session-tool-ledger.ts:76

Return all entries where injected === true.

readonly ToolLedgerEntry[]

Snapshot of currently-injected tool entries


recordCall(toolFullName, turnNumber): void

Defined in: ../../../adapters/core/src/agent/session-tool-ledger.ts:70

Record one mcp_call invocation for a tool. Implies discovery: also sets discovered and firstDiscoveredAtTurn if unset.

string

The namespaced tool name, e.g. “github__create_issue”

number

The current turn number

void


recordDiscovery(toolFullName, turnNumber): void

Defined in: ../../../adapters/core/src/agent/session-tool-ledger.ts:62

Record that the model discovered a tool. Applies first-discovery semantics: firstDiscoveredAtTurn is set only once.

string

The namespaced tool name, e.g. “github__create_issue”

number

The current turn number

void


recordInjection(tools, turnNumber): void

Defined in: ../../../adapters/core/src/agent/session-tool-ledger.ts:54

Replace the current injection set with the provided list. Tools not in the new list have their injected flag cleared (eviction sweep).

readonly object[]

The new set of directly-injected tools

number

The current turn number

void


suggestInjectionSet(context, currentTurnNumber): Promise<readonly object[]>

Defined in: ../../../adapters/core/src/agent/session-tool-ledger.ts:105

Phase 2 seam: suggest the optimal injection set for the next turn. Phase 1 pass-through: returns context.directTools mapped to ToolListItem format.

LedgerSessionContext

Current session context providing direct and discoverable tools

number

The current turn number (for future scoring heuristics)

Promise<readonly object[]>

Suggested list of tools to inject for the next turn