feat: Enhance OAuth module and OpenRouter client functionality
- Updated OAuth module to include unused imports for better clarity. - Refactored OpenRouterClient to improve chat functionality and added support for tools in chat requests. - Modified internet tools (Download, Fetch, Search) to use a more flexible internet mode check. - Introduced new Bash tools for managing background jobs (BashOutput, BashKill). - Enhanced workflow tool to parse and execute workflow scripts with arguments. - Updated status and workflow views to reflect new agent and findings counts. - Added IPC protocol definitions for client requests and state payloads.
This commit is contained in:
@@ -42,6 +42,30 @@ pub struct McpManager {
|
||||
pub running: bool,
|
||||
}
|
||||
|
||||
pub struct McpToolAdapter {
|
||||
name: &'static str,
|
||||
description: &'static str,
|
||||
parameters: serde_json::Value,
|
||||
}
|
||||
|
||||
impl crate::tool::Tool for McpToolAdapter {
|
||||
fn name(&self) -> &'static str {
|
||||
self.name
|
||||
}
|
||||
|
||||
fn description(&self) -> &'static str {
|
||||
self.description
|
||||
}
|
||||
|
||||
fn parameters(&self) -> serde_json::Value {
|
||||
self.parameters.clone()
|
||||
}
|
||||
|
||||
fn run(&self, _ctx: &crate::tool::ToolCtx, _args: &serde_json::Value) -> anyhow::Result<String> {
|
||||
Err(anyhow::anyhow!("MCP tool execution not yet implemented"))
|
||||
}
|
||||
}
|
||||
|
||||
impl McpManager {
|
||||
pub fn new() -> Self {
|
||||
McpManager {
|
||||
@@ -75,4 +99,15 @@ impl McpManager {
|
||||
self.running = false;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn as_tools(&self) -> Vec<Box<dyn crate::tool::Tool>> {
|
||||
self.all_tools().into_iter().map(|info| {
|
||||
let name = format!("mcp__{}", info.name);
|
||||
Box::new(McpToolAdapter {
|
||||
name: Box::leak(name.into_boxed_str()),
|
||||
description: Box::leak(info.description.clone().into_boxed_str()),
|
||||
parameters: info.input_schema.clone(),
|
||||
}) as Box<dyn crate::tool::Tool>
|
||||
}).collect()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user