pub struct Invocation {
pub id: String,
pub session_id: Option<String>,
pub tool_name: String,
pub input: Value,
pub output: Option<Value>,
pub pipe_name: Option<String>,
pub latency_ms: Option<i64>,
pub success: bool,
pub error: Option<String>,
pub created_at: DateTime<Utc>,
pub fallback_used: bool,
pub fallback_type: Option<String>,
}Expand description
Invocation log entry for debugging and tracing.
Fields§
§id: StringUnique invocation identifier.
session_id: Option<String>Optional parent session ID.
tool_name: StringName of the MCP tool invoked.
input: ValueInput parameters as JSON.
output: Option<Value>Output result as JSON (if successful).
pipe_name: Option<String>Name of the Langbase pipe called.
latency_ms: Option<i64>Latency in milliseconds.
success: boolWhether the invocation succeeded.
error: Option<String>Error message (if failed).
created_at: DateTime<Utc>When the invocation occurred.
fallback_used: boolWhether a fallback was used for this invocation.
fallback_type: Option<String>Type of fallback if used (parse_error, api_unavailable, local_calculation).
Implementations§
Source§impl Invocation
impl Invocation
Sourcepub fn new(tool_name: impl Into<String>, input: Value) -> Self
pub fn new(tool_name: impl Into<String>, input: Value) -> Self
Create a new invocation log entry
Sourcepub fn with_session(self, session_id: impl Into<String>) -> Self
pub fn with_session(self, session_id: impl Into<String>) -> Self
Set the session ID
Sourcepub fn failure(self, error: impl Into<String>, latency_ms: i64) -> Self
pub fn failure(self, error: impl Into<String>, latency_ms: i64) -> Self
Mark as failed with error
Sourcepub fn with_latency(self, latency_ms: i64) -> Self
pub fn with_latency(self, latency_ms: i64) -> Self
Set latency separately
Sourcepub fn mark_success(self) -> Self
pub fn mark_success(self) -> Self
Mark as successful (simple version without output)
Sourcepub fn mark_failed(self, error: impl Into<String>) -> Self
pub fn mark_failed(self, error: impl Into<String>) -> Self
Mark as failed (simple version)
Sourcepub fn with_fallback(self, fallback_type: impl Into<String>) -> Self
pub fn with_fallback(self, fallback_type: impl Into<String>) -> Self
Mark that a fallback was used
Sourcepub fn with_parse_error_fallback(self) -> Self
pub fn with_parse_error_fallback(self) -> Self
Mark fallback with specific type constants
Mark fallback due to API unavailability
Sourcepub fn with_local_calculation_fallback(self) -> Self
pub fn with_local_calculation_fallback(self) -> Self
Mark fallback due to local calculation
Trait Implementations§
Source§impl Clone for Invocation
impl Clone for Invocation
Source§fn clone(&self) -> Invocation
fn clone(&self) -> Invocation
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Invocation
impl Debug for Invocation
Source§impl<'de> Deserialize<'de> for Invocation
impl<'de> Deserialize<'de> for Invocation
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Invocation
impl RefUnwindSafe for Invocation
impl Send for Invocation
impl Sync for Invocation
impl Unpin for Invocation
impl UnwindSafe for Invocation
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more