Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions crates/goose/tests/mcp_integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,22 +108,22 @@ enum TestMode {
vec![
CallToolRequestParam { name: "text_editor".into(), arguments: Some(object!({
"command": "view",
"path": "~/goose/crates/goose/tests/tmp/goose.txt"
"path": "/tmp/goose_test/goose.txt"
}))},
CallToolRequestParam { name: "text_editor".into(), arguments: Some(object!({
"command": "str_replace",
"path": "~/goose/crates/goose/tests/tmp/goose.txt",
"path": "/tmp/goose_test/goose.txt",
"old_str": "# goose",
"new_str": "# goose (modified by test)"
}))},
// Test shell command to verify file was modified
CallToolRequestParam { name: "shell".into(), arguments: Some(object!({
"command": "cat ~/goose/crates/goose/tests/tmp/goose.txt"
"command": "cat /tmp/goose_test/goose.txt"
})) },
// Test text_editor tool to restore original content
CallToolRequestParam { name: "text_editor".into(), arguments: Some(object!({
"command": "str_replace",
"path": "~/goose/crates/goose/tests/tmp/goose.txt",
"path": "/tmp/goose_test/goose.txt",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could just delete these tests. The purpose of the snapshot test was to verify the protocol messaging, not so much the servers themselves. The developer mcp server should probably have its own integration test instead

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the logic, yeah. I think I'll merge this as an improvement on current state, then we should consider quality integration tests for the developer and other built in servers.

"old_str": "# goose (modified by test)",
"new_str": "# goose"
}))},
Expand All @@ -138,6 +138,13 @@ async fn test_replayed_session(
required_envs: Vec<&str>,
) {
std::env::set_var("GOOSE_MCP_CLIENT_VERSION", "0.0.0");

// Setup test file for developer extension tests
let test_file_path = "/tmp/goose_test/goose.txt";
if let Some(parent) = std::path::Path::new(test_file_path).parent() {
fs::create_dir_all(parent).ok();
}
fs::write(test_file_path, "# goose\n").ok();
let replay_file_name = command
.iter()
.map(|s| s.replace("/", "_"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ STDIN: {"jsonrpc":"2.0","method":"notifications/initialized"}
STDERR: 2025-09-27T04:13:30.418172Z  INFO rmcp::handler::server: client initialized
STDERR: at /Users/angiej/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rmcp-0.6.2/src/handler/server.rs:218
STDERR:
STDIN: {"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"_meta":{"progressToken":0},"name":"text_editor","arguments":{"command":"view","path":"~/goose/crates/goose/tests/tmp/goose.txt"}}}
STDIN: {"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"_meta":{"progressToken":0},"name":"text_editor","arguments":{"command":"view","path":"/tmp/goose_test/goose.txt"}}}
STDERR: 2025-09-27T04:13:30.418412Z  INFO rmcp::service: Service initialized as server, peer_info: Some(InitializeRequestParam { protocol_version: ProtocolVersion("2025-03-26"), capabilities: ClientCapabilities { experimental: None, roots: None, sampling: None, elicitation: None }, client_info: Implementation { name: "goose", version: "1.9.0" } })
STDERR: at /Users/angiej/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rmcp-0.6.2/src/service.rs:561
STDERR: in rmcp::service::serve_inner
STDERR:
STDOUT: {"jsonrpc":"2.0","id":1,"result":{"content":[{"type":"resource","resource":{"uri":"file:///Users/angiej/goose/crates/goose/tests/tmp/goose.txt","mimeType":"text","text":"# goose\n"},"annotations":{"audience":["assistant"]}},{"type":"text","text":"### /Users/angiej/goose/crates/goose/tests/tmp/goose.txt\n```\n1: # goose\n```\n","annotations":{"audience":["user"],"priority":0.0}}],"isError":false}}
STDIN: {"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"_meta":{"progressToken":1},"name":"text_editor","arguments":{"command":"str_replace","new_str":"# goose (modified by test)","old_str":"# goose","path":"~/goose/crates/goose/tests/tmp/goose.txt"}}}
STDOUT: {"jsonrpc":"2.0","id":2,"result":{"content":[{"type":"text","text":"The file /Users/angiej/goose/crates/goose/tests/tmp/goose.txt has been edited, and the section now reads:\n```\n# goose (modified by test)\n```\n\nReview the changes above for errors. Undo and edit the file again if necessary!\n","annotations":{"audience":["assistant"]}},{"type":"text","text":"```\n# goose (modified by test)\n```\n","annotations":{"audience":["user"],"priority":0.2}}],"isError":false}}
STDIN: {"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"_meta":{"progressToken":2},"name":"shell","arguments":{"command":"cat ~/goose/crates/goose/tests/tmp/goose.txt"}}}
STDOUT: {"jsonrpc":"2.0","id":1,"result":{"content":[{"type":"resource","resource":{"uri":"file:///tmp/goose_test/goose.txt","mimeType":"text","text":"# goose\n"},"annotations":{"audience":["assistant"]}},{"type":"text","text":"### /tmp/goose_test/goose.txt\n```\n1: # goose\n```\n","annotations":{"audience":["user"],"priority":0.0}}],"isError":false}}
STDIN: {"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"_meta":{"progressToken":1},"name":"text_editor","arguments":{"command":"str_replace","new_str":"# goose (modified by test)","old_str":"# goose","path":"/tmp/goose_test/goose.txt"}}}
STDOUT: {"jsonrpc":"2.0","id":2,"result":{"content":[{"type":"text","text":"The file /tmp/goose_test/goose.txt has been edited, and the section now reads:\n```\n# goose (modified by test)\n```\n\nReview the changes above for errors. Undo and edit the file again if necessary!\n","annotations":{"audience":["assistant"]}},{"type":"text","text":"```\n# goose (modified by test)\n```\n","annotations":{"audience":["user"],"priority":0.2}}],"isError":false}}
STDIN: {"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"_meta":{"progressToken":2},"name":"shell","arguments":{"command":"cat /tmp/goose_test/goose.txt"}}}
STDOUT: {"jsonrpc":"2.0","method":"notifications/message","params":{"level":"info","logger":"shell_tool","data":{"type":"shell_output","stream":"stdout","output":"# goose (modified by test)"}}}
STDOUT: {"jsonrpc":"2.0","id":3,"result":{"content":[{"type":"text","text":"# goose (modified by test)\n","annotations":{"audience":["assistant"]}},{"type":"text","text":"# goose (modified by test)\n","annotations":{"audience":["user"],"priority":0.0}}],"isError":false}}
STDIN: {"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"_meta":{"progressToken":3},"name":"text_editor","arguments":{"command":"str_replace","new_str":"# goose","old_str":"# goose (modified by test)","path":"~/goose/crates/goose/tests/tmp/goose.txt"}}}
STDOUT: {"jsonrpc":"2.0","id":4,"result":{"content":[{"type":"text","text":"The file /Users/angiej/goose/crates/goose/tests/tmp/goose.txt has been edited, and the section now reads:\n```\n# goose\n```\n\nReview the changes above for errors. Undo and edit the file again if necessary!\n","annotations":{"audience":["assistant"]}},{"type":"text","text":"```\n# goose\n```\n","annotations":{"audience":["user"],"priority":0.2}}],"isError":false}}
STDIN: {"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"_meta":{"progressToken":3},"name":"text_editor","arguments":{"command":"str_replace","new_str":"# goose","old_str":"# goose (modified by test)","path":"/tmp/goose_test/goose.txt"}}}
STDOUT: {"jsonrpc":"2.0","id":4,"result":{"content":[{"type":"text","text":"The file /tmp/goose_test/goose.txt has been edited, and the section now reads:\n```\n# goose\n```\n\nReview the changes above for errors. Undo and edit the file again if necessary!\n","annotations":{"audience":["assistant"]}},{"type":"text","text":"```\n# goose\n```\n","annotations":{"audience":["user"],"priority":0.2}}],"isError":false}}
STDIN: {"jsonrpc":"2.0","id":5,"method":"tools/call","params":{"_meta":{"progressToken":4},"name":"list_windows","arguments":{}}}
STDOUT: {"jsonrpc":"2.0","id":5,"result":{"content":[{"type":"text","text":"Available windows:\nMenubar","annotations":{"audience":["assistant"]}},{"type":"text","text":"Available windows:\nMenubar","annotations":{"audience":["user"],"priority":0.0}}],"isError":false}}
STDERR: 2025-09-27T04:13:30.505916Z  INFO rmcp::service: input stream terminated
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"type": "resource",
"resource": {
"uri": "file:///Users/angiej/goose/crates/goose/tests/tmp/goose.txt",
"uri": "file:///tmp/goose_test/goose.txt",
"mimeType": "text",
"text": "# goose\n"
},
Expand All @@ -15,7 +15,7 @@
},
{
"type": "text",
"text": "### /Users/angiej/goose/crates/goose/tests/tmp/goose.txt\n```\n1: # goose\n```\n",
"text": "### /tmp/goose_test/goose.txt\n```\n1: # goose\n```\n",
"annotations": {
"audience": [
"user"
Expand All @@ -27,7 +27,7 @@
[
{
"type": "text",
"text": "The file /Users/angiej/goose/crates/goose/tests/tmp/goose.txt has been edited, and the section now reads:\n```\n# goose (modified by test)\n```\n\nReview the changes above for errors. Undo and edit the file again if necessary!\n",
"text": "The file /tmp/goose_test/goose.txt has been edited, and the section now reads:\n```\n# goose (modified by test)\n```\n\nReview the changes above for errors. Undo and edit the file again if necessary!\n",
"annotations": {
"audience": [
"assistant"
Expand Down Expand Up @@ -69,7 +69,7 @@
[
{
"type": "text",
"text": "The file /Users/angiej/goose/crates/goose/tests/tmp/goose.txt has been edited, and the section now reads:\n```\n# goose\n```\n\nReview the changes above for errors. Undo and edit the file again if necessary!\n",
"text": "The file /tmp/goose_test/goose.txt has been edited, and the section now reads:\n```\n# goose\n```\n\nReview the changes above for errors. Undo and edit the file again if necessary!\n",
"annotations": {
"audience": [
"assistant"
Expand Down
Loading