feat: Enable frontend tools (#1778)

This commit is contained in:
Bradley Axen
2025-04-03 14:12:42 -07:00
committed by GitHub
parent 51edc0c7af
commit c8f8963545
16 changed files with 684 additions and 132 deletions
+14
View File
@@ -149,6 +149,16 @@ pub enum ExtensionConfig {
display_name: Option<String>, // needed for the UI
timeout: Option<u64>,
},
/// Frontend-provided tools that will be called through the frontend
#[serde(rename = "frontend")]
Frontend {
/// The name used to identify this extension
name: String,
/// The tools provided by the frontend
tools: Vec<mcp_core::tool::Tool>,
/// Instructions for how to use these tools
instructions: Option<String>,
},
}
impl Default for ExtensionConfig {
@@ -224,6 +234,7 @@ impl ExtensionConfig {
Self::Sse { name, .. } => name,
Self::Stdio { name, .. } => name,
Self::Builtin { name, .. } => name,
Self::Frontend { name, .. } => name,
}
.to_string()
}
@@ -239,6 +250,9 @@ impl std::fmt::Display for ExtensionConfig {
write!(f, "Stdio({}: {} {})", name, cmd, args.join(" "))
}
ExtensionConfig::Builtin { name, .. } => write!(f, "Builtin({})", name),
ExtensionConfig::Frontend { name, tools, .. } => {
write!(f, "Frontend({}: {} tools)", name, tools.len())
}
}
}
}