Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

agent: Check is_error flag in MCP tool responses (#47095)

Xiaobo Liu521ffc3a9175
diff --git a/crates/agent/src/tools/context_server_registry.rs b/crates/agent/src/tools/context_server_registry.rs
index 12ad642cfca..c7aa697ed6c 100644
--- a/crates/agent/src/tools/context_server_registry.rs
+++ b/crates/agent/src/tools/context_server_registry.rs
@@ -380,6 +380,12 @@ impl AnyAgentTool for ContextServerTool {
}
};
+ if response.is_error == Some(true) {
+ let error_message: String =
+ response.content.iter().filter_map(|c| c.text()).collect();
+ anyhow::bail!(error_message);
+ }
+
let mut result = String::new();
for content in response.content {
match content {