Class BowireMcpConfirmationStore

Namespace
Kuestenlogik.Bowire.Mcp
Assembly
Kuestenlogik.Bowire.Mcp.dll

In-memory pending-confirmation store for the two-step mutator pattern (bowire.mock.start, bowire.record.start, bowire.env.switch, …). Step 1 of a mutation parks a description of the intended action here keyed by a short token; step 2 looks up the token, executes, and discards it. Tokens expire after DefaultTtl so a forgotten confirmation can't be replayed hours later from another agent context.

Registered as a singleton via AddBowireMcp(IServiceCollection, Action<BowireMcpOptions>?); lives for the lifetime of the MCP host process so multiple tool calls in the same session can hand the token back and forth.

public sealed class BowireMcpConfirmationStore
Inheritance
BowireMcpConfirmationStore
Inherited Members

Constructors

BowireMcpConfirmationStore()

public BowireMcpConfirmationStore()

Properties

Count

Read-only count for tests / observability — how many pending confirmations are currently parked. Includes expired entries that haven't been swept yet.

public int Count { get; }

Property Value

int

DefaultTtl

Default pending-confirmation lifetime — five minutes. Long enough that an agent can read the plan, reason about it, and reply; short enough that a forgotten pending token can't be re-played out of band an hour later. Settable for tests so they don't have to wait wall-clock minutes to exercise expiry.

public static TimeSpan DefaultTtl { get; set; }

Property Value

TimeSpan

Methods

Consume(string)

Remove and return the pending entry under token. Returns null when the token is unknown or expired; the caller surfaces this as a user-facing "no pending confirmation matches that token" message.

public BowireMcpPendingConfirmation? Consume(string token)

Parameters

token string

Returns

BowireMcpPendingConfirmation

Issue(string, string)

Park a description of an action and return the token an agent has to echo back to execute it. The kind arg is the tool name (e.g. "bowire.mock.start") — used in the human- readable token-not-found message.

public string Issue(string kind, string plan)

Parameters

kind string
plan string

Returns

string