Type Alias: ToolHandler
ts
type ToolHandler = (
args: unknown,
ctx: DispatchContext,
meta: Registry,
) =>
| string
| Uint8Array
| Media
| Media[]
| Promise<string | Uint8Array | Media | Media[]>;The execution function for a Tool.
Parameters
| Parameter | Type |
|---|---|
args | unknown |
ctx | DispatchContext |
meta | Registry |
Returns
| string | Uint8Array | Media | Media[] | Promise< | string | Uint8Array | Media | Media[]>
Remarks
Receives the raw arguments passed to the executor, the active @nhtio/adk!DispatchContext, and the tool's metadata registry.
Return shapes:
string/Uint8Array— opaque serialised output. The ADK does not persist the bytes itself; the consumer's executor middleware is responsible for storing them and wrapping them viatool.artifactConstructor?.() ?? SpooledArtifactwhen assembling theToolCallrecord.- @nhtio/adk!Media /
Media[]— explicit-modality silo. Bypasses Tool.artifactConstructor — the handler returns the final result shape directly. The LLM battery renders eachMediaas a provider-specific content block.