Skip to main content

tool_call

Function tool_call 

Source
pub fn tool_call(params: ToolCallParams<'_>) -> Result<ToolHandle>
Expand description

Start a manual tool lifecycle span.

This emits a tool-start event after applying sanitize-request guardrails to the payload recorded for observability.

§Parameters

  • name: Tool name recorded on the emitted lifecycle event.
  • args: Raw tool arguments associated with the span.
  • parent: Optional explicit parent scope.
  • attributes: Tool attribute bitflags applied to the span.
  • data: Optional application payload stored on the returned handle. The emitted start event data is the sanitized args payload.
  • metadata: Optional JSON metadata recorded on the start event.
  • tool_call_id: Optional provider-specific correlation identifier.
  • timestamp: Optional timestamp recorded as the handle start time and on the emitted start event. When None, the current UTC time is used.

§Returns

A Result containing the created ToolHandle.

§Errors

Returns an error when the runtime owner check fails or when internal state cannot be read safely.

§Notes

Sanitize-request guardrails affect only the emitted start-event payload, not the caller-owned args value.