Skip to content
中文

ModelToolResultMessage ​

CORE · type · Type contract

Tool result turn; toolCallId is required and images/tool declarations are rejected.

Import ​

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

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

Definition ​

Type: ModelToolResultMessage

Type expression
ts
type ModelToolResultMessage = ModelMessage & {
  readonly role: 'tool';
  readonly toolCallId: string;
  readonly toolCalls?: never;
  readonly images?: never;
};

Field structure ​

FieldTypeRequiredDescription
role"tool"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.
toolCallsundefinedOptionalTool declarations made by an assistant turn; rejected on every other role at runtime.
toolCallIdstringRequiredCall 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 { ModelToolResultMessage } from '@jangts/agent-core/types';

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

API reference, usage examples and developer guides.