//! Captured application contracts attached only to the main turn's tool runtime.
use super::ToolResult;
use crate::output::ToolDispatchContext;
use serde_json::Value;
use std::sync::Arc;
type Callback = dyn Fn(&str, Value, &ToolDispatchContext) -> ToolResult + Send + Sync;
#[derive(Clone)]
pub(crate) struct ApplicationTools {
pub(crate) definitions: Vec<Value>,
pub(crate) manifest: Value,
pub(crate) callback: Arc<Callback>,
}
impl ApplicationTools {
pub(crate) fn handles(&self, name: &str) -> bool {
self.definitions
.iter()
.any(|definition| definition["name"] == name)
}
}