feat: add session and async job mcp tools

This commit is contained in:
a.tolmachev
2026-04-06 11:35:37 +03:00
parent bd2c6d4f48
commit fdd0a45124
5 changed files with 1578 additions and 142 deletions
-21
View File
@@ -25,7 +25,6 @@ struct CatalogKey {
struct CachedCatalog {
loaded_at: Option<Instant>,
tools: Vec<PublishedAgentTool>,
tools_by_name: HashMap<String, PublishedAgentTool>,
}
impl PublishedToolCatalog {
@@ -50,20 +49,6 @@ impl PublishedToolCatalog {
.unwrap_or_default())
}
pub async fn get_tool(
&self,
workspace_slug: &str,
agent_slug: &str,
tool_name: &str,
) -> Result<Option<PublishedAgentTool>, RegistryError> {
self.refresh_if_stale(workspace_slug, agent_slug).await?;
let guard = self.cached.read().await;
Ok(guard
.get(&CatalogKey::new(workspace_slug, agent_slug))
.and_then(|entry| entry.tools_by_name.get(tool_name))
.cloned())
}
async fn refresh_if_stale(
&self,
workspace_slug: &str,
@@ -92,11 +77,6 @@ impl PublishedToolCatalog {
Err(RegistryError::PublishedAgentNotFound { .. }) => Vec::new(),
Err(error) => return Err(error),
};
let tools_by_name = tools
.iter()
.cloned()
.map(|tool| (tool.tool_name.clone(), tool))
.collect::<HashMap<_, _>>();
let mut guard = self.cached.write().await;
let previous_count = guard
.get(&key)
@@ -108,7 +88,6 @@ impl PublishedToolCatalog {
CachedCatalog {
loaded_at: Some(Instant::now()),
tools,
tools_by_name,
},
);