perf: Avoid repeated MCP queries during streaming responses (#6138)

This commit is contained in:
tlongwell-block
2025-12-16 12:31:10 -05:00
committed by GitHub
parent 10fc71f101
commit ae8ecbe090
2 changed files with 3 additions and 4 deletions
+2 -2
View File
@@ -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,
+1 -2
View File
@@ -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