Class: ToolCall
Defined in: src/lib/logger/components/toolCall.ts:61 Represents a function or tool call. Tool calls capture the invocation of external APIs, internal functions, or any callable operations made via tool calls in your AI application. They track the complete lifecycle including arguments, results, timing, and errors. ToolCallExample
Extends
Constructors
Constructor
new ToolCall(Defined in: src/lib/logger/components/toolCall.ts:78 Creates a new tool call log entry.config,writer):ToolCall
Parameters
config
ToolCallConfig
Configuration object defining the tool call
writer
LogWriter
Log writer instance for persisting tool call data
Returns
ToolCall
Example
Overrides
BaseContainer.constructor
Accessors
id
Get Signature
get id(): string
Defined in: src/lib/logger/components/base.ts:80
Gets the unique identifier for this container.
Returns
string
The container’s unique ID
Inherited from
BaseContainer.id
Methods
addMetadata()
addMetadata(Defined in: src/lib/logger/components/base.ts:124 Adds metadata to this container for additional context and debugging. Any data type could be added as the value in the metadata record.metadata):void
Parameters
metadata
Record<string, unknown>
Key-value pairs of metadata
Returns
void
void
Example
Inherited from
BaseContainer.addMetadata
addTag()
addTag(Defined in: src/lib/logger/components/base.ts:94 Adds a tag to this container for categorization and filtering.key,value):void
Parameters
key
string
The tag key
value
string
The tag value
Returns
void
void
Example
Inherited from
BaseContainer.addTag
data()
data():Defined in: src/lib/logger/components/toolCall.ts:155 Returns the complete data representation of this tool call.Record<string,any>
Returns
Record<string, any>
Tool call data.
Example
Overrides
BaseContainer.data
end()
end(): void
Defined in: src/lib/logger/components/base.ts:163
Marks this container as ended and records the end timestamp.
Returns
void
void
Example
Inherited from
BaseContainer.end
error()
error(Defined in: src/lib/logger/components/toolCall.ts:128 Records an error that occurred during this tool call and ends it.error):void
Parameters
error
ToolCallError
Error information including message, code, and type
Returns
void
void
Example
result()
result(Defined in: src/lib/logger/components/toolCall.ts:96 Records the successful result of this tool call and ends it.result):void
Parameters
result
string
The result returned by the tool as a string
Returns
void
void
Example
addMetadata_()
Defined in: src/lib/logger/components/base.ts:144 Static method to add metadata to any container by ID.staticaddMetadata_(writer,entity,id,metadata):void
Parameters
writer
LogWriter
The log writer instance
entity
Entity
The entity type
id
string
The container ID
metadata
Record<string, unknown>
The metadata to add
Returns
void
void
Inherited from
BaseContainer.addMetadata_
addTag_()
Defined in: src/lib/logger/components/base.ts:108 Static method to add a tag to any container by ID.staticaddTag_(writer,entity,id,key,value):void
Parameters
writer
LogWriter
The log writer instance
entity
Entity
The entity type
id
string
The container ID
key
string
The tag key
value
string
The tag value
Returns
void
void
Inherited from
BaseContainer.addTag_
end_()
Defined in: src/lib/logger/components/base.ts:177 Static method to end any container by ID.staticend_(writer,entity,id,data?):void
Parameters
writer
LogWriter
The log writer instance
entity
Entity
The entity type
id
string
The container ID
data?
any
Optional additional data to include with the end event
Returns
void
void
Inherited from
BaseContainer.end_
error_()
Defined in: src/lib/logger/components/toolCall.ts:141 Static method to record an error for any tool call by ID.staticerror_(writer,id,error):void
Parameters
writer
LogWriter
The log writer instance
id
string
The tool call ID
error
ToolCallError
Error information
Returns
void
void
result_()
Defined in: src/lib/logger/components/toolCall.ts:109 Static method to record a result for any tool call by ID.staticresult_(writer,id,result):void
Parameters
writer
LogWriter
The log writer instance
id
string
The tool call ID
result
string
The result returned by the tool
Returns
void
void