Skip to content

Function: fromToolDescriptors()

ts
function fromToolDescriptors(descriptors: readonly ToolDescriptor<ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>>[], options?: FromToolDescriptorsOptions): ChatTools;

Defined in: packages/sdk/src/renderer/templates/tool-adapter.ts:44

Experimental

Bridge framework-neutral ToolDescriptors (from @matterway/pdf-tools/tools, @matterway/excel-tools/tools, …) into the chat template's ChatTools map.

Results flow through the same tool() normalizer as hand-written chat tools, so the model phrases bare return values naturally. Descriptors marked destructive: true get a default confirm gate — the user approves each call. Wrap individual entries afterwards to customize.

Parameters

ParameterTypeDescription
descriptorsreadonly ToolDescriptor<ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>>[]The descriptors to expose to the model.
options?FromToolDescriptorsOptionsOptional execution limits (e.g. allowed roots).

Returns

ChatTools

A ChatTools map keyed by descriptor name.

Example

ts
import {tools as pdfTools} from '@matterway/pdf-tools/tools';

await chat(ctx, {
  tools: fromToolDescriptors(pdfTools, {roots: ['/data/skill']}),
});

Matterway Assistant SDK Documentation