Skip to main content

soma_provider_core/
call.rs

1use serde_json::Value;
2
3use crate::ProviderSurface;
4
5#[derive(Debug, Clone)]
6pub struct ProviderCall {
7    pub provider: String,
8    pub action: String,
9    pub params: Value,
10    pub surface: ProviderSurface,
11    pub snapshot_id: String,
12}
13
14impl ProviderCall {
15    pub fn new(action: impl Into<String>, arguments: Value) -> Self {
16        Self {
17            provider: String::new(),
18            action: action.into(),
19            params: arguments,
20            surface: ProviderSurface::Internal,
21            snapshot_id: String::new(),
22        }
23    }
24
25    #[must_use]
26    pub fn with_surface(mut self, surface: ProviderSurface) -> Self {
27        self.surface = surface;
28        self
29    }
30
31    pub fn tool(&self) -> &str {
32        &self.action
33    }
34
35    pub fn arguments(&self) -> &Value {
36        &self.params
37    }
38}