mirror of
https://github.com/aaif-goose/goose.git
synced 2026-07-03 14:10:03 +02:00
fix: goose failure on first msg without adding system (#591)
This commit is contained in:
@@ -93,7 +93,7 @@ impl Capabilities {
|
||||
SystemConfig::Sse { ref uri, ref envs } => {
|
||||
let transport = SseTransport::new(uri, envs.get_env());
|
||||
let handle = transport.start().await?;
|
||||
let service = McpService::with_timeout(handle, Duration::from_secs(10));
|
||||
let service = McpService::with_timeout(handle, Duration::from_secs(100));
|
||||
Box::new(McpClient::new(service))
|
||||
}
|
||||
SystemConfig::Stdio {
|
||||
@@ -103,7 +103,7 @@ impl Capabilities {
|
||||
} => {
|
||||
let transport = StdioTransport::new(cmd, args.to_vec(), envs.get_env());
|
||||
let handle = transport.start().await?;
|
||||
let service = McpService::with_timeout(handle, Duration::from_secs(10));
|
||||
let service = McpService::with_timeout(handle, Duration::from_secs(100));
|
||||
Box::new(McpClient::new(service))
|
||||
}
|
||||
};
|
||||
|
||||
@@ -107,15 +107,18 @@ impl DefaultAgent {
|
||||
new_messages.push(msg.clone());
|
||||
}
|
||||
|
||||
// Finally add the status messages
|
||||
let message_use =
|
||||
Message::assistant().with_tool_request("000", Ok(ToolCall::new("status", json!({}))));
|
||||
// Finally add the status messages if status_str is not empty
|
||||
// The status_str is empty for the first message when no systems are added
|
||||
if !status_str.is_empty() {
|
||||
let message_use = Message::assistant()
|
||||
.with_tool_request("000", Ok(ToolCall::new("status", json!({}))));
|
||||
|
||||
let message_result =
|
||||
Message::user().with_tool_response("000", Ok(vec![Content::text(status_str)]));
|
||||
let message_result =
|
||||
Message::user().with_tool_response("000", Ok(vec![Content::text(status_str)]));
|
||||
|
||||
new_messages.push(message_use);
|
||||
new_messages.push(message_result);
|
||||
new_messages.push(message_use);
|
||||
new_messages.push(message_result);
|
||||
}
|
||||
|
||||
Ok(new_messages)
|
||||
}
|
||||
|
||||
@@ -2,8 +2,9 @@ You are a general purpose AI agent called Goose. You are capable
|
||||
of dynamically plugging into new systems and learning how to use them.
|
||||
|
||||
You solve higher level problems using the tools in these systems, and can
|
||||
interact with multiple at once.
|
||||
interact with multiple at once.
|
||||
|
||||
{% if (systems is defined) and systems %}
|
||||
Because you dynamically load systems, your conversation history may refer
|
||||
to interactions with sytems that are not currently active. The currently
|
||||
active systems are below. Each of these systems provides tools that are
|
||||
@@ -18,3 +19,7 @@ in your tool specification.
|
||||
{% if system.instructions %}### Instructions
|
||||
{{system.instructions}}{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% else %}
|
||||
No systems are defined. You should let the user know that they should add systems.
|
||||
{% endif %}
|
||||
|
||||
@@ -298,6 +298,9 @@ where
|
||||
}
|
||||
|
||||
let params = serde_json::json!({ "name": name, "arguments": arguments });
|
||||
|
||||
// TODO ERROR: check that if there is an error, we send back is_error: true with msg
|
||||
// https://modelcontextprotocol.io/docs/concepts/tools#error-handling-2
|
||||
self.send_request("tools/call", params).await
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user