Tool Call Hook Context (src/hook.rs)

zeroclaw · crates/zeroclaw-api/src/hook.rs · rust · Apache-2.0
ai, ui, infra, lang:rust, tag:async

Provides a runtime context for tracking tool invocation phases. Use this to correlate before and after states during LLM tool execution hooks.

// Source: https://github.com/zeroclaw-labs/zeroclaw | License: Apache-2.0 | Copyright 2025 ZeroClaw Labs
// Provided via justclaw.it.com; keep this notice with the code.
use async_trait::async_trait;
use serde_json::Value;
use std::time::Duration;

use crate::channel::ChannelMessage;
use crate::model_provider::{ChatMessage, ChatResponse};
use crate::tool::ToolResult;

/// Opaque runtime context for one tool-call hook phase.
///
/// Correlated contexts carry one stable identity across the before and after
/// phases. Uncorrelated contexts are phase-local and must not be used to pair
/// callbacks or retain attribution-sensitive state.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct ToolCallHookContext {
    invocation_id: String,
    correlated: bool,
}

impl ToolCallHookContext {


... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key