Skip to content

Rulvar API reference


Rulvar API reference / @rulvar/rulvar / McpToolSource

Interface: McpToolSource

Defined in: packages/core/dist/index.d.ts

The ToolSource returned by mcp: the frozen ToolSource seam plus the lifecycle the seam deliberately leaves to the host. close() releases everything the source created on first use: the SDK client, its transport, and, for stdio, the spawned child process, without which a one shot host process cannot exit naturally after a run, because the child and its pipes keep the event loop alive (v1.33.0 review P2). It is idempotent, resolves even when the connection never succeeded, and resets the source, so a later tools() call connects afresh. The engine never closes a source, because one source may serve many runs: the host owns the lifecycle and should close once its runs have settled (closing while a run is in flight fails that run's MCP tool calls).

Extends

Properties

PropertyTypeInherited fromDefined in
idstringToolSource.idpackages/core/dist/index.d.ts

Methods

close()

ts
close(): Promise<void>;

Defined in: packages/core/dist/index.d.ts

Returns

Promise&lt;void&gt;


describeRegulatedPosture()?

ts
optional describeRegulatedPosture(): RegulatedPostureDescriptor;

Defined in: packages/core/dist/index.d.ts

The construction-side posture attestation (RV4101): a PURE snapshot of the risk postures this source chose at construction (no wire, no connect, no side effects), read by compileRegulatedProfile to refuse a loosened posture and hash a tightened one. Optional: a source without it counts into the profile's unrecognized tally instead of being implied verified.

Returns

RegulatedPostureDescriptor

Inherited from

ToolSource.describeRegulatedPosture


tools()

ts
tools(session): Promise<ToolDef<SchemaSpec<unknown>>[]>;

Defined in: packages/core/dist/index.d.ts

Parameters

ParameterType
sessionToolSourceSession

Returns

Promise&lt;ToolDef&lt;SchemaSpec&lt;unknown&gt;&gt;[]&gt;

Inherited from

ToolSource.tools