mirror of
https://github.com/block/goose.git
synced 2026-07-17 12:56:20 +02:00
perf: Avoid repeated MCP queries during streaming responses (#6138)
This commit is contained in:
@@ -289,11 +289,11 @@ impl Agent {
|
||||
async fn categorize_tools(
|
||||
&self,
|
||||
response: &Message,
|
||||
_tools: &[rmcp::model::Tool],
|
||||
tools: &[rmcp::model::Tool],
|
||||
) -> ToolCategorizeResult {
|
||||
// Categorize tool requests
|
||||
let (frontend_requests, remaining_requests, filtered_response) =
|
||||
self.categorize_tool_requests(response).await;
|
||||
self.categorize_tool_requests(response, tools).await;
|
||||
|
||||
ToolCategorizeResult {
|
||||
frontend_requests,
|
||||
|
||||
@@ -270,9 +270,8 @@ impl Agent {
|
||||
pub(crate) async fn categorize_tool_requests(
|
||||
&self,
|
||||
response: &Message,
|
||||
tools: &[Tool],
|
||||
) -> (Vec<ToolRequest>, Vec<ToolRequest>, Message) {
|
||||
let tools = self.list_tools(None).await;
|
||||
|
||||
// First collect all tool requests with coercion applied
|
||||
let tool_requests: Vec<ToolRequest> = response
|
||||
.content
|
||||
|
||||
Reference in New Issue
Block a user