API Reference

Tools

Typed tool definitions, execution context, interactions, and normalized outcomes.

tool

Access: @nylorun/harnesstool

Prepares a typed tool definition for model-visible JSON Schema and runtime argument validation.

NameTypeRequiredDescription
valueToolDefinition<Parameters, State>YesThe tool declaration to prepare. Parameters must be a synchronous Zod object schema.
ReturnsToolDefinition<Parameters, State>The prepared definition with TypeScript inference preserved.

ToolDefinition

Access: @nylorun/harnessToolDefinition, ToolObjectSchema

NameTypeRequiredDescription
namestringYesStable tool name exposed to the model.
descriptionstringNoModel-visible purpose of the tool.
parametersToolObjectSchemaYesSynchronous Zod object schema for arguments.
execute(args, context)Async functionYesPerforms host-owned work and resolves to a ToolOutcome.

ToolExecutionContext

Access: @nylorun/harnessToolExecutionContext, ToolExecutionResume

NameTypeRequiredDescription
sessionIdstringYesOwning session id.
turnIdstringYesOwning turn id.
stepIdstringYesOwning model-step id.
callIdstringYesValidated model tool-call id.
invocationIdstringYesUnique execution invocation id.
signalAbortSignalYesCancellation signal for the host service call.
statePromise<State>Capability state onlySession-local state created by the capability.
resumeToolExecutionResumeNoCorrelated approval or response when a paused tool resumes.

ToolOutcome

Access: @nylorun/harnessToolOutcome, ToolResult, DeferredOutcome

kindAdditional fieldsDescription
completedoutput: JsonValueEmits a completed ToolResult to the model loop.
deniedreason: stringEmits a denied ToolResult.
failedcode: string, message: stringEmits a failed ToolResult.
interaction-requiredinteraction: Interaction, optional tokenPauses the session for approval or a response.
deferredoptional token: JsonValueLeaves an active record for the host to persist and later continue.

Interaction and bound-tool types

Access: @nylorun/harnessInteraction, RequiredInteraction, SealedToolCall, BoundToolDefinition, BoundToolSchema, ToolOwner

TypeFieldsDescription
Interactionoptional id, kind, prompt, optional metadataRequest for approval or response before a tool can continue.
RequiredInteractionInteraction plus required idInteraction after Harness has assigned its id.
SealedToolCallcallId, toolName, argsValidated, executable model tool call.
BoundToolDefinitionPrepared parameters, execute, ownerTool definition after capability binding.
ToolOwnermiddlewareId, slotCapability location that supplied the tool.

On this page