Skip to main content
Glama
execute_command.rs1.52 kB
//! Dynamic command execution. use serde_json::Value; use tauri::{command, AppHandle, Runtime}; /// Executes an arbitrary Tauri command dynamically. /// /// This command is a placeholder for dynamic command execution. In a full implementation, /// it would use Tauri's internal command registry to invoke commands by name. /// /// # Arguments /// /// * `_app` - The Tauri application handle /// * `command` - The name of the command to execute /// * `args` - JSON arguments to pass to the command /// /// # Returns /// /// * `Ok(Value)` - The command result as JSON /// * `Err(String)` - An error message if execution fails /// /// # Examples /// /// ```typescript /// import { invoke } from '@tauri-apps/api/core'; /// /// const result = await invoke('plugin:mcp-bridge|execute_command', { /// command: 'greet', /// args: { name: 'World' } /// }); /// ``` /// /// # Note /// /// This is currently not fully implemented and returns an error. Future versions /// will support dynamic command execution through Tauri's command registry. #[command] pub async fn execute_command<R: Runtime>( _app: AppHandle<R>, command: String, args: Value, ) -> Result<Value, String> { // Note: This is a simplified version. In practice, you'd need to use Tauri's // internal command registry to dynamically invoke commands. // For now, we'll return an error indicating this needs backend support. Err(format!( "Dynamic command execution not yet implemented. Command: {command}, Args: {args}" )) }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hypothesi/mcp-server-tauri'

If you have feedback or need assistance with the MCP directory API, please join our Discord server