#[inspectable]Expand description
Marks a #[tauri::command] as inspectable by Victauri.
Generates a companion <fn_name>__schema() function that returns a
victauri_core::CommandInfo with the command’s name, description,
argument types, return type, and NL-resolution metadata.
Call the schema function at setup time to register the command in the
Victauri CommandRegistry.
§Dependency requirement
The generated code names victauri_core::... by absolute path, so the crate
using this attribute must list victauri-core in its own [dependencies]
(this holds whether the macro is imported from victauri_macros or via the
victauri_plugin::inspectable re-export). Without it, compilation fails with
E0433: failed to resolve: use of undeclared crate victauri_core.
victauri init adds the dependency automatically.
§Argument keys
Tauri renames command arguments to camelCase by default: a size_kb argument is
invoked as invoke("cmd", { sizeKb }). Each registered argument records that IPC
key (CommandArg::key), so an agent reading the registry passes the key the
command actually accepts. #[tauri::command] consumes its own attribute before
this macro runs, so when the command uses rename_all = "snake_case" or
rename = "...", repeat it here — #[inspectable(rename_all = "snake_case")],
#[inspectable(rename = "...")]. (Written above #[tauri::command(...)],
#[inspectable] reads those options itself.)
§Example
#[tauri::command]
#[inspectable(description = "Save API key for a provider")]
async fn save_api_key(provider: String, key: String) -> Result<(), String> {
// ...
}
// At setup:
state.registry.register(save_api_key__schema());§Release builds
Everything Victauri-specific is gated on debug_assertions, evaluated in YOUR crate’s
profile (the Victauri plugin is a no-op in release, so nothing could read it):
- the auto-discovery registration (what
VictauriBuilder::auto_discover()collects) is not emitted, so a release build has no startup constructor for it; - the
<fn>__schema()companion still exists — code passing it toVictauriBuilder::commands(...)orregister_commands!keeps compiling — but returns only the command name (and whether it is async): the description, intent, category, examples and argument/return types are not compiled in.
So none of the metadata strings ship in a release binary.