Co-authored-by: Sharang Parnerkar <parnerkarsharang@gmail.com> Reviewed-on: #6
74 lines
2.0 KiB
Rust
74 lines
2.0 KiB
Rust
use serde::{Deserialize, Serialize};
|
|
|
|
/// Category grouping for MCP tools.
|
|
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
|
pub enum ToolCategory {
|
|
/// Web search and browsing tools
|
|
Search,
|
|
/// File and document processing tools
|
|
FileSystem,
|
|
/// Computation and math tools
|
|
Compute,
|
|
/// Code execution and analysis tools
|
|
Code,
|
|
/// Communication and notification tools
|
|
Communication,
|
|
}
|
|
|
|
impl ToolCategory {
|
|
/// Returns the display label for a tool category.
|
|
pub fn label(&self) -> &'static str {
|
|
match self {
|
|
Self::Search => "Search",
|
|
Self::FileSystem => "File System",
|
|
Self::Compute => "Compute",
|
|
Self::Code => "Code",
|
|
Self::Communication => "Communication",
|
|
}
|
|
}
|
|
}
|
|
|
|
/// Status of an MCP tool instance.
|
|
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
|
pub enum ToolStatus {
|
|
/// Tool is running and available
|
|
Active,
|
|
/// Tool is installed but not running
|
|
Inactive,
|
|
/// Tool encountered an error
|
|
Error,
|
|
}
|
|
|
|
impl ToolStatus {
|
|
/// Returns the CSS class suffix for status styling.
|
|
pub fn css_class(&self) -> &'static str {
|
|
match self {
|
|
Self::Active => "active",
|
|
Self::Inactive => "inactive",
|
|
Self::Error => "error",
|
|
}
|
|
}
|
|
}
|
|
|
|
/// An MCP (Model Context Protocol) tool entry.
|
|
///
|
|
/// # Fields
|
|
///
|
|
/// * `id` - Unique tool identifier
|
|
/// * `name` - Human-readable display name
|
|
/// * `description` - Brief description of what the tool does
|
|
/// * `category` - Classification category
|
|
/// * `status` - Current running status
|
|
/// * `enabled` - Whether the tool is toggled on by the user
|
|
/// * `icon` - Icon identifier for rendering
|
|
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
|
pub struct McpTool {
|
|
pub id: String,
|
|
pub name: String,
|
|
pub description: String,
|
|
pub category: ToolCategory,
|
|
pub status: ToolStatus,
|
|
pub enabled: bool,
|
|
pub icon: String,
|
|
}
|