Skip to content
中文

ModelAssistantToolMessage ​

CORE · type · Type contract

Assistant turn that may declare tool calls and may carry an empty text body.

Import ​

ts
import type { ModelAssistantToolMessage } from '@jangts/agent-core/types';
js
/** @typedef {import('@jangts/agent-core/types').ModelAssistantToolMessage} ModelAssistantToolMessage */

Other public entry points:@jangts/agent-core/types, @jangts/agent-core/structs.

Definition ​

Type: ModelAssistantToolMessage

Type expression
ts
type ModelAssistantToolMessage = ModelMessage & {
  readonly role: 'assistant';
  readonly toolCalls?: readonly ModelToolCall[];
  readonly toolCallId?: never;
  readonly images?: never;
};

Field structure ​

FieldTypeRequiredDescription
role"assistant"RequiredSee the type definition and usage context.
contentstringRequiredRendered text content sent to the model.
imagesundefinedOptionalUser-supplied visual input. Binary payload is separate from the text character budget.
toolCallsreadonly ModelToolCall[] | undefinedOptionalTool declarations made by an assistant turn; rejected on every other role at runtime.
toolCallIdundefinedOptionalCall id answered by a tool result; rejected on every other role at runtime.

Using the type ​

Read the contract at the call site ​

ts
import type { ModelAssistantToolMessage } from '@jangts/agent-core/types';

// Keep the original contract at the call site; TS and JS share the same runtime behavior.
function inspect(value: ModelAssistantToolMessage) {
  return value.role;
}
js
/** @param {import('@jangts/agent-core/types').ModelAssistantToolMessage} value */
function inspect(value) {
  return value.role;
}

API reference, usage examples and developer guides.