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';1
js
/** @typedef {import('@jangts/agent-core/types').ModelToolResultMessage} ModelToolResultMessage */1
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;
};1
2
3
4
5
6
2
3
4
5
6
Field structure
| Field | Type | Required | Description |
|---|---|---|---|
role | "tool" | Required | See the type definition and usage context. |
content | string | Required | Rendered text content sent to the model. |
images | undefined | Optional | User-supplied visual input. Binary payload is separate from the text character budget. |
toolCalls | undefined | Optional | Tool declarations made by an assistant turn; rejected on every other role at runtime. |
toolCallId | string | Required | Call 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;
}1
2
3
4
5
6
2
3
4
5
6
js
/** @param {import('@jangts/agent-core/types').ModelToolResultMessage} value */
function inspect(value) {
return value.role;
}1
2
3
4
2
3
4