victauri_plugin/mcp/introspection_params.rs
1use schemars::JsonSchema;
2use serde::Deserialize;
3
4/// Actions available in the `introspect` compound tool.
5#[derive(Debug, Copy, Clone, Deserialize, JsonSchema)]
6#[serde(rename_all = "snake_case")]
7pub enum IntrospectAction {
8 /// Get per-command execution timing statistics (min/max/avg/p95).
9 CommandTimings,
10 /// Report which registered commands have been called during this session.
11 Coverage,
12 /// Record the current response shape of a command as a baseline contract.
13 ContractRecord,
14 /// Check all recorded contracts for schema drift.
15 ContractCheck,
16 /// List all recorded contract baselines.
17 ContractList,
18 /// Clear all recorded contract baselines.
19 ContractClear,
20 /// Report plugin startup phase timing breakdown.
21 StartupTiming,
22 /// Audit Tauri v2 capabilities and permissions.
23 Capabilities,
24 /// `SQLite` database health diagnostics (journal mode, WAL, page stats).
25 DbHealth,
26 /// Snapshot of Victauri's own managed state (event log, registry, recording, faults, etc.).
27 ManagedState,
28 /// Current process info (PID, uptime, thread count).
29 Processes,
30 /// Report Victauri's spawned async tasks and their status.
31 Tasks,
32 /// Report the app's file system scope configuration from Tauri config.
33 FsScope,
34 /// List captured Tauri event bus events.
35 EventBus,
36 /// Clear the event bus capture buffer.
37 EventBusClear,
38}
39
40/// Parameters for the `introspect` compound tool.
41#[derive(Debug, Deserialize, JsonSchema)]
42pub struct IntrospectParams {
43 /// Which introspection action to perform.
44 pub action: IntrospectAction,
45
46 /// For `command_timings`: only show commands slower than this threshold (ms).
47 #[serde(skip_serializing_if = "Option::is_none")]
48 pub slow_threshold_ms: Option<f64>,
49
50 /// For `contract_record`: the command to record a baseline for.
51 #[serde(skip_serializing_if = "Option::is_none")]
52 pub command: Option<String>,
53
54 /// For `contract_record`: optional arguments to pass when invoking the command.
55 #[serde(skip_serializing_if = "Option::is_none")]
56 pub args: Option<serde_json::Value>,
57
58 /// For `db_health`: path to the `SQLite` database file.
59 #[serde(skip_serializing_if = "Option::is_none")]
60 pub db_path: Option<String>,
61
62 /// Target webview for actions that need JS eval.
63 #[serde(skip_serializing_if = "Option::is_none")]
64 pub webview_label: Option<String>,
65}
66
67/// Actions available in the `fault` compound tool.
68#[derive(Debug, Copy, Clone, Deserialize, JsonSchema)]
69#[serde(rename_all = "snake_case")]
70pub enum FaultAction {
71 /// Inject a fault rule for a specific command.
72 Inject,
73 /// List all active fault injection rules.
74 List,
75 /// Remove a specific fault rule.
76 Clear,
77 /// Remove all fault rules.
78 ClearAll,
79}
80
81/// The type of fault to inject.
82#[derive(Debug, Copy, Clone, Deserialize, JsonSchema)]
83#[serde(rename_all = "snake_case")]
84pub enum FaultKind {
85 /// Add artificial delay before command execution.
86 Delay,
87 /// Return an error without executing the command.
88 Error,
89 /// Drop the response (return empty result).
90 Drop,
91 /// Execute normally but corrupt the response structure.
92 Corrupt,
93}
94
95/// Parameters for the `fault` compound tool.
96#[derive(Debug, Deserialize, JsonSchema)]
97pub struct FaultParams {
98 /// Which fault action to perform.
99 pub action: FaultAction,
100
101 /// Target command name (required for `inject` and `clear`).
102 #[serde(skip_serializing_if = "Option::is_none")]
103 pub command: Option<String>,
104
105 /// Type of fault to inject (required for `inject`).
106 #[serde(skip_serializing_if = "Option::is_none")]
107 pub fault_type: Option<FaultKind>,
108
109 /// For `delay` faults: delay in milliseconds.
110 #[serde(skip_serializing_if = "Option::is_none")]
111 pub delay_ms: Option<u64>,
112
113 /// For `error` faults: error message to return.
114 #[serde(skip_serializing_if = "Option::is_none")]
115 pub error_message: Option<String>,
116
117 /// Maximum number of times to trigger (0 or omit for unlimited).
118 #[serde(skip_serializing_if = "Option::is_none")]
119 pub max_triggers: Option<u64>,
120}
121
122/// Actions available in the `explain` compound tool.
123#[derive(Debug, Copy, Clone, Deserialize, JsonSchema)]
124#[serde(rename_all = "snake_case")]
125pub enum ExplainAction {
126 /// Summarize recent activity across all layers (IPC, DOM, console, network, window events).
127 Summary,
128 /// Correlate the most recent burst of activity into a causal timeline.
129 LastAction,
130 /// Report what changed in the last N seconds (events, IPC calls, console entries).
131 Diff,
132}
133
134/// Parameters for the `explain` compound tool.
135#[derive(Debug, Deserialize, JsonSchema)]
136pub struct ExplainParams {
137 /// Which explain action to perform.
138 pub action: ExplainAction,
139
140 /// How many seconds to look back (default: 30 for summary, 5 for `last_action`, 10 for diff).
141 #[serde(skip_serializing_if = "Option::is_none")]
142 pub seconds: Option<u64>,
143
144 /// Target webview for JS eval (console/network log retrieval).
145 #[serde(skip_serializing_if = "Option::is_none")]
146 pub webview_label: Option<String>,
147}