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 Victauri plugin startup phase timing breakdown.
21 StartupTiming,
22 /// Enumerate Tauri v2 capabilities, security config, plugin config, and window definitions.
23 Capabilities,
24 /// `SQLite` database health diagnostics (journal mode, WAL, page stats).
25 DbHealth,
26 /// Snapshot of the Victauri plugin's internal state (event log, registry, recording, faults).
27 PluginState,
28 /// Enumerate the host process and its child processes (sidecars, background workers).
29 Processes,
30 /// Report Victauri's own spawned async tasks (MCP server, event drain) and their status.
31 PluginTasks,
32 /// List captured Tauri event bus events (automatically intercepted).
33 EventBus,
34 /// Clear the event bus capture buffer.
35 EventBusClear,
36}
37
38/// Parameters for the `introspect` compound tool.
39#[derive(Debug, Deserialize, JsonSchema)]
40pub struct IntrospectParams {
41 /// Which introspection action to perform.
42 pub action: IntrospectAction,
43
44 /// For `command_timings`: only show commands slower than this threshold (ms).
45 #[serde(skip_serializing_if = "Option::is_none")]
46 pub slow_threshold_ms: Option<f64>,
47
48 /// For `contract_record`: the command to record a baseline for.
49 #[serde(skip_serializing_if = "Option::is_none")]
50 pub command: Option<String>,
51
52 /// For `contract_record`: optional arguments to pass when invoking the command.
53 #[serde(skip_serializing_if = "Option::is_none")]
54 pub args: Option<serde_json::Value>,
55
56 /// For `db_health`: path to the `SQLite` database file.
57 #[serde(skip_serializing_if = "Option::is_none")]
58 pub db_path: Option<String>,
59
60 /// Target webview for actions that need JS eval.
61 #[serde(skip_serializing_if = "Option::is_none")]
62 pub webview_label: Option<String>,
63}
64
65/// Actions available in the `fault` compound tool.
66#[derive(Debug, Copy, Clone, Deserialize, JsonSchema)]
67#[serde(rename_all = "snake_case")]
68pub enum FaultAction {
69 /// Inject a fault rule for a specific command.
70 Inject,
71 /// List all active fault injection rules.
72 List,
73 /// Remove a specific fault rule.
74 Clear,
75 /// Remove all fault rules.
76 ClearAll,
77}
78
79/// The type of fault to inject.
80#[derive(Debug, Copy, Clone, Deserialize, JsonSchema)]
81#[serde(rename_all = "snake_case")]
82pub enum FaultKind {
83 /// Add artificial delay before command execution.
84 Delay,
85 /// Return an error without executing the command.
86 Error,
87 /// Drop the response (return empty result).
88 Drop,
89 /// Execute normally but corrupt the response structure.
90 Corrupt,
91}
92
93/// Parameters for the `fault` compound tool.
94#[derive(Debug, Deserialize, JsonSchema)]
95pub struct FaultParams {
96 /// Which fault action to perform.
97 pub action: FaultAction,
98
99 /// Target command name (required for `inject` and `clear`).
100 #[serde(skip_serializing_if = "Option::is_none")]
101 pub command: Option<String>,
102
103 /// Type of fault to inject (required for `inject`).
104 #[serde(skip_serializing_if = "Option::is_none")]
105 pub fault_type: Option<FaultKind>,
106
107 /// For `delay` faults: delay in milliseconds.
108 #[serde(skip_serializing_if = "Option::is_none")]
109 pub delay_ms: Option<u64>,
110
111 /// For `error` faults: error message to return.
112 #[serde(skip_serializing_if = "Option::is_none")]
113 pub error_message: Option<String>,
114
115 /// Maximum number of times to trigger (0 or omit for unlimited).
116 #[serde(skip_serializing_if = "Option::is_none")]
117 pub max_triggers: Option<u64>,
118}
119
120/// Actions available in the `explain` compound tool.
121#[derive(Debug, Copy, Clone, Deserialize, JsonSchema)]
122#[serde(rename_all = "snake_case")]
123pub enum ExplainAction {
124 /// Summarize recent activity across all layers (IPC, DOM, console, network, window events).
125 Summary,
126 /// Correlate the most recent burst of activity into a causal timeline.
127 LastAction,
128 /// Report what changed in the last N seconds (events, IPC calls, console entries).
129 Diff,
130}
131
132/// Parameters for the `explain` compound tool.
133#[derive(Debug, Deserialize, JsonSchema)]
134pub struct ExplainParams {
135 /// Which explain action to perform.
136 pub action: ExplainAction,
137
138 /// How many seconds to look back (default: 30 for summary, 5 for `last_action`, 10 for diff).
139 #[serde(skip_serializing_if = "Option::is_none")]
140 pub seconds: Option<u64>,
141
142 /// Target webview for JS eval (console/network log retrieval).
143 #[serde(skip_serializing_if = "Option::is_none")]
144 pub webview_label: Option<String>,
145}