Interface ToolExecutionContext

Defines the invocation context passed to a tool's execute method. This context provides the tool with essential information about the calling entity (GMI, Persona), the user, and the overall session, enabling context-aware tool execution.

Interface

ToolExecutionContext

interface ToolExecutionContext {
    gmiId: string;
    personaId: string;
    userContext: UserContext;
    correlationId?: string;
    sessionData?: Record<string, any>;
    personaCapabilities?: string[];
    signal?: AbortSignal;
    callerTurn?: CallerTurnContext;
}

Properties

gmiId: string

The unique identifier of the GMI (Generalized Mind Instance) that is invoking the tool.

personaId: string

The unique identifier of the active Persona within the GMI that requested the tool execution.

userContext: UserContext

Contextual information about the end-user associated with the current interaction, which might include user ID, preferences, skill level, etc.

correlationId?: string

An optional identifier used to correlate this specific tool call with other operations, logs, or events across different parts of the system. Useful for tracing and debugging.

sessionData?: Record<string, any>

Optional. Ephemeral data relevant to the current session, potentially sourced from the GMI's working memory or the orchestrator. This allows tools to access dynamic session state if needed for their operation (e.g., user's current location, temporary files).

personaCapabilities?: string[]

The calling persona's capabilities, as the permission check received them. A tool that runs other tools on the caller's behalf (a composed tool, a workflow) passes them on, so each step is checked as the caller.

signal?: AbortSignal

The call's stop, when the call carries one (ToolExecutionRequestDetails.signal): its turn's stop on a call a GMI makes; on a step, the one its composed call passes on, or a workflow step's timer joined with the workflow call's own. A tool that runs other tools on the caller's behalf (a composed tool) passes it on, so a step whose call stopped starts nothing: it is refused before its approval is asked, or after the approval when the stop came while it was pending. A tool may end its own work when it aborts; nothing else cuts a call already running.

callerTurn?: CallerTurnContext

Live objects of the turn that made the call: its approval gate, its budget, its explicit user, a seat's tool names and hooks, the processToolCall of the view the call came through (dispatch) and the output guardrails' tool-call gate the turn asks (toolCallGate). Set by gmi()'s tool hook, by a runtime seat's view, and by a GMI whose turn asks such a gate; the step gate runs each step of a composed tool through dispatch.