victauri_plugin/mcp/backend_params.rs
1use schemars::JsonSchema;
2use serde::Deserialize;
3
4/// Parameters for the `get_registry` tool.
5#[derive(Debug, Deserialize, JsonSchema)]
6pub struct RegistryParams {
7 /// Search query to filter commands by name or description.
8 pub query: Option<String>,
9}
10
11/// Parameters for the `invoke_command` tool.
12#[derive(Debug, Deserialize, JsonSchema)]
13pub struct InvokeCommandParams {
14 /// The Tauri command name to invoke (e.g. "greet", "`save_settings`").
15 pub command: String,
16 /// Arguments as a JSON object. Keys are parameter names. Omit for commands with no arguments.
17 pub args: Option<serde_json::Value>,
18 /// Target webview label.
19 pub webview_label: Option<String>,
20}
21
22/// Which app directory to target.
23#[derive(Debug, Deserialize, JsonSchema, Clone, Copy)]
24#[serde(rename_all = "snake_case")]
25pub enum AppDir {
26 /// Per-user app data directory.
27 Data,
28 /// Per-user config directory.
29 Config,
30 /// Log directory.
31 Log,
32 /// Local data directory.
33 LocalData,
34}
35
36/// Parameters for the `list_app_dir` tool.
37#[derive(Debug, Deserialize, JsonSchema)]
38pub struct ListAppDirParams {
39 /// Which app directory to list. Default: data.
40 pub directory: Option<AppDir>,
41 /// Optional subdirectory path relative to the chosen root (e.g. "databases").
42 pub path: Option<String>,
43 /// Only return entries matching this glob pattern (e.g. "*.sqlite", "*.db").
44 pub pattern: Option<String>,
45 /// Maximum directory depth to recurse. Default: 1 (immediate children only).
46 pub max_depth: Option<u32>,
47}
48
49/// Parameters for the `read_app_file` tool.
50#[derive(Debug, Deserialize, JsonSchema)]
51pub struct ReadAppFileParams {
52 /// Which app directory the file is relative to. Default: data.
53 pub directory: Option<AppDir>,
54 /// File path relative to the chosen directory (e.g. "settings.json", "databases/app.db").
55 pub path: String,
56 /// Maximum number of bytes to read. Default: 1MB. Set lower for large files.
57 pub max_bytes: Option<usize>,
58 /// If true, return raw base64-encoded bytes instead of UTF-8 text.
59 pub binary: Option<bool>,
60}
61
62/// Parameters for the `query_db` tool.
63#[derive(Debug, Deserialize, JsonSchema)]
64pub struct QueryDbParams {
65 /// Path to the `SQLite` database file, relative to the app data directory.
66 /// If omitted, Victauri auto-discovers `SQLite` databases in the app data directory.
67 pub path: Option<String>,
68 /// SQL query to execute. Must be a SELECT/PRAGMA/EXPLAIN statement (read-only).
69 pub query: String,
70 /// Positional bind parameters for the query (e.g. `["value1", 42]`).
71 pub params: Option<Vec<serde_json::Value>>,
72 /// Maximum number of rows to return. Default: 100.
73 pub max_rows: Option<usize>,
74}